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 CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ | 5 #ifndef CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ |
6 #define CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ | 6 #define CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <map> | 11 #include <map> |
12 #include <memory> | 12 #include <memory> |
13 #include <queue> | 13 #include <queue> |
14 | 14 |
15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
16 #include "base/id_map.h" | 16 #include "base/id_map.h" |
17 #include "base/macros.h" | 17 #include "base/macros.h" |
18 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
19 #include "content/public/renderer/render_frame_observer.h" | 19 #include "content/public/renderer/render_frame_observer.h" |
20 #include "mojo/public/cpp/bindings/binding.h" | 20 #include "mojo/public/cpp/bindings/binding.h" |
21 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nClient.h" | 21 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nClient.h" |
22 #include "third_party/WebKit/public/platform/modules/presentation/presentation.m
ojom.h" | 22 #include "third_party/WebKit/public/platform/modules/presentation/presentation.m
ojom.h" |
23 | 23 |
24 namespace blink { | 24 namespace blink { |
25 class WebPresentationAvailabilityObserver; | 25 class WebPresentationAvailabilityObserver; |
26 class WebString; | 26 class WebString; |
| 27 template <typename T> |
| 28 class WebVector; |
27 } // namespace blink | 29 } // namespace blink |
28 | 30 |
29 namespace content { | 31 namespace content { |
30 | 32 |
31 // PresentationDispatcher is a delegate for Presentation API messages used by | 33 // PresentationDispatcher is a delegate for Presentation API messages used by |
32 // Blink. It forwards the calls to the Mojo PresentationService. | 34 // Blink. It forwards the calls to the Mojo PresentationService. |
33 class CONTENT_EXPORT PresentationDispatcher | 35 class CONTENT_EXPORT PresentationDispatcher |
34 : public RenderFrameObserver, | 36 : public RenderFrameObserver, |
35 public NON_EXPORTED_BASE(blink::WebPresentationClient), | 37 public NON_EXPORTED_BASE(blink::WebPresentationClient), |
36 public NON_EXPORTED_BASE(blink::mojom::PresentationServiceClient) { | 38 public NON_EXPORTED_BASE(blink::mojom::PresentationServiceClient) { |
(...skipping 18 matching lines...) Expand all Loading... |
55 static SendMessageRequest* CreateSendBinaryMessageRequest( | 57 static SendMessageRequest* CreateSendBinaryMessageRequest( |
56 const blink::WebString& presentationUrl, | 58 const blink::WebString& presentationUrl, |
57 const blink::WebString& presentationId, | 59 const blink::WebString& presentationId, |
58 blink::mojom::PresentationMessageType type, | 60 blink::mojom::PresentationMessageType type, |
59 const uint8_t* data, | 61 const uint8_t* data, |
60 size_t length); | 62 size_t length); |
61 | 63 |
62 // WebPresentationClient implementation. | 64 // WebPresentationClient implementation. |
63 void setController(blink::WebPresentationController* controller) override; | 65 void setController(blink::WebPresentationController* controller) override; |
64 void startSession( | 66 void startSession( |
65 const blink::WebString& presentationUrl, | 67 const blink::WebVector<blink::WebString>& presentationUrls, |
66 blink::WebPresentationConnectionClientCallbacks* callback) override; | 68 blink::WebPresentationConnectionClientCallbacks* callback) override; |
67 void joinSession( | 69 void joinSession( |
68 const blink::WebString& presentationUrl, | 70 const blink::WebVector<blink::WebString>& presentationUrls, |
69 const blink::WebString& presentationId, | 71 const blink::WebString& presentationId, |
70 blink::WebPresentationConnectionClientCallbacks* callback) override; | 72 blink::WebPresentationConnectionClientCallbacks* callback) override; |
71 void sendString(const blink::WebString& presentationUrl, | 73 void sendString(const blink::WebString& presentationUrl, |
72 const blink::WebString& presentationId, | 74 const blink::WebString& presentationId, |
73 const blink::WebString& message) override; | 75 const blink::WebString& message) override; |
74 void sendArrayBuffer(const blink::WebString& presentationUrl, | 76 void sendArrayBuffer(const blink::WebString& presentationUrl, |
75 const blink::WebString& presentationId, | 77 const blink::WebString& presentationId, |
76 const uint8_t* data, | 78 const uint8_t* data, |
77 size_t length) override; | 79 size_t length) override; |
78 void sendBlobData(const blink::WebString& presentationUrl, | 80 void sendBlobData(const blink::WebString& presentationUrl, |
79 const blink::WebString& presentationId, | 81 const blink::WebString& presentationId, |
80 const uint8_t* data, | 82 const uint8_t* data, |
81 size_t length) override; | 83 size_t length) override; |
82 void closeSession(const blink::WebString& presentationUrl, | 84 void closeSession(const blink::WebString& presentationUrl, |
83 const blink::WebString& presentationId) override; | 85 const blink::WebString& presentationId) override; |
84 void terminateSession(const blink::WebString& presentationUrl, | 86 void terminateSession(const blink::WebString& presentationUrl, |
85 const blink::WebString& presentationId) override; | 87 const blink::WebString& presentationId) override; |
86 void getAvailability( | 88 void getAvailability( |
87 const blink::WebString& availabilityUrl, | 89 const blink::WebString& availabilityUrl, |
88 blink::WebPresentationAvailabilityCallbacks* callbacks) override; | 90 blink::WebPresentationAvailabilityCallbacks* callbacks) override; |
89 void startListening(blink::WebPresentationAvailabilityObserver*) override; | 91 void startListening(blink::WebPresentationAvailabilityObserver*) override; |
90 void stopListening(blink::WebPresentationAvailabilityObserver*) override; | 92 void stopListening(blink::WebPresentationAvailabilityObserver*) override; |
91 void setDefaultPresentationUrl(const blink::WebString& url) override; | 93 void setDefaultPresentationUrls( |
| 94 const blink::WebVector<blink::WebString>& presentationUrls) override; |
92 | 95 |
93 // RenderFrameObserver implementation. | 96 // RenderFrameObserver implementation. |
94 void DidCommitProvisionalLoad( | 97 void DidCommitProvisionalLoad( |
95 bool is_new_navigation, | 98 bool is_new_navigation, |
96 bool is_same_page_navigation) override; | 99 bool is_same_page_navigation) override; |
97 void OnDestruct() override; | 100 void OnDestruct() override; |
98 | 101 |
99 // blink::mojom::PresentationServiceClient | 102 // blink::mojom::PresentationServiceClient |
100 void OnScreenAvailabilityNotSupported(const std::string& url) override; | 103 void OnScreenAvailabilityNotSupported(url::mojom::UrlPtr url) override; |
101 void OnScreenAvailabilityUpdated(const std::string& url, | 104 void OnScreenAvailabilityUpdated(url::mojom::UrlPtr url, |
102 bool available) override; | 105 bool available) override; |
103 void OnConnectionStateChanged( | 106 void OnConnectionStateChanged( |
104 blink::mojom::PresentationSessionInfoPtr connection, | 107 blink::mojom::PresentationSessionInfoPtr connection, |
105 blink::mojom::PresentationConnectionState state) override; | 108 blink::mojom::PresentationConnectionState state) override; |
106 void OnConnectionClosed( | 109 void OnConnectionClosed( |
107 blink::mojom::PresentationSessionInfoPtr connection, | 110 blink::mojom::PresentationSessionInfoPtr connection, |
108 blink::mojom::PresentationConnectionCloseReason reason, | 111 blink::mojom::PresentationConnectionCloseReason reason, |
109 const std::string& message) override; | 112 const std::string& message) override; |
110 void OnSessionMessagesReceived( | 113 void OnSessionMessagesReceived( |
111 blink::mojom::PresentationSessionInfoPtr session_info, | 114 blink::mojom::PresentationSessionInfoPtr session_info, |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 // Updates the listening state of availability for |status| and notifies the | 170 // Updates the listening state of availability for |status| and notifies the |
168 // client. | 171 // client. |
169 void UpdateListeningState(AvailabilityStatus* status); | 172 void UpdateListeningState(AvailabilityStatus* status); |
170 | 173 |
171 DISALLOW_COPY_AND_ASSIGN(PresentationDispatcher); | 174 DISALLOW_COPY_AND_ASSIGN(PresentationDispatcher); |
172 }; | 175 }; |
173 | 176 |
174 } // namespace content | 177 } // namespace content |
175 | 178 |
176 #endif // CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ | 179 #endif // CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ |
OLD | NEW |