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 #include "wtf/PassOwnPtr.h" | 13 #include "wtf/PassOwnPtr.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 class WebPushClient; | 17 class WebPushClient; |
18 | 18 |
19 class PushController final : public GarbageCollected<PushController>, public Hea
pSupplement<LocalFrame> { | 19 class PushController final : public GarbageCollected<PushController>, public Sup
plement<LocalFrame> { |
20 USING_GARBAGE_COLLECTED_MIXIN(PushController); | 20 USING_GARBAGE_COLLECTED_MIXIN(PushController); |
21 WTF_MAKE_NONCOPYABLE(PushController); | 21 WTF_MAKE_NONCOPYABLE(PushController); |
22 public: | 22 public: |
23 static RawPtr<PushController> create(WebPushClient*); | 23 static RawPtr<PushController> create(WebPushClient*); |
24 static const char* supplementName(); | 24 static const char* supplementName(); |
25 static PushController* from(LocalFrame* frame) { return static_cast<PushCont
roller*>(HeapSupplement<LocalFrame>::from(frame, supplementName())); } | 25 static PushController* from(LocalFrame* frame) { return static_cast<PushCont
roller*>(Supplement<LocalFrame>::from(frame, supplementName())); } |
26 static WebPushClient& clientFrom(LocalFrame*); | 26 static WebPushClient& clientFrom(LocalFrame*); |
27 | 27 |
28 DEFINE_INLINE_VIRTUAL_TRACE() { HeapSupplement<LocalFrame>::trace(visitor);
} | 28 DEFINE_INLINE_VIRTUAL_TRACE() { Supplement<LocalFrame>::trace(visitor); } |
29 | 29 |
30 private: | 30 private: |
31 explicit PushController(WebPushClient*); | 31 explicit PushController(WebPushClient*); |
32 | 32 |
33 WebPushClient* client() const { return m_client; } | 33 WebPushClient* client() const { return m_client; } |
34 | 34 |
35 WebPushClient* m_client; | 35 WebPushClient* m_client; |
36 }; | 36 }; |
37 | 37 |
38 MODULES_EXPORT void providePushControllerTo(LocalFrame&, WebPushClient*); | 38 MODULES_EXPORT void providePushControllerTo(LocalFrame&, WebPushClient*); |
39 | 39 |
40 } // namespace blink | 40 } // namespace blink |
41 | 41 |
42 #endif // PushController_h | 42 #endif // PushController_h |
OLD | NEW |