LCOV - code coverage report
Current view: top level - docshell/base - IHistory.h (source / functions) Hit Total Coverage
Test: output.info Lines: 1 1 100.0 %
Date: 2017-07-14 16:53:18 Functions: 1 1 100.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             : #ifndef mozilla_IHistory_h_
       8             : #define mozilla_IHistory_h_
       9             : 
      10             : #include "nsISupports.h"
      11             : 
      12             : class nsIURI;
      13             : 
      14             : namespace mozilla {
      15             : 
      16             : namespace dom {
      17             : class Link;
      18             : } // namespace dom
      19             : 
      20             : // 0057c9d3-b98e-4933-bdc5-0275d06705e1
      21             : #define IHISTORY_IID \
      22             :   {0x0057c9d3, 0xb98e, 0x4933, {0xbd, 0xc5, 0x02, 0x75, 0xd0, 0x67, 0x05, 0xe1}}
      23             : 
      24           2 : class IHistory : public nsISupports
      25             : {
      26             : public:
      27             :   NS_DECLARE_STATIC_IID_ACCESSOR(IHISTORY_IID)
      28             : 
      29             :   /**
      30             :    * Registers the Link for notifications about the visited-ness of aURI.
      31             :    * Consumers should assume that the URI is unvisited after calling this, and
      32             :    * they will be notified if that state (unvisited) changes by having
      33             :    * SetLinkState called on themselves.  This function is guaranteed to run to
      34             :    * completion before aLink is notified.  After the node is notified, it will
      35             :    * be unregistered.
      36             :    *
      37             :    * @note SetLinkState must not call RegisterVisitedCallback or
      38             :    *       UnregisterVisitedCallback.
      39             :    *
      40             :    * @pre aURI must not be null.
      41             :    * @pre aLink may be null only in the parent (chrome) process.
      42             :    *
      43             :    * @param aURI
      44             :    *        The URI to check.
      45             :    * @param aLink
      46             :    *        The link to update whenever the history status changes.  The
      47             :    *        implementation will only hold onto a raw pointer, so if this
      48             :    *        object should be destroyed, be sure to call
      49             :    *        UnregisterVistedCallback first.
      50             :    */
      51             :   NS_IMETHOD RegisterVisitedCallback(nsIURI* aURI, dom::Link* aLink) = 0;
      52             : 
      53             :   /**
      54             :    * Unregisters a previously registered Link object.  This must be called
      55             :    * before destroying the registered object.
      56             :    *
      57             :    * @pre aURI must not be null.
      58             :    * @pre aLink must not be null.
      59             :    *
      60             :    * @param aURI
      61             :    *        The URI that aLink was registered for.
      62             :    * @param aLink
      63             :    *        The link object to unregister for aURI.
      64             :    */
      65             :   NS_IMETHOD UnregisterVisitedCallback(nsIURI* aURI, dom::Link* aLink) = 0;
      66             : 
      67             :   enum VisitFlags
      68             :   {
      69             :     /**
      70             :      * Indicates whether the URI was loaded in a top-level window.
      71             :      */
      72             :     TOP_LEVEL = 1 << 0,
      73             :     /**
      74             :      * Indicates whether the URI was loaded as part of a permanent redirect.
      75             :      */
      76             :     REDIRECT_PERMANENT = 1 << 1,
      77             :     /**
      78             :      * Indicates whether the URI was loaded as part of a temporary redirect.
      79             :      */
      80             :     REDIRECT_TEMPORARY = 1 << 2,
      81             :     /**
      82             :      * Indicates the URI is redirecting  (Response code 3xx).
      83             :      */
      84             :     REDIRECT_SOURCE = 1 << 3,
      85             :     /**
      86             :      * Indicates the URI caused an error that is unlikely fixable by a
      87             :      * retry, like a not found or unfetchable page.
      88             :      */
      89             :     UNRECOVERABLE_ERROR = 1 << 4
      90             :   };
      91             : 
      92             :   /**
      93             :    * Adds a history visit for the URI.
      94             :    *
      95             :    * @pre aURI must not be null.
      96             :    *
      97             :    * @param aURI
      98             :    *        The URI of the page being visited.
      99             :    * @param aLastVisitedURI
     100             :    *        The URI of the last visit in the chain.
     101             :    * @param aFlags
     102             :    *        The VisitFlags describing this visit.
     103             :    */
     104             :   NS_IMETHOD VisitURI(nsIURI* aURI,
     105             :                       nsIURI* aLastVisitedURI,
     106             :                       uint32_t aFlags) = 0;
     107             : 
     108             :   /**
     109             :    * Set the title of the URI.
     110             :    *
     111             :    * @pre aURI must not be null.
     112             :    *
     113             :    * @param aURI
     114             :    *        The URI to set the title for.
     115             :    * @param aTitle
     116             :    *        The title string.
     117             :    */
     118             :   NS_IMETHOD SetURITitle(nsIURI* aURI, const nsAString& aTitle) = 0;
     119             : 
     120             :   /**
     121             :    * Notifies about the visited status of a given URI.
     122             :    *
     123             :    * @param aURI
     124             :    *        The URI to notify about.
     125             :    */
     126             :   NS_IMETHOD NotifyVisited(nsIURI* aURI) = 0;
     127             : };
     128             : 
     129             : NS_DEFINE_STATIC_IID_ACCESSOR(IHistory, IHISTORY_IID)
     130             : 
     131             : #define NS_DECL_IHISTORY \
     132             :   NS_IMETHOD RegisterVisitedCallback(nsIURI* aURI, \
     133             :                                      mozilla::dom::Link* aContent) override; \
     134             :   NS_IMETHOD UnregisterVisitedCallback(nsIURI* aURI, \
     135             :                                        mozilla::dom::Link* aContent) override; \
     136             :   NS_IMETHOD VisitURI(nsIURI* aURI, \
     137             :                       nsIURI* aLastVisitedURI, \
     138             :                       uint32_t aFlags) override; \
     139             :   NS_IMETHOD SetURITitle(nsIURI* aURI, const nsAString& aTitle) override; \
     140             :   NS_IMETHOD NotifyVisited(nsIURI* aURI) override;
     141             : 
     142             : } // namespace mozilla
     143             : 
     144             : #endif // mozilla_IHistory_h_

Generated by: LCOV version 1.13