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 file,
5 : * You can obtain one at http://mozilla.org/MPL/2.0/.
6 : */
7 :
8 : #ifndef mozilla_dom_workers_serviceworkerclients_h
9 : #define mozilla_dom_workers_serviceworkerclients_h
10 :
11 : #include "nsWrapperCache.h"
12 :
13 : #include "mozilla/dom/WorkerScope.h"
14 : #include "mozilla/dom/BindingDeclarations.h"
15 : #include "mozilla/dom/ClientsBinding.h"
16 : #include "mozilla/ErrorResult.h"
17 :
18 : namespace mozilla {
19 : namespace dom {
20 : namespace workers {
21 :
22 : class ServiceWorkerClients final : public nsISupports,
23 : public nsWrapperCache
24 : {
25 : public:
26 : NS_DECL_CYCLE_COLLECTING_ISUPPORTS
27 0 : NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(ServiceWorkerClients)
28 :
29 : explicit ServiceWorkerClients(ServiceWorkerGlobalScope* aWorkerScope);
30 :
31 : already_AddRefed<Promise>
32 : Get(const nsAString& aClientId, ErrorResult& aRv);
33 :
34 : already_AddRefed<Promise>
35 : MatchAll(const ClientQueryOptions& aOptions, ErrorResult& aRv);
36 :
37 : already_AddRefed<Promise>
38 : OpenWindow(const nsAString& aUrl, ErrorResult& aRv);
39 :
40 : already_AddRefed<Promise>
41 : Claim(ErrorResult& aRv);
42 :
43 : JSObject*
44 : WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
45 :
46 : ServiceWorkerGlobalScope*
47 0 : GetParentObject() const
48 : {
49 0 : return mWorkerScope;
50 : }
51 :
52 : private:
53 0 : ~ServiceWorkerClients()
54 0 : {
55 0 : }
56 :
57 : RefPtr<ServiceWorkerGlobalScope> mWorkerScope;
58 : };
59 :
60 : } // namespace workers
61 : } // namespace dom
62 : } // namespace mozilla
63 :
64 : #endif // mozilla_dom_workers_serviceworkerclients_h
|