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 "bindings/v8/ScriptPromise.h" | 8 #include "bindings/v8/ScriptPromise.h" |
9 #include "core/frame/Navigator.h" | 9 #include "core/frame/Navigator.h" |
10 #include "platform/Supplementable.h" | 10 #include "platform/Supplementable.h" |
11 | 11 |
12 namespace WebCore { | 12 namespace WebCore { |
13 | 13 |
14 class Navigator; | 14 class Navigator; |
15 class ServiceWorkerContainer; | 15 class ServiceWorkerContainer; |
16 | 16 |
17 class NavigatorServiceWorker FINAL : public Supplement<Navigator>, DOMWindowProp
erty { | 17 class NavigatorServiceWorker FINAL : public Supplement<Navigator>, DOMWindowProp
erty { |
18 public: | 18 public: |
19 virtual ~NavigatorServiceWorker(); | 19 virtual ~NavigatorServiceWorker(); |
20 static NavigatorServiceWorker* from(Navigator*); | 20 static NavigatorServiceWorker& from(Navigator&); |
21 static NavigatorServiceWorker* toNavigatorServiceWorker(Navigator* navigator
) { return static_cast<NavigatorServiceWorker*>(Supplement<Navigator>::from(navi
gator, supplementName())); } | 21 static NavigatorServiceWorker* toNavigatorServiceWorker(Navigator& navigator
) { return static_cast<NavigatorServiceWorker*>(Supplement<Navigator>::from(navi
gator, supplementName())); } |
22 static const char* supplementName(); | 22 static const char* supplementName(); |
23 | 23 |
24 static ServiceWorkerContainer* serviceWorker(Navigator*); | 24 static ServiceWorkerContainer* serviceWorker(Navigator&); |
25 | 25 |
26 private: | 26 private: |
27 explicit NavigatorServiceWorker(Navigator*); | 27 explicit NavigatorServiceWorker(Navigator&); |
28 ServiceWorkerContainer* serviceWorker(); | 28 ServiceWorkerContainer* serviceWorker(); |
29 | 29 |
30 RefPtr<ServiceWorkerContainer> m_serviceWorker; | 30 RefPtr<ServiceWorkerContainer> m_serviceWorker; |
31 }; | 31 }; |
32 | 32 |
33 } // namespace WebCore | 33 } // namespace WebCore |
34 | 34 |
35 #endif // NavigatorServiceWorker_h | 35 #endif // NavigatorServiceWorker_h |
OLD | NEW |