docshell/base/nsDownloadHistory.cpp

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     2  * vim: sw=2 ts=2 sts=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"
     8 #include "nsCOMPtr.h"
     9 #include "nsServiceManagerUtils.h"
    10 #include "nsIGlobalHistory2.h"
    11 #include "nsIObserverService.h"
    12 #include "nsIURI.h"
    14 ////////////////////////////////////////////////////////////////////////////////
    15 //// nsDownloadHistory
    17 NS_IMPL_ISUPPORTS(nsDownloadHistory, nsIDownloadHistory)
    19 ////////////////////////////////////////////////////////////////////////////////
    20 //// nsIDownloadHistory
    22 NS_IMETHODIMP
    23 nsDownloadHistory::AddDownload(nsIURI *aSource,
    24                                nsIURI *aReferrer,
    25                                PRTime aStartTime,
    26                                nsIURI *aDestination)
    27 {
    28   NS_ENSURE_ARG_POINTER(aSource);
    30   nsCOMPtr<nsIGlobalHistory2> history =
    31     do_GetService("@mozilla.org/browser/global-history;2");
    32   if (!history)
    33     return NS_ERROR_NOT_AVAILABLE;
    35   bool visited;
    36   nsresult rv = history->IsVisited(aSource, &visited);
    37   NS_ENSURE_SUCCESS(rv, rv);
    39   rv = history->AddURI(aSource, false, true, aReferrer);
    40   NS_ENSURE_SUCCESS(rv, rv);
    42   if (!visited) {
    43     nsCOMPtr<nsIObserverService> os =
    44       do_GetService("@mozilla.org/observer-service;1");
    45     if (os)
    46       os->NotifyObservers(aSource, NS_LINK_VISITED_EVENT_TOPIC, nullptr);
    47   }
    49   return NS_OK;
    50 }
    52 NS_IMETHODIMP
    53 nsDownloadHistory::RemoveAllDownloads()
    54 {
    55   return NS_ERROR_NOT_IMPLEMENTED;
    56 }

mercurial