OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 26 matching lines...) Expand all Loading... |
37 #include "core/dom/ContextLifecycleObserver.h" | 37 #include "core/dom/ContextLifecycleObserver.h" |
38 #include "core/events/EventTarget.h" | 38 #include "core/events/EventTarget.h" |
39 #include "modules/ModulesExport.h" | 39 #include "modules/ModulesExport.h" |
40 #include "modules/serviceworkers/RegistrationOptions.h" | 40 #include "modules/serviceworkers/RegistrationOptions.h" |
41 #include "modules/serviceworkers/ServiceWorker.h" | 41 #include "modules/serviceworkers/ServiceWorker.h" |
42 #include "modules/serviceworkers/ServiceWorkerRegistration.h" | 42 #include "modules/serviceworkers/ServiceWorkerRegistration.h" |
43 #include "platform/heap/Handle.h" | 43 #include "platform/heap/Handle.h" |
44 #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h" | 44 #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h" |
45 #include "public/platform/modules/serviceworker/WebServiceWorkerProviderClient.h
" | 45 #include "public/platform/modules/serviceworker/WebServiceWorkerProviderClient.h
" |
46 #include "wtf/Forward.h" | 46 #include "wtf/Forward.h" |
47 #include <memory> | |
48 | 47 |
49 namespace blink { | 48 namespace blink { |
50 | 49 |
51 class ExecutionContext; | 50 class ExecutionContext; |
52 class WebServiceWorker; | 51 class WebServiceWorker; |
53 class WebServiceWorkerProvider; | 52 class WebServiceWorkerProvider; |
54 class WebServiceWorkerRegistration; | 53 class WebServiceWorkerRegistration; |
55 | 54 |
56 class MODULES_EXPORT ServiceWorkerContainer final | 55 class MODULES_EXPORT ServiceWorkerContainer final |
57 : public EventTargetWithInlineData | 56 : public EventTargetWithInlineData |
58 , public ContextLifecycleObserver | 57 , public ContextLifecycleObserver |
59 , public WebServiceWorkerProviderClient { | 58 , public WebServiceWorkerProviderClient { |
60 DEFINE_WRAPPERTYPEINFO(); | 59 DEFINE_WRAPPERTYPEINFO(); |
61 USING_GARBAGE_COLLECTED_MIXIN(ServiceWorkerContainer); | 60 USING_GARBAGE_COLLECTED_MIXIN(ServiceWorkerContainer); |
62 public: | 61 public: |
63 using RegistrationCallbacks = WebServiceWorkerProvider::WebServiceWorkerRegi
strationCallbacks; | 62 using RegistrationCallbacks = WebServiceWorkerProvider::WebServiceWorkerRegi
strationCallbacks; |
64 | 63 |
65 static ServiceWorkerContainer* create(ExecutionContext*); | 64 static ServiceWorkerContainer* create(ExecutionContext*); |
66 ~ServiceWorkerContainer(); | 65 ~ServiceWorkerContainer(); |
67 | 66 |
68 void willBeDetachedFromFrame(); | 67 void willBeDetachedFromFrame(); |
69 | 68 |
70 DECLARE_VIRTUAL_TRACE(); | 69 DECLARE_VIRTUAL_TRACE(); |
71 | 70 |
72 ServiceWorker* controller() { return m_controller; } | 71 ServiceWorker* controller() { return m_controller; } |
73 ScriptPromise ready(ScriptState*); | 72 ScriptPromise ready(ScriptState*); |
74 WebServiceWorkerProvider* provider() { return m_provider; } | 73 WebServiceWorkerProvider* provider() { return m_provider; } |
75 | 74 |
76 void registerServiceWorkerImpl(ExecutionContext*, const KURL& scriptURL, con
st KURL& scope, std::unique_ptr<RegistrationCallbacks>); | 75 void registerServiceWorkerImpl(ExecutionContext*, const KURL& scriptURL, con
st KURL& scope, PassOwnPtr<RegistrationCallbacks>); |
77 | 76 |
78 ScriptPromise registerServiceWorker(ScriptState*, const String& pattern, con
st RegistrationOptions&); | 77 ScriptPromise registerServiceWorker(ScriptState*, const String& pattern, con
st RegistrationOptions&); |
79 ScriptPromise getRegistration(ScriptState*, const String& documentURL); | 78 ScriptPromise getRegistration(ScriptState*, const String& documentURL); |
80 ScriptPromise getRegistrations(ScriptState*); | 79 ScriptPromise getRegistrations(ScriptState*); |
81 | 80 |
82 // WebServiceWorkerProviderClient overrides. | 81 // WebServiceWorkerProviderClient overrides. |
83 void setController(std::unique_ptr<WebServiceWorker::Handle>, bool shouldNot
ifyControllerChange) override; | 82 void setController(std::unique_ptr<WebServiceWorker::Handle>, bool shouldNot
ifyControllerChange) override; |
84 void dispatchMessageEvent(std::unique_ptr<WebServiceWorker::Handle>, const W
ebString& message, const WebMessagePortChannelArray&) override; | 83 void dispatchMessageEvent(std::unique_ptr<WebServiceWorker::Handle>, const W
ebString& message, const WebMessagePortChannelArray&) override; |
85 | 84 |
86 // EventTarget overrides. | 85 // EventTarget overrides. |
(...skipping 11 matching lines...) Expand all Loading... |
98 ReadyProperty* createReadyProperty(); | 97 ReadyProperty* createReadyProperty(); |
99 | 98 |
100 WebServiceWorkerProvider* m_provider; | 99 WebServiceWorkerProvider* m_provider; |
101 Member<ServiceWorker> m_controller; | 100 Member<ServiceWorker> m_controller; |
102 Member<ReadyProperty> m_ready; | 101 Member<ReadyProperty> m_ready; |
103 }; | 102 }; |
104 | 103 |
105 } // namespace blink | 104 } // namespace blink |
106 | 105 |
107 #endif // ServiceWorkerContainer_h | 106 #endif // ServiceWorkerContainer_h |
OLD | NEW |