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