1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "nsDownloadHistory.h"
9 #include "nsServiceManagerUtils.h"
10 #include "nsIGlobalHistory2.h"
11 #include "nsIObserverService.h"
13 #include "nsIComponentRegistrar.h"
14 #include "nsDocShellCID.h"
17 ////////////////////////////////////////////////////////////////////////////////
18 //// nsDownloadHistory
20 NS_IMPL_ISUPPORTS1(nsDownloadHistory
, nsIDownloadHistory
)
22 ////////////////////////////////////////////////////////////////////////////////
23 //// nsIDownloadHistory
26 nsDownloadHistory::AddDownload(nsIURI
*aSource
,
31 NS_ENSURE_ARG_POINTER(aSource
);
33 nsCOMPtr
<nsIGlobalHistory2
> history
=
34 do_GetService("@mozilla.org/browser/global-history;2");
36 return NS_ERROR_NOT_AVAILABLE
;
39 nsresult rv
= history
->IsVisited(aSource
, &visited
);
40 NS_ENSURE_SUCCESS(rv
, rv
);
42 rv
= history
->AddURI(aSource
, false, true, aReferrer
);
43 NS_ENSURE_SUCCESS(rv
, rv
);
46 nsCOMPtr
<nsIObserverService
> os
=
47 do_GetService("@mozilla.org/observer-service;1");
49 os
->NotifyObservers(aSource
, NS_LINK_VISITED_EVENT_TOPIC
, nullptr);
56 nsDownloadHistory::RemoveAllDownloads()
58 return NS_ERROR_NOT_IMPLEMENTED
;