| 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; | |
| 32 class WebPresentationReceiver; | 31 class WebPresentationReceiver; |
| 33 class WebString; | 32 class WebString; |
| 34 class WebURL; | 33 class WebURL; |
| 35 template <typename T> | 34 template <typename T> |
| 36 class WebVector; | 35 class WebVector; |
| 37 } // namespace blink | 36 } // namespace blink |
| 38 | 37 |
| 39 namespace content { | 38 namespace content { |
| 40 | 39 |
| 41 class TestPresentationDispatcher; | 40 class TestPresentationDispatcher; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 56 friend class PresentationConnectionProxy; | 55 friend class PresentationConnectionProxy; |
| 57 friend class TestPresentationDispatcher; | 56 friend class TestPresentationDispatcher; |
| 58 friend class PresentationDispatcherTest; | 57 friend class PresentationDispatcherTest; |
| 59 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestStartSession); | 58 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestStartSession); |
| 60 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestStartSessionError); | 59 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestStartSessionError); |
| 61 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestJoinSession); | 60 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestJoinSession); |
| 62 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestJoinSessionError); | 61 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestJoinSessionError); |
| 63 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestSendString); | 62 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestSendString); |
| 64 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestSendArrayBuffer); | 63 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestSendArrayBuffer); |
| 65 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestSendBlobData); | 64 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestSendBlobData); |
| 66 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, | |
| 67 TestOnReceiverConnectionAvailable); | |
| 68 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestCloseSession); | 65 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestCloseSession); |
| 69 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestTerminateSession); | 66 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestTerminateSession); |
| 70 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, | 67 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, |
| 71 TestListenForScreenAvailability); | 68 TestListenForScreenAvailability); |
| 72 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, | 69 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, |
| 73 TestSetDefaultPresentationUrls); | 70 TestSetDefaultPresentationUrls); |
| 74 | 71 |
| 75 struct SendMessageRequest { | 72 struct SendMessageRequest { |
| 76 SendMessageRequest( | 73 SendMessageRequest( |
| 77 const PresentationSessionInfo& session_info, | 74 const PresentationSessionInfo& session_info, |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 blink::mojom::PresentationConnectionPtr /*connection*/, | 168 blink::mojom::PresentationConnectionPtr /*connection*/, |
| 172 blink::mojom::PresentationConnectionRequest /*connection_request*/) | 169 blink::mojom::PresentationConnectionRequest /*connection_request*/) |
| 173 override; | 170 override; |
| 174 | 171 |
| 175 // Call to PresentationService to send the message in |request|. | 172 // Call to PresentationService to send the message in |request|. |
| 176 // |session_info| and |message| of |reuqest| will be consumed. | 173 // |session_info| and |message| of |reuqest| will be consumed. |
| 177 // |HandleSendMessageRequests| will be invoked after the send is attempted. | 174 // |HandleSendMessageRequests| will be invoked after the send is attempted. |
| 178 void DoSendMessage(SendMessageRequest* request); | 175 void DoSendMessage(SendMessageRequest* request); |
| 179 void HandleSendMessageRequests(bool success); | 176 void HandleSendMessageRequests(bool success); |
| 180 | 177 |
| 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 | |
| 192 virtual void ConnectToPresentationServiceIfNeeded(); | 178 virtual void ConnectToPresentationServiceIfNeeded(); |
| 193 | 179 |
| 194 void UpdateListeningState(); | 180 void UpdateListeningState(); |
| 195 | 181 |
| 196 // Used as a weak reference. Can be null since lifetime is bound to the frame. | 182 // Used as a weak reference. Can be null since lifetime is bound to the frame. |
| 197 blink::WebPresentationController* controller_; | 183 blink::WebPresentationController* controller_; |
| 198 blink::WebPresentationReceiver* receiver_; | 184 blink::WebPresentationReceiver* receiver_; |
| 199 blink::mojom::PresentationServicePtr presentation_service_; | 185 blink::mojom::PresentationServicePtr presentation_service_; |
| 200 mojo::Binding<blink::mojom::PresentationServiceClient> binding_; | 186 mojo::Binding<blink::mojom::PresentationServiceClient> binding_; |
| 201 | 187 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 // Returns UNKNOWN if all urls in |urls| have screen availability | 263 // Returns UNKNOWN if all urls in |urls| have screen availability |
| 278 // UNKNOWN. | 264 // UNKNOWN. |
| 279 ScreenAvailability GetScreenAvailability(const std::vector<GURL>& urls) const; | 265 ScreenAvailability GetScreenAvailability(const std::vector<GURL>& urls) const; |
| 280 | 266 |
| 281 DISALLOW_COPY_AND_ASSIGN(PresentationDispatcher); | 267 DISALLOW_COPY_AND_ASSIGN(PresentationDispatcher); |
| 282 }; | 268 }; |
| 283 | 269 |
| 284 } // namespace content | 270 } // namespace content |
| 285 | 271 |
| 286 #endif // CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ | 272 #endif // CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ |
| OLD | NEW |