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/common/presentation_connection_message.h" | |
| 22 #include "content/public/common/presentation_session.h" | 23 #include "content/public/common/presentation_session.h" |
| 23 #include "content/public/renderer/render_frame_observer.h" | 24 #include "content/public/renderer/render_frame_observer.h" |
| 24 #include "mojo/public/cpp/bindings/binding.h" | 25 #include "mojo/public/cpp/bindings/binding.h" |
| 25 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nClient.h" | 26 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nClient.h" |
| 26 #include "third_party/WebKit/public/platform/modules/presentation/presentation.m ojom.h" | 27 #include "third_party/WebKit/public/platform/modules/presentation/presentation.m ojom.h" |
| 27 #include "url/gurl.h" | 28 #include "url/gurl.h" |
| 28 | 29 |
| 29 namespace blink { | 30 namespace blink { |
| 30 class WebPresentationAvailabilityObserver; | 31 class WebPresentationAvailabilityObserver; |
| 31 class WebPresentationConnection; | 32 class WebPresentationConnection; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestCloseSession); | 69 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestCloseSession); |
| 69 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestTerminateSession); | 70 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestTerminateSession); |
| 70 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, | 71 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, |
| 71 TestListenForScreenAvailability); | 72 TestListenForScreenAvailability); |
| 72 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, | 73 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, |
| 73 TestSetDefaultPresentationUrls); | 74 TestSetDefaultPresentationUrls); |
| 74 | 75 |
| 75 struct SendMessageRequest { | 76 struct SendMessageRequest { |
| 76 SendMessageRequest( | 77 SendMessageRequest( |
| 77 const PresentationSessionInfo& session_info, | 78 const PresentationSessionInfo& session_info, |
| 78 blink::mojom::ConnectionMessagePtr message, | 79 PresentationConnectionMessage connection_message, |
|
imcheng
2017/02/25 01:08:40
can this be PresentationConnectionMessage&& ?
dcheng
2017/02/25 07:17:27
Chromium style is to use pass-by-value for move-on
mark a. foltz
2017/02/27 23:25:15
Acknowledged.
| |
| 79 const blink::WebPresentationConnectionProxy* connection_proxy); | 80 const blink::WebPresentationConnectionProxy* connection_proxy); |
| 80 | 81 |
| 81 ~SendMessageRequest(); | 82 ~SendMessageRequest(); |
| 82 | 83 |
| 83 PresentationSessionInfo session_info; | 84 PresentationSessionInfo session_info; |
| 84 blink::mojom::ConnectionMessagePtr message; | 85 PresentationConnectionMessage message; |
| 85 // Proxy of Blink connection object |connection| calling connection.send(). | 86 // Proxy of Blink connection object |connection| calling connection.send(). |
| 86 // It does not take ownership of proxy object. Proxy object is owned by | 87 // It does not take ownership of proxy object. Proxy object is owned by |
| 87 // Blink connection. Blink connection is destroyed after | 88 // Blink connection. Blink connection is destroyed after |
| 88 // PresentationDispatcher so |connection_proxy| should always be valid. | 89 // PresentationDispatcher so |connection_proxy| should always be valid. |
| 89 const blink::WebPresentationConnectionProxy* connection_proxy; | 90 const blink::WebPresentationConnectionProxy* connection_proxy; |
| 90 }; | 91 }; |
| 91 | 92 |
| 92 static SendMessageRequest* CreateSendTextMessageRequest( | 93 static SendMessageRequest* CreateSendTextMessageRequest( |
| 93 const blink::WebURL& presentationUrl, | 94 const blink::WebURL& presentationUrl, |
| 94 const blink::WebString& presentationId, | 95 const blink::WebString& presentationId, |
| 95 const blink::WebString& message, | 96 const blink::WebString& message, |
| 96 const blink::WebPresentationConnectionProxy* connection_proxy); | 97 const blink::WebPresentationConnectionProxy* connection_proxy); |
| 97 static SendMessageRequest* CreateSendBinaryMessageRequest( | 98 static SendMessageRequest* CreateSendBinaryMessageRequest( |
| 98 const blink::WebURL& presentationUrl, | 99 const blink::WebURL& presentationUrl, |
| 99 const blink::WebString& presentationId, | 100 const blink::WebString& presentationId, |
| 100 blink::mojom::PresentationMessageType type, | |
| 101 const uint8_t* data, | 101 const uint8_t* data, |
| 102 size_t length, | 102 size_t length, |
| 103 const blink::WebPresentationConnectionProxy* connection_proxy); | 103 const blink::WebPresentationConnectionProxy* connection_proxy); |
| 104 | 104 |
| 105 // WebPresentationClient implementation. | 105 // WebPresentationClient implementation. |
| 106 void setController(blink::WebPresentationController* controller) override; | 106 void setController(blink::WebPresentationController* controller) override; |
| 107 void setReceiver(blink::WebPresentationReceiver*) override; | 107 void setReceiver(blink::WebPresentationReceiver*) override; |
| 108 void startSession(const blink::WebVector<blink::WebURL>& presentationUrls, | 108 void startSession(const blink::WebVector<blink::WebURL>& presentationUrls, |
| 109 std::unique_ptr<blink::WebPresentationConnectionCallbacks> | 109 std::unique_ptr<blink::WebPresentationConnectionCallbacks> |
| 110 callback) override; | 110 callback) override; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 151 // blink::mojom::PresentationServiceClient | 151 // blink::mojom::PresentationServiceClient |
| 152 void OnScreenAvailabilityNotSupported(const GURL& url) override; | 152 void OnScreenAvailabilityNotSupported(const GURL& url) override; |
| 153 void OnScreenAvailabilityUpdated(const GURL& url, bool available) override; | 153 void OnScreenAvailabilityUpdated(const GURL& url, bool available) override; |
| 154 void OnConnectionStateChanged(const PresentationSessionInfo& session_info, | 154 void OnConnectionStateChanged(const PresentationSessionInfo& session_info, |
| 155 PresentationConnectionState state) override; | 155 PresentationConnectionState state) override; |
| 156 void OnConnectionClosed(const PresentationSessionInfo& session_info, | 156 void OnConnectionClosed(const PresentationSessionInfo& session_info, |
| 157 PresentationConnectionCloseReason reason, | 157 PresentationConnectionCloseReason reason, |
| 158 const std::string& message) override; | 158 const std::string& message) override; |
| 159 void OnConnectionMessagesReceived( | 159 void OnConnectionMessagesReceived( |
| 160 const PresentationSessionInfo& session_info, | 160 const PresentationSessionInfo& session_info, |
| 161 std::vector<blink::mojom::ConnectionMessagePtr> messages) override; | 161 const std::vector<PresentationConnectionMessage>& messages) override; |
| 162 void OnDefaultSessionStarted( | 162 void OnDefaultSessionStarted( |
| 163 const PresentationSessionInfo& session_info) override; | 163 const PresentationSessionInfo& session_info) override; |
| 164 | 164 |
| 165 void OnSessionCreated( | 165 void OnSessionCreated( |
| 166 std::unique_ptr<blink::WebPresentationConnectionCallbacks> callback, | 166 std::unique_ptr<blink::WebPresentationConnectionCallbacks> callback, |
| 167 const base::Optional<PresentationSessionInfo>& session_info, | 167 const base::Optional<PresentationSessionInfo>& session_info, |
| 168 const base::Optional<PresentationError>& error); | 168 const base::Optional<PresentationError>& error); |
| 169 void OnReceiverConnectionAvailable( | 169 void OnReceiverConnectionAvailable( |
| 170 const PresentationSessionInfo& session_info, | 170 const PresentationSessionInfo& session_info, |
| 171 blink::mojom::PresentationConnectionPtr /*connection*/, | 171 blink::mojom::PresentationConnectionPtr /*connection*/, |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 277 // Returns UNKNOWN if all urls in |urls| have screen availability | 277 // Returns UNKNOWN if all urls in |urls| have screen availability |
| 278 // UNKNOWN. | 278 // UNKNOWN. |
| 279 ScreenAvailability GetScreenAvailability(const std::vector<GURL>& urls) const; | 279 ScreenAvailability GetScreenAvailability(const std::vector<GURL>& urls) const; |
| 280 | 280 |
| 281 DISALLOW_COPY_AND_ASSIGN(PresentationDispatcher); | 281 DISALLOW_COPY_AND_ASSIGN(PresentationDispatcher); |
| 282 }; | 282 }; |
| 283 | 283 |
| 284 } // namespace content | 284 } // namespace content |
| 285 | 285 |
| 286 #endif // CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ | 286 #endif // CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ |
| OLD | NEW |