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 #include "content/renderer/presentation/presentation_dispatcher.h" | 5 #include "content/renderer/presentation/presentation_dispatcher.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
14 #include "base/threading/thread_task_runner_handle.h" | 14 #include "base/threading/thread_task_runner_handle.h" |
15 #include "content/public/common/presentation_constants.h" | 15 #include "content/public/common/presentation_constants.h" |
16 #include "content/public/renderer/render_frame.h" | 16 #include "content/public/renderer/render_frame.h" |
| 17 #include "content/renderer/presentation/presentation_connection_proxy.h" |
17 #include "mojo/public/cpp/bindings/type_converter.h" | 18 #include "mojo/public/cpp/bindings/type_converter.h" |
18 #include "services/service_manager/public/cpp/interface_provider.h" | 19 #include "services/service_manager/public/cpp/interface_provider.h" |
19 #include "third_party/WebKit/public/platform/WebString.h" | 20 #include "third_party/WebKit/public/platform/WebString.h" |
20 #include "third_party/WebKit/public/platform/WebURL.h" | 21 #include "third_party/WebKit/public/platform/WebURL.h" |
21 #include "third_party/WebKit/public/platform/WebVector.h" | 22 #include "third_party/WebKit/public/platform/WebVector.h" |
22 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nAvailabilityObserver.h" | 23 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nAvailabilityObserver.h" |
| 24 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nConnection.h" |
| 25 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nConnectionCallbacks.h" |
23 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nController.h" | 26 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nController.h" |
24 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nError.h" | 27 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nError.h" |
25 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nReceiver.h" | 28 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nReceiver.h" |
26 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nSessionInfo.h" | 29 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nSessionInfo.h" |
27 #include "third_party/WebKit/public/platform/modules/presentation/presentation.m
ojom.h" | 30 #include "third_party/WebKit/public/platform/modules/presentation/presentation.m
ojom.h" |
28 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 31 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
29 #include "url/gurl.h" | 32 #include "url/gurl.h" |
30 | 33 |
31 namespace mojo { | 34 namespace mojo { |
32 | 35 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 } | 96 } |
94 } | 97 } |
95 | 98 |
96 } // namespace | 99 } // namespace |
97 | 100 |
98 namespace content { | 101 namespace content { |
99 | 102 |
100 PresentationDispatcher::PresentationDispatcher(RenderFrame* render_frame) | 103 PresentationDispatcher::PresentationDispatcher(RenderFrame* render_frame) |
101 : RenderFrameObserver(render_frame), | 104 : RenderFrameObserver(render_frame), |
102 controller_(nullptr), | 105 controller_(nullptr), |
103 binding_(this) { | 106 receiver_(nullptr), |
104 } | 107 binding_(this) {} |
105 | 108 |
106 PresentationDispatcher::~PresentationDispatcher() { | 109 PresentationDispatcher::~PresentationDispatcher() { |
107 // Controller should be destroyed before the dispatcher when frame is | 110 // Controller should be destroyed before the dispatcher when frame is |
108 // destroyed. | 111 // destroyed. |
109 DCHECK(!controller_); | 112 DCHECK(!controller_); |
110 } | 113 } |
111 | 114 |
112 void PresentationDispatcher::setController( | 115 void PresentationDispatcher::setController( |
113 blink::WebPresentationController* controller) { | 116 blink::WebPresentationController* controller) { |
114 // There shouldn't be any swapping from one non-null controller to another. | 117 // There shouldn't be any swapping from one non-null controller to another. |
115 DCHECK(controller != controller_ && (!controller || !controller_)); | 118 DCHECK(controller != controller_ && (!controller || !controller_)); |
116 controller_ = controller; | 119 controller_ = controller; |
117 // The controller is set to null when the frame is about to be detached. | 120 // The controller is set to null when the frame is about to be detached. |
118 // Nothing is listening for screen availability anymore but the Mojo service | 121 // Nothing is listening for screen availability anymore but the Mojo service |
119 // will know about the frame being detached anyway. | 122 // will know about the frame being detached anyway. |
120 } | 123 } |
121 | 124 |
122 void PresentationDispatcher::startSession( | 125 void PresentationDispatcher::startSession( |
123 const blink::WebVector<blink::WebURL>& presentationUrls, | 126 const blink::WebVector<blink::WebURL>& presentationUrls, |
124 std::unique_ptr<blink::WebPresentationConnectionCallback> callback) { | 127 std::unique_ptr<blink::WebPresentationConnectionCallbacks> callback) { |
125 DCHECK(callback); | 128 DCHECK(callback); |
126 ConnectToPresentationServiceIfNeeded(); | 129 ConnectToPresentationServiceIfNeeded(); |
127 | 130 |
128 std::vector<GURL> urls; | 131 std::vector<GURL> urls; |
129 for (const auto& url : presentationUrls) | 132 for (const auto& url : presentationUrls) |
130 urls.push_back(url); | 133 urls.push_back(url); |
131 | 134 |
132 // The dispatcher owns the service so |this| will be valid when | 135 // The dispatcher owns the service so |this| will be valid when |
133 // OnSessionCreated() is called. |callback| needs to be alive and also needs | 136 // OnSessionCreated() is called. |callback| needs to be alive and also needs |
134 // to be destroyed so we transfer its ownership to the mojo callback. | 137 // to be destroyed so we transfer its ownership to the mojo callback. |
135 presentation_service_->StartSession( | 138 presentation_service_->StartSession( |
136 urls, base::Bind(&PresentationDispatcher::OnSessionCreated, | 139 urls, base::Bind(&PresentationDispatcher::OnSessionCreated, |
137 base::Unretained(this), base::Passed(&callback))); | 140 base::Unretained(this), base::Passed(&callback))); |
138 } | 141 } |
139 | 142 |
140 void PresentationDispatcher::joinSession( | 143 void PresentationDispatcher::joinSession( |
141 const blink::WebVector<blink::WebURL>& presentationUrls, | 144 const blink::WebVector<blink::WebURL>& presentationUrls, |
142 const blink::WebString& presentationId, | 145 const blink::WebString& presentationId, |
143 std::unique_ptr<blink::WebPresentationConnectionCallback> callback) { | 146 std::unique_ptr<blink::WebPresentationConnectionCallbacks> callback) { |
144 DCHECK(callback); | 147 DCHECK(callback); |
145 ConnectToPresentationServiceIfNeeded(); | 148 ConnectToPresentationServiceIfNeeded(); |
146 | 149 |
147 std::vector<GURL> urls; | 150 std::vector<GURL> urls; |
148 for (const auto& url : presentationUrls) | 151 for (const auto& url : presentationUrls) |
149 urls.push_back(url); | 152 urls.push_back(url); |
150 | 153 |
151 // The dispatcher owns the service so |this| will be valid when | 154 // The dispatcher owns the service so |this| will be valid when |
152 // OnSessionCreated() is called. |callback| needs to be alive and also needs | 155 // OnSessionCreated() is called. |callback| needs to be alive and also needs |
153 // to be destroyed so we transfer its ownership to the mojo callback. | 156 // to be destroyed so we transfer its ownership to the mojo callback. |
154 presentation_service_->JoinSession( | 157 presentation_service_->JoinSession( |
155 urls, presentationId.utf8(), | 158 urls, presentationId.utf8(), |
156 base::Bind(&PresentationDispatcher::OnSessionCreated, | 159 base::Bind(&PresentationDispatcher::OnSessionCreated, |
157 base::Unretained(this), base::Passed(&callback))); | 160 base::Unretained(this), base::Passed(&callback))); |
158 } | 161 } |
159 | 162 |
160 void PresentationDispatcher::sendString(const blink::WebURL& presentationUrl, | 163 void PresentationDispatcher::sendString( |
161 const blink::WebString& presentationId, | 164 const blink::WebURL& presentationUrl, |
162 const blink::WebString& message) { | 165 const blink::WebString& presentationId, |
| 166 const blink::WebString& message, |
| 167 const blink::WebPresentationConnectionProxy* connection_proxy) { |
163 if (message.utf8().size() > kMaxPresentationConnectionMessageSize) { | 168 if (message.utf8().size() > kMaxPresentationConnectionMessageSize) { |
164 // TODO(crbug.com/459008): Limit the size of individual messages to 64k | 169 // TODO(crbug.com/459008): Limit the size of individual messages to 64k |
165 // for now. Consider throwing DOMException or splitting bigger messages | 170 // for now. Consider throwing DOMException or splitting bigger messages |
166 // into smaller chunks later. | 171 // into smaller chunks later. |
167 LOG(WARNING) << "message size exceeded limit!"; | 172 LOG(WARNING) << "message size exceeded limit!"; |
168 return; | 173 return; |
169 } | 174 } |
170 | 175 |
171 message_request_queue_.push(base::WrapUnique( | 176 message_request_queue_.push(base::WrapUnique(CreateSendTextMessageRequest( |
172 CreateSendTextMessageRequest(presentationUrl, presentationId, message))); | 177 presentationUrl, presentationId, message, connection_proxy))); |
173 // Start processing request if only one in the queue. | 178 // Start processing request if only one in the queue. |
174 if (message_request_queue_.size() == 1) | 179 if (message_request_queue_.size() == 1) |
175 DoSendMessage(message_request_queue_.front().get()); | 180 DoSendMessage(message_request_queue_.front().get()); |
176 } | 181 } |
177 | 182 |
178 void PresentationDispatcher::sendArrayBuffer( | 183 void PresentationDispatcher::sendArrayBuffer( |
179 const blink::WebURL& presentationUrl, | 184 const blink::WebURL& presentationUrl, |
180 const blink::WebString& presentationId, | 185 const blink::WebString& presentationId, |
181 const uint8_t* data, | 186 const uint8_t* data, |
182 size_t length) { | 187 size_t length, |
| 188 const blink::WebPresentationConnectionProxy* connection_proxy) { |
183 DCHECK(data); | 189 DCHECK(data); |
184 if (length > kMaxPresentationConnectionMessageSize) { | 190 if (length > kMaxPresentationConnectionMessageSize) { |
185 // TODO(crbug.com/459008): Same as in sendString(). | 191 // TODO(crbug.com/459008): Same as in sendString(). |
186 LOG(WARNING) << "data size exceeded limit!"; | 192 LOG(WARNING) << "data size exceeded limit!"; |
187 return; | 193 return; |
188 } | 194 } |
189 | 195 |
190 message_request_queue_.push(base::WrapUnique(CreateSendBinaryMessageRequest( | 196 message_request_queue_.push(base::WrapUnique(CreateSendBinaryMessageRequest( |
191 presentationUrl, presentationId, | 197 presentationUrl, presentationId, |
192 blink::mojom::PresentationMessageType::BINARY, data, length))); | 198 blink::mojom::PresentationMessageType::BINARY, data, length, |
| 199 connection_proxy))); |
193 // Start processing request if only one in the queue. | 200 // Start processing request if only one in the queue. |
194 if (message_request_queue_.size() == 1) | 201 if (message_request_queue_.size() == 1) |
195 DoSendMessage(message_request_queue_.front().get()); | 202 DoSendMessage(message_request_queue_.front().get()); |
196 } | 203 } |
197 | 204 |
198 void PresentationDispatcher::sendBlobData( | 205 void PresentationDispatcher::sendBlobData( |
199 const blink::WebURL& presentationUrl, | 206 const blink::WebURL& presentationUrl, |
200 const blink::WebString& presentationId, | 207 const blink::WebString& presentationId, |
201 const uint8_t* data, | 208 const uint8_t* data, |
202 size_t length) { | 209 size_t length, |
| 210 const blink::WebPresentationConnectionProxy* connection_proxy) { |
203 DCHECK(data); | 211 DCHECK(data); |
204 if (length > kMaxPresentationConnectionMessageSize) { | 212 if (length > kMaxPresentationConnectionMessageSize) { |
205 // TODO(crbug.com/459008): Same as in sendString(). | 213 // TODO(crbug.com/459008): Same as in sendString(). |
206 LOG(WARNING) << "data size exceeded limit!"; | 214 LOG(WARNING) << "data size exceeded limit!"; |
207 return; | 215 return; |
208 } | 216 } |
209 | 217 |
210 message_request_queue_.push(base::WrapUnique(CreateSendBinaryMessageRequest( | 218 message_request_queue_.push(base::WrapUnique(CreateSendBinaryMessageRequest( |
211 presentationUrl, presentationId, | 219 presentationUrl, presentationId, |
212 blink::mojom::PresentationMessageType::BINARY, data, length))); | 220 blink::mojom::PresentationMessageType::BINARY, data, length, |
| 221 connection_proxy))); |
213 // Start processing request if only one in the queue. | 222 // Start processing request if only one in the queue. |
214 if (message_request_queue_.size() == 1) | 223 if (message_request_queue_.size() == 1) |
215 DoSendMessage(message_request_queue_.front().get()); | 224 DoSendMessage(message_request_queue_.front().get()); |
216 } | 225 } |
217 | 226 |
218 void PresentationDispatcher::DoSendMessage(SendMessageRequest* request) { | 227 void PresentationDispatcher::DoSendMessage(SendMessageRequest* request) { |
219 ConnectToPresentationServiceIfNeeded(); | 228 ConnectToPresentationServiceIfNeeded(); |
220 | 229 |
221 presentation_service_->SendConnectionMessage( | 230 presentation_service_->SendConnectionMessage( |
222 std::move(request->session_info), std::move(request->message), | 231 std::move(request->session_info), std::move(request->message), |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 UpdateListeningState(status); | 403 UpdateListeningState(status); |
395 } | 404 } |
396 | 405 |
397 void PresentationDispatcher::OnDefaultSessionStarted( | 406 void PresentationDispatcher::OnDefaultSessionStarted( |
398 blink::mojom::PresentationSessionInfoPtr session_info) { | 407 blink::mojom::PresentationSessionInfoPtr session_info) { |
399 if (!controller_) | 408 if (!controller_) |
400 return; | 409 return; |
401 | 410 |
402 if (!session_info.is_null()) { | 411 if (!session_info.is_null()) { |
403 presentation_service_->ListenForConnectionMessages(session_info.Clone()); | 412 presentation_service_->ListenForConnectionMessages(session_info.Clone()); |
404 controller_->didStartDefaultSession( | 413 auto* connection = controller_->didStartDefaultSession( |
405 mojo::ConvertTo<blink::WebPresentationSessionInfo>(session_info)); | 414 mojo::ConvertTo<blink::WebPresentationSessionInfo>(session_info)); |
| 415 auto* controller_connection_proxy = |
| 416 new ControllerConnectionProxy(connection); |
| 417 connection->bindProxy(base::WrapUnique(controller_connection_proxy)); |
406 } | 418 } |
407 } | 419 } |
408 | 420 |
409 void PresentationDispatcher::OnSessionCreated( | 421 void PresentationDispatcher::OnSessionCreated( |
410 std::unique_ptr<blink::WebPresentationConnectionCallback> callback, | 422 std::unique_ptr<blink::WebPresentationConnectionCallbacks> callback, |
411 blink::mojom::PresentationSessionInfoPtr session_info, | 423 blink::mojom::PresentationSessionInfoPtr session_info, |
412 blink::mojom::PresentationErrorPtr error) { | 424 blink::mojom::PresentationErrorPtr error) { |
413 DCHECK(callback); | 425 DCHECK(callback); |
414 if (!error.is_null()) { | 426 if (!error.is_null()) { |
415 DCHECK(session_info.is_null()); | 427 DCHECK(session_info.is_null()); |
416 callback->onError(blink::WebPresentationError( | 428 callback->onError(blink::WebPresentationError( |
417 GetWebPresentationErrorTypeFromMojo(error->error_type), | 429 GetWebPresentationErrorTypeFromMojo(error->error_type), |
418 blink::WebString::fromUTF8(error->message))); | 430 blink::WebString::fromUTF8(error->message))); |
419 return; | 431 return; |
420 } | 432 } |
421 | 433 |
422 DCHECK(!session_info.is_null()); | 434 DCHECK(!session_info.is_null()); |
423 presentation_service_->ListenForConnectionMessages(session_info.Clone()); | 435 presentation_service_->ListenForConnectionMessages(session_info.Clone()); |
424 callback->onSuccess( | 436 callback->onSuccess( |
425 mojo::ConvertTo<blink::WebPresentationSessionInfo>(session_info)); | 437 mojo::ConvertTo<blink::WebPresentationSessionInfo>(session_info)); |
| 438 |
| 439 auto* connection = callback->getConnection(); |
| 440 DCHECK(connection); |
| 441 auto* controller_connection_proxy = new ControllerConnectionProxy(connection); |
| 442 connection->bindProxy(base::WrapUnique(controller_connection_proxy)); |
426 } | 443 } |
427 | 444 |
428 void PresentationDispatcher::OnReceiverConnectionAvailable( | 445 void PresentationDispatcher::OnReceiverConnectionAvailable( |
429 blink::mojom::PresentationSessionInfoPtr session_info, | 446 blink::mojom::PresentationSessionInfoPtr session_info, |
430 blink::mojom::PresentationConnectionPtr, | 447 blink::mojom::PresentationConnectionPtr controller_connection_ptr, |
431 blink::mojom::PresentationConnectionRequest) { | 448 blink::mojom::PresentationConnectionRequest receiver_connection_request) { |
432 if (receiver_) { | 449 DCHECK(receiver_); |
433 receiver_->onReceiverConnectionAvailable( | 450 // Bind receiver_connection_proxy with PresentationConnection in receiver |
434 mojo::ConvertTo<blink::WebPresentationSessionInfo>(session_info)); | 451 // page. |
435 } | 452 auto* connection = receiver_->onReceiverConnectionAvailable( |
| 453 mojo::ConvertTo<blink::WebPresentationSessionInfo>(session_info)); |
| 454 auto* receiver_connection_proxy = new ReceiverConnectionProxy(connection); |
| 455 connection->bindProxy(base::WrapUnique(receiver_connection_proxy)); |
| 456 |
| 457 receiver_connection_proxy->Bind(std::move(receiver_connection_request)); |
| 458 receiver_connection_proxy->BindTargetConnection( |
| 459 std::move(controller_connection_ptr)); |
436 } | 460 } |
437 | 461 |
438 void PresentationDispatcher::OnConnectionStateChanged( | 462 void PresentationDispatcher::OnConnectionStateChanged( |
439 blink::mojom::PresentationSessionInfoPtr session_info, | 463 blink::mojom::PresentationSessionInfoPtr session_info, |
440 blink::mojom::PresentationConnectionState state) { | 464 blink::mojom::PresentationConnectionState state) { |
441 if (!controller_) | 465 if (!controller_) |
442 return; | 466 return; |
443 | 467 |
444 controller_->didChangeSessionState( | 468 controller_->didChangeSessionState( |
445 mojo::ConvertTo<blink::WebPresentationSessionInfo>(session_info), | 469 mojo::ConvertTo<blink::WebPresentationSessionInfo>(session_info), |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 status->listening_state = ListeningState::WAITING; | 538 status->listening_state = ListeningState::WAITING; |
515 presentation_service_->ListenForScreenAvailability(status->url); | 539 presentation_service_->ListenForScreenAvailability(status->url); |
516 } else { | 540 } else { |
517 status->listening_state = ListeningState::INACTIVE; | 541 status->listening_state = ListeningState::INACTIVE; |
518 presentation_service_->StopListeningForScreenAvailability(status->url); | 542 presentation_service_->StopListeningForScreenAvailability(status->url); |
519 } | 543 } |
520 } | 544 } |
521 | 545 |
522 PresentationDispatcher::SendMessageRequest::SendMessageRequest( | 546 PresentationDispatcher::SendMessageRequest::SendMessageRequest( |
523 blink::mojom::PresentationSessionInfoPtr session_info, | 547 blink::mojom::PresentationSessionInfoPtr session_info, |
524 blink::mojom::ConnectionMessagePtr message) | 548 blink::mojom::ConnectionMessagePtr message, |
525 : session_info(std::move(session_info)), message(std::move(message)) {} | 549 const blink::WebPresentationConnectionProxy* connection_proxy) |
| 550 : session_info(std::move(session_info)), |
| 551 message(std::move(message)), |
| 552 connection_proxy(connection_proxy) {} |
526 | 553 |
527 PresentationDispatcher::SendMessageRequest::~SendMessageRequest() {} | 554 PresentationDispatcher::SendMessageRequest::~SendMessageRequest() {} |
528 | 555 |
529 // static | 556 // static |
530 PresentationDispatcher::SendMessageRequest* | 557 PresentationDispatcher::SendMessageRequest* |
531 PresentationDispatcher::CreateSendTextMessageRequest( | 558 PresentationDispatcher::CreateSendTextMessageRequest( |
532 const blink::WebURL& presentationUrl, | 559 const blink::WebURL& presentationUrl, |
533 const blink::WebString& presentationId, | 560 const blink::WebString& presentationId, |
534 const blink::WebString& message) { | 561 const blink::WebString& message, |
| 562 const blink::WebPresentationConnectionProxy* connection_proxy) { |
535 blink::mojom::PresentationSessionInfoPtr session_info = | 563 blink::mojom::PresentationSessionInfoPtr session_info = |
536 blink::mojom::PresentationSessionInfo::New(); | 564 blink::mojom::PresentationSessionInfo::New(); |
537 session_info->url = presentationUrl; | 565 session_info->url = presentationUrl; |
538 session_info->id = presentationId.utf8(); | 566 session_info->id = presentationId.utf8(); |
539 | 567 |
540 blink::mojom::ConnectionMessagePtr session_message = | 568 blink::mojom::ConnectionMessagePtr session_message = |
541 blink::mojom::ConnectionMessage::New(); | 569 blink::mojom::ConnectionMessage::New(); |
542 session_message->type = blink::mojom::PresentationMessageType::TEXT; | 570 session_message->type = blink::mojom::PresentationMessageType::TEXT; |
543 session_message->message = message.utf8(); | 571 session_message->message = message.utf8(); |
544 return new SendMessageRequest(std::move(session_info), | 572 return new SendMessageRequest(std::move(session_info), |
545 std::move(session_message)); | 573 std::move(session_message), connection_proxy); |
546 } | 574 } |
547 | 575 |
548 // static | 576 // static |
549 PresentationDispatcher::SendMessageRequest* | 577 PresentationDispatcher::SendMessageRequest* |
550 PresentationDispatcher::CreateSendBinaryMessageRequest( | 578 PresentationDispatcher::CreateSendBinaryMessageRequest( |
551 const blink::WebURL& presentationUrl, | 579 const blink::WebURL& presentationUrl, |
552 const blink::WebString& presentationId, | 580 const blink::WebString& presentationId, |
553 blink::mojom::PresentationMessageType type, | 581 blink::mojom::PresentationMessageType type, |
554 const uint8_t* data, | 582 const uint8_t* data, |
555 size_t length) { | 583 size_t length, |
| 584 const blink::WebPresentationConnectionProxy* connection_proxy) { |
556 blink::mojom::PresentationSessionInfoPtr session_info = | 585 blink::mojom::PresentationSessionInfoPtr session_info = |
557 blink::mojom::PresentationSessionInfo::New(); | 586 blink::mojom::PresentationSessionInfo::New(); |
558 session_info->url = presentationUrl; | 587 session_info->url = presentationUrl; |
559 session_info->id = presentationId.utf8(); | 588 session_info->id = presentationId.utf8(); |
560 | 589 |
561 blink::mojom::ConnectionMessagePtr session_message = | 590 blink::mojom::ConnectionMessagePtr session_message = |
562 blink::mojom::ConnectionMessage::New(); | 591 blink::mojom::ConnectionMessage::New(); |
563 session_message->type = type; | 592 session_message->type = type; |
564 session_message->data = std::vector<uint8_t>(data, data + length); | 593 session_message->data = std::vector<uint8_t>(data, data + length); |
565 return new SendMessageRequest(std::move(session_info), | 594 return new SendMessageRequest(std::move(session_info), |
566 std::move(session_message)); | 595 std::move(session_message), connection_proxy); |
567 } | 596 } |
568 | 597 |
569 PresentationDispatcher::AvailabilityStatus::AvailabilityStatus( | 598 PresentationDispatcher::AvailabilityStatus::AvailabilityStatus( |
570 const GURL& availability_url) | 599 const GURL& availability_url) |
571 : url(availability_url), | 600 : url(availability_url), |
572 last_known_availability(false), | 601 last_known_availability(false), |
573 listening_state(ListeningState::INACTIVE) {} | 602 listening_state(ListeningState::INACTIVE) {} |
574 | 603 |
575 PresentationDispatcher::AvailabilityStatus::~AvailabilityStatus() { | 604 PresentationDispatcher::AvailabilityStatus::~AvailabilityStatus() { |
576 } | 605 } |
577 | 606 |
578 } // namespace content | 607 } // namespace content |
OLD | NEW |