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 |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "content/common/content_export.h" | 21 #include "content/common/content_export.h" |
22 #include "content/public/common/presentation_session.h" | 22 #include "content/public/common/presentation_session.h" |
23 #include "content/public/renderer/render_frame_observer.h" | 23 #include "content/public/renderer/render_frame_observer.h" |
24 #include "mojo/public/cpp/bindings/binding.h" | 24 #include "mojo/public/cpp/bindings/binding.h" |
25 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nClient.h" | 25 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nClient.h" |
26 #include "third_party/WebKit/public/platform/modules/presentation/presentation.m
ojom.h" | 26 #include "third_party/WebKit/public/platform/modules/presentation/presentation.m
ojom.h" |
27 #include "url/gurl.h" | 27 #include "url/gurl.h" |
28 | 28 |
29 namespace blink { | 29 namespace blink { |
30 class WebPresentationAvailabilityObserver; | 30 class WebPresentationAvailabilityObserver; |
| 31 class WebPresentationConnection; |
31 class WebPresentationReceiver; | 32 class WebPresentationReceiver; |
32 class WebString; | 33 class WebString; |
33 class WebURL; | 34 class WebURL; |
34 template <typename T> | 35 template <typename T> |
35 class WebVector; | 36 class WebVector; |
36 } // namespace blink | 37 } // namespace blink |
37 | 38 |
38 namespace content { | 39 namespace content { |
39 | 40 |
40 class TestPresentationDispatcher; | 41 class TestPresentationDispatcher; |
(...skipping 14 matching lines...) Expand all Loading... |
55 friend class PresentationConnectionProxy; | 56 friend class PresentationConnectionProxy; |
56 friend class TestPresentationDispatcher; | 57 friend class TestPresentationDispatcher; |
57 friend class PresentationDispatcherTest; | 58 friend class PresentationDispatcherTest; |
58 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestStartSession); | 59 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestStartSession); |
59 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestStartSessionError); | 60 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestStartSessionError); |
60 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestJoinSession); | 61 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestJoinSession); |
61 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestJoinSessionError); | 62 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestJoinSessionError); |
62 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestSendString); | 63 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestSendString); |
63 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestSendArrayBuffer); | 64 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestSendArrayBuffer); |
64 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestSendBlobData); | 65 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestSendBlobData); |
| 66 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, |
| 67 TestOnReceiverConnectionAvailable); |
65 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestCloseSession); | 68 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestCloseSession); |
66 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestTerminateSession); | 69 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestTerminateSession); |
67 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, | 70 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, |
68 TestListenForScreenAvailability); | 71 TestListenForScreenAvailability); |
69 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, | 72 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, |
70 TestSetDefaultPresentationUrls); | 73 TestSetDefaultPresentationUrls); |
71 | 74 |
72 struct SendMessageRequest { | 75 struct SendMessageRequest { |
73 SendMessageRequest( | 76 SendMessageRequest( |
74 const PresentationSessionInfo& session_info, | 77 const PresentationSessionInfo& session_info, |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 blink::mojom::PresentationConnectionPtr /*connection*/, | 171 blink::mojom::PresentationConnectionPtr /*connection*/, |
169 blink::mojom::PresentationConnectionRequest /*connection_request*/) | 172 blink::mojom::PresentationConnectionRequest /*connection_request*/) |
170 override; | 173 override; |
171 | 174 |
172 // Call to PresentationService to send the message in |request|. | 175 // Call to PresentationService to send the message in |request|. |
173 // |session_info| and |message| of |reuqest| will be consumed. | 176 // |session_info| and |message| of |reuqest| will be consumed. |
174 // |HandleSendMessageRequests| will be invoked after the send is attempted. | 177 // |HandleSendMessageRequests| will be invoked after the send is attempted. |
175 void DoSendMessage(SendMessageRequest* request); | 178 void DoSendMessage(SendMessageRequest* request); |
176 void HandleSendMessageRequests(bool success); | 179 void HandleSendMessageRequests(bool success); |
177 | 180 |
| 181 // Creates ControllerConnectionProxy object |controller_connection_proxy| with |
| 182 // |connection|. Sends mojo interface ptr of |controller_connection_proxy| |
| 183 // and mojo interface request of |controller_connection_proxy|'s |
| 184 // |target_connection_| to PresentationService. |
| 185 // |session_info|: |connection|'s id and url; |
| 186 // |connection|: |controller_connection_proxy|'s |source_connection_|. Raw |
| 187 // pointer to Blink connection owning proxy object. It does not take object |
| 188 // ownership. |
| 189 void SetControllerConnection(const PresentationSessionInfo& session_info, |
| 190 blink::WebPresentationConnection* connection); |
| 191 |
178 virtual void ConnectToPresentationServiceIfNeeded(); | 192 virtual void ConnectToPresentationServiceIfNeeded(); |
179 | 193 |
180 void UpdateListeningState(); | 194 void UpdateListeningState(); |
181 | 195 |
182 // Used as a weak reference. Can be null since lifetime is bound to the frame. | 196 // Used as a weak reference. Can be null since lifetime is bound to the frame. |
183 blink::WebPresentationController* controller_; | 197 blink::WebPresentationController* controller_; |
184 blink::WebPresentationReceiver* receiver_; | 198 blink::WebPresentationReceiver* receiver_; |
185 blink::mojom::PresentationServicePtr presentation_service_; | 199 blink::mojom::PresentationServicePtr presentation_service_; |
186 mojo::Binding<blink::mojom::PresentationServiceClient> binding_; | 200 mojo::Binding<blink::mojom::PresentationServiceClient> binding_; |
187 | 201 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 // Returns UNKNOWN if all urls in |urls| have screen availability | 277 // Returns UNKNOWN if all urls in |urls| have screen availability |
264 // UNKNOWN. | 278 // UNKNOWN. |
265 ScreenAvailability GetScreenAvailability(const std::vector<GURL>& urls) const; | 279 ScreenAvailability GetScreenAvailability(const std::vector<GURL>& urls) const; |
266 | 280 |
267 DISALLOW_COPY_AND_ASSIGN(PresentationDispatcher); | 281 DISALLOW_COPY_AND_ASSIGN(PresentationDispatcher); |
268 }; | 282 }; |
269 | 283 |
270 } // namespace content | 284 } // namespace content |
271 | 285 |
272 #endif // CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ | 286 #endif // CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ |
OLD | NEW |