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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 return blink::WebPresentationConnectionCloseReason::Error; | 95 return blink::WebPresentationConnectionCloseReason::Error; |
93 } | 96 } |
94 } | 97 } |
95 } // namespace | 98 } // namespace |
96 | 99 |
97 namespace content { | 100 namespace content { |
98 | 101 |
99 PresentationDispatcher::PresentationDispatcher(RenderFrame* render_frame) | 102 PresentationDispatcher::PresentationDispatcher(RenderFrame* render_frame) |
100 : RenderFrameObserver(render_frame), | 103 : RenderFrameObserver(render_frame), |
101 controller_(nullptr), | 104 controller_(nullptr), |
102 binding_(this) { | 105 receiver_(nullptr), |
103 } | 106 binding_(this) {} |
104 | 107 |
105 PresentationDispatcher::~PresentationDispatcher() { | 108 PresentationDispatcher::~PresentationDispatcher() { |
106 // Controller should be destroyed before the dispatcher when frame is | 109 // Controller should be destroyed before the dispatcher when frame is |
107 // destroyed. | 110 // destroyed. |
108 DCHECK(!controller_); | 111 DCHECK(!controller_); |
109 } | 112 } |
110 | 113 |
111 void PresentationDispatcher::setController( | 114 void PresentationDispatcher::setController( |
112 blink::WebPresentationController* controller) { | 115 blink::WebPresentationController* controller) { |
113 // There shouldn't be any swapping from one non-null controller to another. | 116 // There shouldn't be any swapping from one non-null controller to another. |
114 DCHECK(controller != controller_ && (!controller || !controller_)); | 117 DCHECK(controller != controller_ && (!controller || !controller_)); |
115 controller_ = controller; | 118 controller_ = controller; |
116 // The controller is set to null when the frame is about to be detached. | 119 // The controller is set to null when the frame is about to be detached. |
117 // Nothing is listening for screen availability anymore but the Mojo service | 120 // Nothing is listening for screen availability anymore but the Mojo service |
118 // will know about the frame being detached anyway. | 121 // will know about the frame being detached anyway. |
119 } | 122 } |
120 | 123 |
121 void PresentationDispatcher::startSession( | 124 void PresentationDispatcher::startSession( |
122 const blink::WebVector<blink::WebURL>& presentationUrls, | 125 const blink::WebVector<blink::WebURL>& presentationUrls, |
123 std::unique_ptr<blink::WebPresentationConnectionCallback> callback) { | 126 std::unique_ptr<blink::WebPresentationConnectionCallbacks> callback) { |
124 DCHECK(callback); | 127 DCHECK(callback); |
125 ConnectToPresentationServiceIfNeeded(); | 128 ConnectToPresentationServiceIfNeeded(); |
126 | 129 |
127 std::vector<GURL> urls; | 130 std::vector<GURL> urls; |
128 for (const auto& url : presentationUrls) | 131 for (const auto& url : presentationUrls) |
129 urls.push_back(url); | 132 urls.push_back(url); |
130 | 133 |
131 // The dispatcher owns the service so |this| will be valid when | 134 // The dispatcher owns the service so |this| will be valid when |
132 // OnSessionCreated() is called. |callback| needs to be alive and also needs | 135 // OnSessionCreated() is called. |callback| needs to be alive and also needs |
133 // to be destroyed so we transfer its ownership to the mojo callback. | 136 // to be destroyed so we transfer its ownership to the mojo callback. |
134 presentation_service_->StartSession( | 137 presentation_service_->StartSession( |
135 urls, base::Bind(&PresentationDispatcher::OnSessionCreated, | 138 urls, base::Bind(&PresentationDispatcher::OnSessionCreated, |
136 base::Unretained(this), base::Passed(&callback))); | 139 base::Unretained(this), base::Passed(&callback))); |
137 } | 140 } |
138 | 141 |
139 void PresentationDispatcher::joinSession( | 142 void PresentationDispatcher::joinSession( |
140 const blink::WebVector<blink::WebURL>& presentationUrls, | 143 const blink::WebVector<blink::WebURL>& presentationUrls, |
141 const blink::WebString& presentationId, | 144 const blink::WebString& presentationId, |
142 std::unique_ptr<blink::WebPresentationConnectionCallback> callback) { | 145 std::unique_ptr<blink::WebPresentationConnectionCallbacks> callback) { |
143 DCHECK(callback); | 146 DCHECK(callback); |
144 ConnectToPresentationServiceIfNeeded(); | 147 ConnectToPresentationServiceIfNeeded(); |
145 | 148 |
146 std::vector<GURL> urls; | 149 std::vector<GURL> urls; |
147 for (const auto& url : presentationUrls) | 150 for (const auto& url : presentationUrls) |
148 urls.push_back(url); | 151 urls.push_back(url); |
149 | 152 |
150 // The dispatcher owns the service so |this| will be valid when | 153 // The dispatcher owns the service so |this| will be valid when |
151 // OnSessionCreated() is called. |callback| needs to be alive and also needs | 154 // OnSessionCreated() is called. |callback| needs to be alive and also needs |
152 // to be destroyed so we transfer its ownership to the mojo callback. | 155 // to be destroyed so we transfer its ownership to the mojo callback. |
153 presentation_service_->JoinSession( | 156 presentation_service_->JoinSession( |
154 urls, presentationId.utf8(), | 157 urls, presentationId.utf8(), |
155 base::Bind(&PresentationDispatcher::OnSessionCreated, | 158 base::Bind(&PresentationDispatcher::OnSessionCreated, |
156 base::Unretained(this), base::Passed(&callback))); | 159 base::Unretained(this), base::Passed(&callback))); |
157 } | 160 } |
158 | 161 |
159 void PresentationDispatcher::sendString(const blink::WebURL& presentationUrl, | 162 void PresentationDispatcher::sendString( |
160 const blink::WebString& presentationId, | 163 const blink::WebURL& presentationUrl, |
161 const blink::WebString& message) { | 164 const blink::WebString& presentationId, |
| 165 const blink::WebString& message, |
| 166 const blink::WebPresentationConnectionProxy* connection_proxy) { |
162 if (message.utf8().size() > kMaxPresentationConnectionMessageSize) { | 167 if (message.utf8().size() > kMaxPresentationConnectionMessageSize) { |
163 // TODO(crbug.com/459008): Limit the size of individual messages to 64k | 168 // TODO(crbug.com/459008): Limit the size of individual messages to 64k |
164 // for now. Consider throwing DOMException or splitting bigger messages | 169 // for now. Consider throwing DOMException or splitting bigger messages |
165 // into smaller chunks later. | 170 // into smaller chunks later. |
166 LOG(WARNING) << "message size exceeded limit!"; | 171 LOG(WARNING) << "message size exceeded limit!"; |
167 return; | 172 return; |
168 } | 173 } |
169 | 174 |
170 message_request_queue_.push(base::WrapUnique( | 175 message_request_queue_.push(base::WrapUnique(CreateSendTextMessageRequest( |
171 CreateSendTextMessageRequest(presentationUrl, presentationId, message))); | 176 presentationUrl, presentationId, message, connection_proxy))); |
172 // Start processing request if only one in the queue. | 177 // Start processing request if only one in the queue. |
173 if (message_request_queue_.size() == 1) | 178 if (message_request_queue_.size() == 1) |
174 DoSendMessage(message_request_queue_.front().get()); | 179 DoSendMessage(message_request_queue_.front().get()); |
175 } | 180 } |
176 | 181 |
177 void PresentationDispatcher::sendArrayBuffer( | 182 void PresentationDispatcher::sendArrayBuffer( |
178 const blink::WebURL& presentationUrl, | 183 const blink::WebURL& presentationUrl, |
179 const blink::WebString& presentationId, | 184 const blink::WebString& presentationId, |
180 const uint8_t* data, | 185 const uint8_t* data, |
181 size_t length) { | 186 size_t length, |
| 187 const blink::WebPresentationConnectionProxy* connection_proxy) { |
182 DCHECK(data); | 188 DCHECK(data); |
183 if (length > kMaxPresentationConnectionMessageSize) { | 189 if (length > kMaxPresentationConnectionMessageSize) { |
184 // TODO(crbug.com/459008): Same as in sendString(). | 190 // TODO(crbug.com/459008): Same as in sendString(). |
185 LOG(WARNING) << "data size exceeded limit!"; | 191 LOG(WARNING) << "data size exceeded limit!"; |
186 return; | 192 return; |
187 } | 193 } |
188 | 194 |
189 message_request_queue_.push(base::WrapUnique(CreateSendBinaryMessageRequest( | 195 message_request_queue_.push(base::WrapUnique(CreateSendBinaryMessageRequest( |
190 presentationUrl, presentationId, | 196 presentationUrl, presentationId, |
191 blink::mojom::PresentationMessageType::BINARY, data, length))); | 197 blink::mojom::PresentationMessageType::BINARY, data, length, |
| 198 connection_proxy))); |
192 // Start processing request if only one in the queue. | 199 // Start processing request if only one in the queue. |
193 if (message_request_queue_.size() == 1) | 200 if (message_request_queue_.size() == 1) |
194 DoSendMessage(message_request_queue_.front().get()); | 201 DoSendMessage(message_request_queue_.front().get()); |
195 } | 202 } |
196 | 203 |
197 void PresentationDispatcher::sendBlobData( | 204 void PresentationDispatcher::sendBlobData( |
198 const blink::WebURL& presentationUrl, | 205 const blink::WebURL& presentationUrl, |
199 const blink::WebString& presentationId, | 206 const blink::WebString& presentationId, |
200 const uint8_t* data, | 207 const uint8_t* data, |
201 size_t length) { | 208 size_t length, |
| 209 const blink::WebPresentationConnectionProxy* connection_proxy) { |
202 DCHECK(data); | 210 DCHECK(data); |
203 if (length > kMaxPresentationConnectionMessageSize) { | 211 if (length > kMaxPresentationConnectionMessageSize) { |
204 // TODO(crbug.com/459008): Same as in sendString(). | 212 // TODO(crbug.com/459008): Same as in sendString(). |
205 LOG(WARNING) << "data size exceeded limit!"; | 213 LOG(WARNING) << "data size exceeded limit!"; |
206 return; | 214 return; |
207 } | 215 } |
208 | 216 |
209 message_request_queue_.push(base::WrapUnique(CreateSendBinaryMessageRequest( | 217 message_request_queue_.push(base::WrapUnique(CreateSendBinaryMessageRequest( |
210 presentationUrl, presentationId, | 218 presentationUrl, presentationId, |
211 blink::mojom::PresentationMessageType::BINARY, data, length))); | 219 blink::mojom::PresentationMessageType::BINARY, data, length, |
| 220 connection_proxy))); |
212 // Start processing request if only one in the queue. | 221 // Start processing request if only one in the queue. |
213 if (message_request_queue_.size() == 1) | 222 if (message_request_queue_.size() == 1) |
214 DoSendMessage(message_request_queue_.front().get()); | 223 DoSendMessage(message_request_queue_.front().get()); |
215 } | 224 } |
216 | 225 |
217 void PresentationDispatcher::DoSendMessage(SendMessageRequest* request) { | 226 void PresentationDispatcher::DoSendMessage(SendMessageRequest* request) { |
218 ConnectToPresentationServiceIfNeeded(); | 227 ConnectToPresentationServiceIfNeeded(); |
219 | 228 |
220 presentation_service_->SendConnectionMessage( | 229 presentation_service_->SendConnectionMessage( |
221 std::move(request->session_info), std::move(request->message), | 230 std::move(request->session_info), std::move(request->message), |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 TryRemoveAvailabilityListener(listener); | 479 TryRemoveAvailabilityListener(listener); |
471 } | 480 } |
472 | 481 |
473 void PresentationDispatcher::OnDefaultSessionStarted( | 482 void PresentationDispatcher::OnDefaultSessionStarted( |
474 blink::mojom::PresentationSessionInfoPtr session_info) { | 483 blink::mojom::PresentationSessionInfoPtr session_info) { |
475 if (!controller_) | 484 if (!controller_) |
476 return; | 485 return; |
477 | 486 |
478 if (!session_info.is_null()) { | 487 if (!session_info.is_null()) { |
479 presentation_service_->ListenForConnectionMessages(session_info.Clone()); | 488 presentation_service_->ListenForConnectionMessages(session_info.Clone()); |
480 controller_->didStartDefaultSession( | 489 auto* connection = controller_->didStartDefaultSession( |
481 mojo::ConvertTo<blink::WebPresentationSessionInfo>(session_info)); | 490 mojo::ConvertTo<blink::WebPresentationSessionInfo>(session_info)); |
| 491 connection->bindProxy( |
| 492 base::MakeUnique<ControllerConnectionProxy>(connection)); |
482 } | 493 } |
483 } | 494 } |
484 | 495 |
485 void PresentationDispatcher::OnSessionCreated( | 496 void PresentationDispatcher::OnSessionCreated( |
486 std::unique_ptr<blink::WebPresentationConnectionCallback> callback, | 497 std::unique_ptr<blink::WebPresentationConnectionCallbacks> callback, |
487 blink::mojom::PresentationSessionInfoPtr session_info, | 498 blink::mojom::PresentationSessionInfoPtr session_info, |
488 blink::mojom::PresentationErrorPtr error) { | 499 blink::mojom::PresentationErrorPtr error) { |
489 DCHECK(callback); | 500 DCHECK(callback); |
490 if (!error.is_null()) { | 501 if (!error.is_null()) { |
491 DCHECK(session_info.is_null()); | 502 DCHECK(session_info.is_null()); |
492 callback->onError(blink::WebPresentationError( | 503 callback->onError(blink::WebPresentationError( |
493 GetWebPresentationErrorTypeFromMojo(error->error_type), | 504 GetWebPresentationErrorTypeFromMojo(error->error_type), |
494 blink::WebString::fromUTF8(error->message))); | 505 blink::WebString::fromUTF8(error->message))); |
495 return; | 506 return; |
496 } | 507 } |
497 | 508 |
498 DCHECK(!session_info.is_null()); | 509 DCHECK(!session_info.is_null()); |
499 presentation_service_->ListenForConnectionMessages(session_info.Clone()); | 510 presentation_service_->ListenForConnectionMessages(session_info.Clone()); |
500 callback->onSuccess( | 511 callback->onSuccess( |
501 mojo::ConvertTo<blink::WebPresentationSessionInfo>(session_info)); | 512 mojo::ConvertTo<blink::WebPresentationSessionInfo>(session_info)); |
| 513 |
| 514 auto* connection = callback->getConnection(); |
| 515 connection->bindProxy( |
| 516 base::MakeUnique<ControllerConnectionProxy>(connection)); |
502 } | 517 } |
503 | 518 |
504 void PresentationDispatcher::OnReceiverConnectionAvailable( | 519 void PresentationDispatcher::OnReceiverConnectionAvailable( |
505 blink::mojom::PresentationSessionInfoPtr session_info, | 520 blink::mojom::PresentationSessionInfoPtr session_info, |
506 blink::mojom::PresentationConnectionPtr, | 521 blink::mojom::PresentationConnectionPtr controller_connection_ptr, |
507 blink::mojom::PresentationConnectionRequest) { | 522 blink::mojom::PresentationConnectionRequest receiver_connection_request) { |
508 if (receiver_) { | 523 DCHECK(receiver_); |
509 receiver_->onReceiverConnectionAvailable( | 524 // Bind receiver_connection_proxy with PresentationConnection in receiver |
510 mojo::ConvertTo<blink::WebPresentationSessionInfo>(session_info)); | 525 // page. |
511 } | 526 auto* connection = receiver_->onReceiverConnectionAvailable( |
| 527 mojo::ConvertTo<blink::WebPresentationSessionInfo>(session_info)); |
| 528 auto* receiver_connection_proxy = new ReceiverConnectionProxy(connection); |
| 529 connection->bindProxy(base::WrapUnique(receiver_connection_proxy)); |
| 530 |
| 531 receiver_connection_proxy->Bind(std::move(receiver_connection_request)); |
| 532 receiver_connection_proxy->BindControllerConnection( |
| 533 std::move(controller_connection_ptr)); |
512 } | 534 } |
513 | 535 |
514 void PresentationDispatcher::OnConnectionStateChanged( | 536 void PresentationDispatcher::OnConnectionStateChanged( |
515 blink::mojom::PresentationSessionInfoPtr session_info, | 537 blink::mojom::PresentationSessionInfoPtr session_info, |
516 blink::mojom::PresentationConnectionState state) { | 538 blink::mojom::PresentationConnectionState state) { |
517 if (!controller_) | 539 if (!controller_) |
518 return; | 540 return; |
519 | 541 |
520 controller_->didChangeSessionState( | 542 controller_->didChangeSessionState( |
521 mojo::ConvertTo<blink::WebPresentationSessionInfo>(session_info), | 543 mojo::ConvertTo<blink::WebPresentationSessionInfo>(session_info), |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 status ? status->last_known_availability : ScreenAvailability::UNKNOWN; | 693 status ? status->last_known_availability : ScreenAvailability::UNKNOWN; |
672 current_availability = | 694 current_availability = |
673 std::max(current_availability, static_cast<int>(screen_availability)); | 695 std::max(current_availability, static_cast<int>(screen_availability)); |
674 } | 696 } |
675 | 697 |
676 return static_cast<ScreenAvailability>(current_availability); | 698 return static_cast<ScreenAvailability>(current_availability); |
677 } | 699 } |
678 | 700 |
679 PresentationDispatcher::SendMessageRequest::SendMessageRequest( | 701 PresentationDispatcher::SendMessageRequest::SendMessageRequest( |
680 blink::mojom::PresentationSessionInfoPtr session_info, | 702 blink::mojom::PresentationSessionInfoPtr session_info, |
681 blink::mojom::ConnectionMessagePtr message) | 703 blink::mojom::ConnectionMessagePtr message, |
682 : session_info(std::move(session_info)), message(std::move(message)) {} | 704 const blink::WebPresentationConnectionProxy* connection_proxy) |
| 705 : session_info(std::move(session_info)), |
| 706 message(std::move(message)), |
| 707 connection_proxy(connection_proxy) {} |
683 | 708 |
684 PresentationDispatcher::SendMessageRequest::~SendMessageRequest() {} | 709 PresentationDispatcher::SendMessageRequest::~SendMessageRequest() {} |
685 | 710 |
686 // static | 711 // static |
687 PresentationDispatcher::SendMessageRequest* | 712 PresentationDispatcher::SendMessageRequest* |
688 PresentationDispatcher::CreateSendTextMessageRequest( | 713 PresentationDispatcher::CreateSendTextMessageRequest( |
689 const blink::WebURL& presentationUrl, | 714 const blink::WebURL& presentationUrl, |
690 const blink::WebString& presentationId, | 715 const blink::WebString& presentationId, |
691 const blink::WebString& message) { | 716 const blink::WebString& message, |
| 717 const blink::WebPresentationConnectionProxy* connection_proxy) { |
692 blink::mojom::PresentationSessionInfoPtr session_info = | 718 blink::mojom::PresentationSessionInfoPtr session_info = |
693 blink::mojom::PresentationSessionInfo::New(); | 719 blink::mojom::PresentationSessionInfo::New(); |
694 session_info->url = presentationUrl; | 720 session_info->url = presentationUrl; |
695 session_info->id = presentationId.utf8(); | 721 session_info->id = presentationId.utf8(); |
696 | 722 |
697 blink::mojom::ConnectionMessagePtr session_message = | 723 blink::mojom::ConnectionMessagePtr session_message = |
698 blink::mojom::ConnectionMessage::New(); | 724 blink::mojom::ConnectionMessage::New(); |
699 session_message->type = blink::mojom::PresentationMessageType::TEXT; | 725 session_message->type = blink::mojom::PresentationMessageType::TEXT; |
700 session_message->message = message.utf8(); | 726 session_message->message = message.utf8(); |
701 return new SendMessageRequest(std::move(session_info), | 727 return new SendMessageRequest(std::move(session_info), |
702 std::move(session_message)); | 728 std::move(session_message), connection_proxy); |
703 } | 729 } |
704 | 730 |
705 // static | 731 // static |
706 PresentationDispatcher::SendMessageRequest* | 732 PresentationDispatcher::SendMessageRequest* |
707 PresentationDispatcher::CreateSendBinaryMessageRequest( | 733 PresentationDispatcher::CreateSendBinaryMessageRequest( |
708 const blink::WebURL& presentationUrl, | 734 const blink::WebURL& presentationUrl, |
709 const blink::WebString& presentationId, | 735 const blink::WebString& presentationId, |
710 blink::mojom::PresentationMessageType type, | 736 blink::mojom::PresentationMessageType type, |
711 const uint8_t* data, | 737 const uint8_t* data, |
712 size_t length) { | 738 size_t length, |
| 739 const blink::WebPresentationConnectionProxy* connection_proxy) { |
713 blink::mojom::PresentationSessionInfoPtr session_info = | 740 blink::mojom::PresentationSessionInfoPtr session_info = |
714 blink::mojom::PresentationSessionInfo::New(); | 741 blink::mojom::PresentationSessionInfo::New(); |
715 session_info->url = presentationUrl; | 742 session_info->url = presentationUrl; |
716 session_info->id = presentationId.utf8(); | 743 session_info->id = presentationId.utf8(); |
717 | 744 |
718 blink::mojom::ConnectionMessagePtr session_message = | 745 blink::mojom::ConnectionMessagePtr session_message = |
719 blink::mojom::ConnectionMessage::New(); | 746 blink::mojom::ConnectionMessage::New(); |
720 session_message->type = type; | 747 session_message->type = type; |
721 session_message->data = std::vector<uint8_t>(data, data + length); | 748 session_message->data = std::vector<uint8_t>(data, data + length); |
722 return new SendMessageRequest(std::move(session_info), | 749 return new SendMessageRequest(std::move(session_info), |
723 std::move(session_message)); | 750 std::move(session_message), connection_proxy); |
724 } | 751 } |
725 | 752 |
726 PresentationDispatcher::AvailabilityListener::AvailabilityListener( | 753 PresentationDispatcher::AvailabilityListener::AvailabilityListener( |
727 const std::vector<GURL>& availability_urls) | 754 const std::vector<GURL>& availability_urls) |
728 : urls(availability_urls) {} | 755 : urls(availability_urls) {} |
729 | 756 |
730 PresentationDispatcher::AvailabilityListener::~AvailabilityListener() {} | 757 PresentationDispatcher::AvailabilityListener::~AvailabilityListener() {} |
731 | 758 |
732 PresentationDispatcher::ListeningStatus::ListeningStatus( | 759 PresentationDispatcher::ListeningStatus::ListeningStatus( |
733 const GURL& availability_url) | 760 const GURL& availability_url) |
734 : url(availability_url), | 761 : url(availability_url), |
735 last_known_availability(ScreenAvailability::UNKNOWN), | 762 last_known_availability(ScreenAvailability::UNKNOWN), |
736 listening_state(ListeningState::INACTIVE) {} | 763 listening_state(ListeningState::INACTIVE) {} |
737 | 764 |
738 PresentationDispatcher::ListeningStatus::~ListeningStatus() {} | 765 PresentationDispatcher::ListeningStatus::~ListeningStatus() {} |
739 | 766 |
740 } // namespace content | 767 } // namespace content |
OLD | NEW |