OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 PresentationController_h | 5 #ifndef PresentationController_h |
6 #define PresentationController_h | 6 #define PresentationController_h |
7 | 7 |
8 #include "core/frame/LocalFrameLifecycleObserver.h" | 8 #include "core/frame/LocalFrameLifecycleObserver.h" |
9 #include "modules/ModulesExport.h" | 9 #include "modules/ModulesExport.h" |
10 #include "modules/presentation/Presentation.h" | 10 #include "modules/presentation/Presentation.h" |
11 #include "platform/Supplementable.h" | 11 #include "platform/Supplementable.h" |
12 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
13 #include "public/platform/modules/presentation/WebPresentationClient.h" | 13 #include "public/platform/modules/presentation/WebPresentationClient.h" |
14 #include "public/platform/modules/presentation/WebPresentationController.h" | 14 #include "public/platform/modules/presentation/WebPresentationController.h" |
15 | 15 |
16 namespace blink { | 16 namespace blink { |
17 | 17 |
18 class LocalFrame; | 18 class LocalFrame; |
19 class WebPresentationAvailabilityCallback; | |
19 class WebPresentationSessionClient; | 20 class WebPresentationSessionClient; |
20 enum class WebPresentationSessionState; | 21 enum class WebPresentationSessionState; |
21 | 22 |
22 // The coordinator between the various page exposed properties and the content | 23 // The coordinator between the various page exposed properties and the content |
23 // layer represented via |WebPresentationClient|. | 24 // layer represented via |WebPresentationClient|. |
24 class MODULES_EXPORT PresentationController final | 25 class MODULES_EXPORT PresentationController final |
25 : public NoBaseWillBeGarbageCollectedFinalized<PresentationController> | 26 : public NoBaseWillBeGarbageCollectedFinalized<PresentationController> |
26 , public WillBeHeapSupplement<LocalFrame> | 27 , public WillBeHeapSupplement<LocalFrame> |
27 , public LocalFrameLifecycleObserver | 28 , public LocalFrameLifecycleObserver |
28 , public WebPresentationController { | 29 , public WebPresentationController { |
29 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PresentationController); | 30 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PresentationController); |
30 WTF_MAKE_NONCOPYABLE(PresentationController); | 31 WTF_MAKE_NONCOPYABLE(PresentationController); |
31 public: | 32 public: |
32 virtual ~PresentationController(); | 33 virtual ~PresentationController(); |
33 | 34 |
34 static PassOwnPtrWillBeRawPtr<PresentationController> create(LocalFrame&, We bPresentationClient*); | 35 static PassOwnPtrWillBeRawPtr<PresentationController> create(LocalFrame&, We bPresentationClient*); |
35 | 36 |
36 static const char* supplementName(); | 37 static const char* supplementName(); |
37 static PresentationController* from(LocalFrame&); | 38 static PresentationController* from(LocalFrame&); |
38 | 39 |
39 static void provideTo(LocalFrame&, WebPresentationClient*); | 40 static void provideTo(LocalFrame&, WebPresentationClient*); |
40 | 41 |
42 WebPresentationClient* client(); | |
whywhat
2015/07/02 22:32:38
I think this is inconsistent with the other method
mlamouri (slow - plz ping)
2015/07/03 13:58:26
The only reason why these controllers exist is to
| |
43 | |
41 // Implementation of HeapSupplement. | 44 // Implementation of HeapSupplement. |
42 DECLARE_VIRTUAL_TRACE(); | 45 DECLARE_VIRTUAL_TRACE(); |
43 | 46 |
44 // Implementation of WebPresentationController. | 47 // Implementation of WebPresentationController. |
45 virtual void didChangeAvailability(bool available) override; | 48 virtual void didChangeAvailability(bool available) override; |
46 virtual bool isAvailableChangeWatched() const override; | 49 virtual bool isAvailableChangeWatched() const override; |
47 virtual void didStartDefaultSession(WebPresentationSessionClient*) override; | 50 virtual void didStartDefaultSession(WebPresentationSessionClient*) override; |
48 virtual void didChangeSessionState(WebPresentationSessionClient*, WebPresent ationSessionState) override; | 51 virtual void didChangeSessionState(WebPresentationSessionClient*, WebPresent ationSessionState) override; |
49 virtual void didReceiveSessionTextMessage(WebPresentationSessionClient*, con st WebString&) override; | 52 virtual void didReceiveSessionTextMessage(WebPresentationSessionClient*, con st WebString&) override; |
50 | 53 |
51 // Called when the first listener was added to or the last listener was remo ved from the | |
52 // |availablechange| event. | |
53 void updateAvailableChangeWatched(bool watched); | |
54 | |
55 // Called when the frame wants to start a new presentation. | 54 // Called when the frame wants to start a new presentation. |
56 void startSession(const String& presentationUrl, const String& presentationI d, WebPresentationSessionClientCallbacks*); | 55 void startSession(const String& presentationUrl, const String& presentationI d, WebPresentationSessionClientCallbacks*); |
57 | 56 |
58 // Called when the frame wants to join an existing presentation. | 57 // Called when the frame wants to join an existing presentation. |
59 void joinSession(const String& presentationUrl, const String& presentationId , WebPresentationSessionClientCallbacks*); | 58 void joinSession(const String& presentationUrl, const String& presentationId , WebPresentationSessionClientCallbacks*); |
60 | 59 |
61 // Called when the frame wants to send String message to an existing present ation session. | 60 // Called when the frame wants to send String message to an existing present ation session. |
62 void send(const String& presentationUrl, const String& presentationId, const String& message); | 61 void send(const String& presentationUrl, const String& presentationId, const String& message); |
63 | 62 |
64 // Called when the frame wants to send ArrayBuffer/View data to an existing presentation session. | 63 // Called when the frame wants to send ArrayBuffer/View data to an existing presentation session. |
65 void send(const String& presentationUrl, const String& presentationId, const uint8_t* data, size_t length); | 64 void send(const String& presentationUrl, const String& presentationId, const uint8_t* data, size_t length); |
66 | 65 |
67 // Called when the frame want to send Blob data to an existing presentation session. | 66 // Called when the frame want to send Blob data to an existing presentation session. |
68 void sendBlobData(const String& presentationUrl, const String& presentationI d, const uint8_t* data, size_t length); | 67 void sendBlobData(const String& presentationUrl, const String& presentationI d, const uint8_t* data, size_t length); |
69 | 68 |
70 // Called when the frame wants to close an existing presentation. | 69 // Called when the frame wants to close an existing presentation. |
71 void closeSession(const String& url, const String& presentationId); | 70 void closeSession(const String& url, const String& presentationId); |
72 | 71 |
72 // Called when the frame wants to know the availability of a device to prese nt. | |
73 void getAvailability(const String& presentationUrl, WebPresentationAvailabil ityCallbacks*); | |
74 | |
73 // Connects the |Presentation| object with this controller. | 75 // Connects the |Presentation| object with this controller. |
74 void setPresentation(Presentation*); | 76 void setPresentation(Presentation*); |
75 | 77 |
76 private: | 78 private: |
77 PresentationController(LocalFrame&, WebPresentationClient*); | 79 PresentationController(LocalFrame&, WebPresentationClient*); |
78 | 80 |
79 // Implementation of LocalFrameLifecycleObserver. | 81 // Implementation of LocalFrameLifecycleObserver. |
80 virtual void willDetachFrameHost() override; | 82 virtual void willDetachFrameHost() override; |
81 | 83 |
82 WebPresentationClient* m_client; | 84 WebPresentationClient* m_client; |
83 PersistentWillBeMember<Presentation> m_presentation; | 85 PersistentWillBeMember<Presentation> m_presentation; |
84 }; | 86 }; |
85 | 87 |
86 } // namespace blink | 88 } // namespace blink |
87 | 89 |
88 #endif // PresentationController_h | 90 #endif // PresentationController_h |
OLD | NEW |