OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NavigatorServiceWorker_h | 5 #ifndef NavigatorServiceWorker_h |
6 #define NavigatorServiceWorker_h | 6 #define NavigatorServiceWorker_h |
7 | 7 |
| 8 #include "core/dom/ContextLifecycleObserver.h" |
8 #include "core/frame/Navigator.h" | 9 #include "core/frame/Navigator.h" |
9 #include "modules/ModulesExport.h" | 10 #include "modules/ModulesExport.h" |
10 #include "platform/Supplementable.h" | 11 #include "platform/Supplementable.h" |
11 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
12 | 13 |
13 namespace blink { | 14 namespace blink { |
14 | 15 |
15 class Document; | 16 class Document; |
16 class ExceptionState; | 17 class ExceptionState; |
17 class Navigator; | 18 class Navigator; |
18 class ServiceWorkerContainer; | 19 class ServiceWorkerContainer; |
19 | 20 |
20 class MODULES_EXPORT NavigatorServiceWorker final : public GarbageCollected<Navi
gatorServiceWorker>, public Supplement<Navigator>, public DOMWindowProperty { | 21 class MODULES_EXPORT NavigatorServiceWorker final : public GarbageCollected<Navi
gatorServiceWorker>, public Supplement<Navigator>, public ContextLifecycleObserv
er { |
21 USING_GARBAGE_COLLECTED_MIXIN(NavigatorServiceWorker); | 22 USING_GARBAGE_COLLECTED_MIXIN(NavigatorServiceWorker); |
22 public: | 23 public: |
23 static NavigatorServiceWorker* from(Document&); | 24 static NavigatorServiceWorker* from(Document&); |
24 static NavigatorServiceWorker& from(Navigator&); | 25 static NavigatorServiceWorker& from(Navigator&); |
25 static NavigatorServiceWorker* toNavigatorServiceWorker(Navigator&); | 26 static NavigatorServiceWorker* toNavigatorServiceWorker(Navigator&); |
26 static ServiceWorkerContainer* serviceWorker(ExecutionContext*, Navigator&,
ExceptionState&); | 27 static ServiceWorkerContainer* serviceWorker(ExecutionContext*, Navigator&,
ExceptionState&); |
27 | 28 |
28 DECLARE_VIRTUAL_TRACE(); | 29 DECLARE_VIRTUAL_TRACE(); |
29 | 30 |
30 private: | 31 private: |
31 explicit NavigatorServiceWorker(Navigator&); | 32 explicit NavigatorServiceWorker(Navigator&); |
32 ServiceWorkerContainer* serviceWorker(ExceptionState&); | 33 ServiceWorkerContainer* serviceWorker(LocalFrame*, ExceptionState&); |
33 | 34 |
34 static const char* supplementName(); | 35 static const char* supplementName(); |
35 | 36 |
36 // DOMWindowProperty override. | 37 // ContextLifecycleObserver override. |
37 void willDetachGlobalObjectFromFrame() override; | 38 void contextDestroyed() override; |
38 | 39 |
39 Member<ServiceWorkerContainer> m_serviceWorker; | 40 Member<ServiceWorkerContainer> m_serviceWorker; |
40 }; | 41 }; |
41 | 42 |
42 } // namespace blink | 43 } // namespace blink |
43 | 44 |
44 #endif // NavigatorServiceWorker_h | 45 #endif // NavigatorServiceWorker_h |
OLD | NEW |