tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

LocationBase.h (1959B)


      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_dom_LocationBase_h
      8 #define mozilla_dom_LocationBase_h
      9 
     10 #include "mozilla/dom/NavigationBinding.h"
     11 #include "nsStringFwd.h"
     12 
     13 class nsIDocShell;
     14 class nsIPrincipal;
     15 class nsIURI;
     16 class nsDocShellLoadState;
     17 
     18 namespace mozilla {
     19 class ErrorResult;
     20 
     21 namespace dom {
     22 class BrowsingContext;
     23 
     24 //*****************************************************************************
     25 // Location: Script "location" object
     26 //*****************************************************************************
     27 
     28 class LocationBase {
     29 public:
     30  // WebIDL API:
     31  void Replace(const nsACString& aUrl, nsIPrincipal& aSubjectPrincipal,
     32               ErrorResult& aRv);
     33 
     34  void SetHref(const nsACString& aHref, nsIPrincipal& aSubjectPrincipal,
     35               ErrorResult& aRv);
     36 
     37 protected:
     38  virtual BrowsingContext* GetBrowsingContext() = 0;
     39  virtual nsIDocShell* GetDocShell() = 0;
     40 
     41  void Navigate(nsIURI* aURI, nsIPrincipal& aSubjectPrincipal, ErrorResult& aRv,
     42                NavigationHistoryBehavior aHistoryHandling =
     43                    NavigationHistoryBehavior::Auto);
     44  void SetHrefWithBase(const nsACString& aHref, nsIURI* aBase,
     45                       nsIPrincipal& aSubjectPrincipal, bool aReplace,
     46                       ErrorResult& aRv);
     47 
     48  // Helper for Assign/SetHref/Replace
     49  void DoSetHref(const nsACString& aHref, nsIPrincipal& aSubjectPrincipal,
     50                 bool aReplace, ErrorResult& aRv);
     51 
     52  // Get the base URL we should be using for our relative URL
     53  // resolution for SetHref/Assign/Replace.
     54  nsIURI* GetSourceBaseURL();
     55 };
     56 
     57 }  // namespace dom
     58 }  // namespace mozilla
     59 
     60 #endif  // mozilla_dom_LocationBase_h