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 PushController_h | 5 #ifndef PushController_h |
6 #define PushController_h | 6 #define PushController_h |
7 | 7 |
8 #include "core/frame/LocalFrame.h" | 8 #include "core/frame/LocalFrame.h" |
9 #include "modules/ModulesExport.h" | 9 #include "modules/ModulesExport.h" |
10 #include "platform/Supplementable.h" | 10 #include "platform/Supplementable.h" |
11 #include "wtf/Forward.h" | 11 #include "wtf/Forward.h" |
12 #include "wtf/Noncopyable.h" | 12 #include "wtf/Noncopyable.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 class WebPushClient; | 16 class WebPushClient; |
17 | 17 |
18 class PushController final : public GarbageCollected<PushController>, | 18 class PushController final : public GarbageCollected<PushController>, |
19 public Supplement<LocalFrame> { | 19 public Supplement<LocalFrame> { |
20 USING_GARBAGE_COLLECTED_MIXIN(PushController); | 20 USING_GARBAGE_COLLECTED_MIXIN(PushController); |
21 WTF_MAKE_NONCOPYABLE(PushController); | 21 WTF_MAKE_NONCOPYABLE(PushController); |
22 | 22 |
23 public: | 23 public: |
24 static PushController* create(WebPushClient*); | 24 PushController(LocalFrame&, WebPushClient*); |
| 25 |
25 static const char* supplementName(); | 26 static const char* supplementName(); |
26 static PushController* from(LocalFrame* frame) { | 27 static PushController* from(LocalFrame* frame) { |
27 return static_cast<PushController*>( | 28 return static_cast<PushController*>( |
28 Supplement<LocalFrame>::from(frame, supplementName())); | 29 Supplement<LocalFrame>::from(frame, supplementName())); |
29 } | 30 } |
30 static WebPushClient& clientFrom(LocalFrame*); | 31 static WebPushClient& clientFrom(LocalFrame*); |
31 | 32 |
32 DEFINE_INLINE_VIRTUAL_TRACE() { Supplement<LocalFrame>::trace(visitor); } | 33 DEFINE_INLINE_VIRTUAL_TRACE() { Supplement<LocalFrame>::trace(visitor); } |
33 | 34 |
34 private: | 35 private: |
35 explicit PushController(WebPushClient*); | |
36 | |
37 WebPushClient* client() const { return m_client; } | 36 WebPushClient* client() const { return m_client; } |
38 | 37 |
39 WebPushClient* m_client; | 38 WebPushClient* m_client; |
40 }; | 39 }; |
41 | 40 |
42 MODULES_EXPORT void providePushControllerTo(LocalFrame&, WebPushClient*); | 41 MODULES_EXPORT void providePushControllerTo(LocalFrame&, WebPushClient*); |
43 | 42 |
44 } // namespace blink | 43 } // namespace blink |
45 | 44 |
46 #endif // PushController_h | 45 #endif // PushController_h |
OLD | NEW |