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/page/Page.h" | 8 #include "core/page/Page.h" |
9 #include "platform/Supplementable.h" | 9 #include "platform/Supplementable.h" |
10 #include "wtf/Forward.h" | 10 #include "wtf/Forward.h" |
11 #include "wtf/Noncopyable.h" | 11 #include "wtf/Noncopyable.h" |
12 #include "wtf/PassOwnPtr.h" | 12 #include "wtf/PassOwnPtr.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
| 15 |
15 class WebPushClient; | 16 class WebPushClient; |
16 } // namespace blink | |
17 | |
18 namespace blink { | |
19 | 17 |
20 class PushController FINAL : public NoBaseWillBeGarbageCollected<PushController>
, public WillBeHeapSupplement<Page> { | 18 class PushController FINAL : public NoBaseWillBeGarbageCollected<PushController>
, public WillBeHeapSupplement<Page> { |
21 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PushController); | 19 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PushController); |
22 WTF_MAKE_NONCOPYABLE(PushController); | 20 WTF_MAKE_NONCOPYABLE(PushController); |
23 | 21 |
24 public: | 22 public: |
25 static PassOwnPtrWillBeRawPtr<PushController> create(blink::WebPushClient*); | 23 static PassOwnPtrWillBeRawPtr<PushController> create(WebPushClient*); |
26 static const char* supplementName(); | 24 static const char* supplementName(); |
27 static PushController* from(Page* page) { return static_cast<PushController*
>(WillBeHeapSupplement<Page>::from(page, supplementName())); } | 25 static PushController* from(Page* page) { return static_cast<PushController*
>(WillBeHeapSupplement<Page>::from(page, supplementName())); } |
28 static blink::WebPushClient* clientFrom(Page*); | 26 static WebPushClient* clientFrom(Page*); |
29 | 27 |
30 blink::WebPushClient* client() const { return m_client; } | 28 WebPushClient* client() const { return m_client; } |
31 | 29 |
32 virtual void trace(Visitor* visitor) OVERRIDE { WillBeHeapSupplement<Page>::
trace(visitor); } | 30 virtual void trace(Visitor* visitor) OVERRIDE { WillBeHeapSupplement<Page>::
trace(visitor); } |
33 | 31 |
34 private: | 32 private: |
35 explicit PushController(blink::WebPushClient*); | 33 explicit PushController(WebPushClient*); |
36 | 34 |
37 blink::WebPushClient* m_client; | 35 WebPushClient* m_client; |
38 }; | 36 }; |
39 | 37 |
40 void providePushControllerTo(Page&, blink::WebPushClient*); | 38 void providePushControllerTo(Page&, WebPushClient*); |
41 | 39 |
42 } // namespace blink | 40 } // namespace blink |
43 | 41 |
44 #endif // PushController_h | 42 #endif // PushController_h |
OLD | NEW |