tor-browser

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

NavigatorLogin.h (1790B)


      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_NavigatorLogin_h
      8 #define mozilla_dom_NavigatorLogin_h
      9 
     10 #include "ErrorList.h"
     11 #include "mozilla/Maybe.h"
     12 #include "mozilla/dom/LoginStatusBinding.h"
     13 #include "nsCOMPtr.h"
     14 #include "nsIGlobalObject.h"
     15 #include "nsISupports.h"
     16 #include "nsWrapperCache.h"
     17 
     18 namespace mozilla::dom {
     19 
     20 class NavigatorLogin : public nsWrapperCache {
     21 public:
     22  NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(NavigatorLogin)
     23  NS_DECL_CYCLE_COLLECTION_NATIVE_WRAPPERCACHE_CLASS(NavigatorLogin)
     24 
     25  explicit NavigatorLogin(nsPIDOMWindowInner* aGlobal);
     26  nsPIDOMWindowInner* GetParentObject() const { return mOwner; }
     27  virtual JSObject* WrapObject(JSContext* aCx,
     28                               JS::Handle<JSObject*> aGivenProto) override;
     29 
     30  already_AddRefed<mozilla::dom::Promise> SetStatus(LoginStatus aStatus,
     31                                                    mozilla::ErrorResult& aRv);
     32 
     33  static Maybe<LoginStatus> GetLoginStatus(nsIPrincipal* aPrincipal);
     34  static nsresult SetLoginStatus(nsIPrincipal* aPrincipal, LoginStatus aStatus);
     35  static nsresult SetLoginStatus(nsIPrincipal* aPrincipal,
     36                                 const nsACString& aStatus);
     37  static nsresult ParseLoginStatusHeader(const nsACString& aStatus,
     38                                         LoginStatus& aResult);
     39 
     40 protected:
     41  virtual ~NavigatorLogin();
     42 
     43 private:
     44  nsCOMPtr<nsPIDOMWindowInner> mOwner;
     45 };
     46 
     47 }  // namespace mozilla::dom
     48 
     49 #endif  // mozilla_dom_NavigatorLogin_h