Clients.h (1513B)
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 #ifndef _mozilla_dom_Clients_h 7 #define _mozilla_dom_Clients_h 8 9 #include "nsCOMPtr.h" 10 #include "nsISupports.h" 11 #include "nsWrapperCache.h" 12 13 class nsIGlobalObject; 14 15 namespace mozilla { 16 17 class ErrorResult; 18 19 namespace dom { 20 21 struct ClientQueryOptions; 22 class Promise; 23 24 class Clients final : public nsISupports, public nsWrapperCache { 25 nsCOMPtr<nsIGlobalObject> mGlobal; 26 27 ~Clients() = default; 28 29 public: 30 explicit Clients(nsIGlobalObject* aGlobal); 31 32 // nsWrapperCache interface methods 33 JSObject* WrapObject(JSContext* aCx, 34 JS::Handle<JSObject*> aGivenProto) override; 35 36 // DOM bindings methods 37 nsIGlobalObject* GetParentObject() const; 38 39 already_AddRefed<Promise> Get(const nsAString& aClientID, ErrorResult& aRv); 40 41 already_AddRefed<Promise> MatchAll(const ClientQueryOptions& aOptions, 42 ErrorResult& aRv); 43 44 already_AddRefed<Promise> OpenWindow(const nsAString& aURL, ErrorResult& aRv); 45 46 already_AddRefed<Promise> Claim(ErrorResult& aRv); 47 48 NS_DECL_CYCLE_COLLECTING_ISUPPORTS 49 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(Clients) 50 }; 51 52 } // namespace dom 53 } // namespace mozilla 54 55 #endif // _mozilla_dom_Clients_h