LCOV - code coverage report
Current view: top level - docshell/base - nsDownloadHistory.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 17 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 5 0.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.13