Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Side by Side Diff: content/renderer/presentation/presentation_dispatcher.cc

Issue 2622993002: [Presentation API] Move presentation.mojom to content/common/presentation (Closed)
Patch Set: Fix #include and OWNERS Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "mojo/public/cpp/bindings/type_converter.h" 17 #include "mojo/public/cpp/bindings/type_converter.h"
18 #include "services/service_manager/public/cpp/interface_provider.h" 18 #include "services/service_manager/public/cpp/interface_provider.h"
19 #include "third_party/WebKit/public/platform/WebString.h" 19 #include "third_party/WebKit/public/platform/WebString.h"
20 #include "third_party/WebKit/public/platform/WebURL.h" 20 #include "third_party/WebKit/public/platform/WebURL.h"
21 #include "third_party/WebKit/public/platform/WebVector.h" 21 #include "third_party/WebKit/public/platform/WebVector.h"
22 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nAvailabilityObserver.h" 22 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nAvailabilityObserver.h"
23 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nController.h" 23 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nController.h"
24 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nError.h" 24 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nError.h"
25 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nReceiver.h" 25 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nReceiver.h"
26 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nSessionInfo.h" 26 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nSessionInfo.h"
27 #include "third_party/WebKit/public/platform/modules/presentation/presentation.m ojom.h"
28 #include "third_party/WebKit/public/web/WebLocalFrame.h" 27 #include "third_party/WebKit/public/web/WebLocalFrame.h"
29 #include "url/gurl.h" 28 #include "url/gurl.h"
30 29
31 namespace mojo { 30 namespace mojo {
32 31
33 // Temporary type converter since Presentation API has not been Onion Soup-ed. 32 // Temporary type converter since Presentation API has not been Onion Soup-ed.
34 template <> 33 template <>
35 struct TypeConverter<blink::WebPresentationSessionInfo, 34 struct TypeConverter<blink::WebPresentationSessionInfo,
36 blink::mojom::PresentationSessionInfoPtr> { 35 content::mojom::PresentationSessionInfoPtr> {
37 static blink::WebPresentationSessionInfo Convert( 36 static blink::WebPresentationSessionInfo Convert(
38 const blink::mojom::PresentationSessionInfoPtr& input) { 37 const content::mojom::PresentationSessionInfoPtr& input) {
39 return blink::WebPresentationSessionInfo( 38 return blink::WebPresentationSessionInfo(
40 blink::WebURL(input->url), blink::WebString::fromUTF8(input->id)); 39 blink::WebURL(input->url), blink::WebString::fromUTF8(input->id));
41 } 40 }
42 }; 41 };
43 42
44 } // namespace mojo 43 } // namespace mojo
45 44
46 namespace { 45 namespace {
47 46
48 blink::WebPresentationError::ErrorType GetWebPresentationErrorTypeFromMojo( 47 blink::WebPresentationError::ErrorType GetWebPresentationErrorTypeFromMojo(
49 blink::mojom::PresentationErrorType mojoErrorType) { 48 content::mojom::PresentationErrorType mojoErrorType) {
50 switch (mojoErrorType) { 49 switch (mojoErrorType) {
51 case blink::mojom::PresentationErrorType::NO_AVAILABLE_SCREENS: 50 case content::mojom::PresentationErrorType::NO_AVAILABLE_SCREENS:
52 return blink::WebPresentationError::ErrorTypeNoAvailableScreens; 51 return blink::WebPresentationError::ErrorTypeNoAvailableScreens;
53 case blink::mojom::PresentationErrorType::SESSION_REQUEST_CANCELLED: 52 case content::mojom::PresentationErrorType::SESSION_REQUEST_CANCELLED:
54 return blink::WebPresentationError::ErrorTypeSessionRequestCancelled; 53 return blink::WebPresentationError::ErrorTypeSessionRequestCancelled;
55 case blink::mojom::PresentationErrorType::NO_PRESENTATION_FOUND: 54 case content::mojom::PresentationErrorType::NO_PRESENTATION_FOUND:
56 return blink::WebPresentationError::ErrorTypeNoPresentationFound; 55 return blink::WebPresentationError::ErrorTypeNoPresentationFound;
57 case blink::mojom::PresentationErrorType::UNKNOWN: 56 case content::mojom::PresentationErrorType::UNKNOWN:
58 default: 57 default:
59 return blink::WebPresentationError::ErrorTypeUnknown; 58 return blink::WebPresentationError::ErrorTypeUnknown;
60 } 59 }
61 } 60 }
62 61
63 blink::WebPresentationConnectionState GetWebPresentationConnectionStateFromMojo( 62 blink::WebPresentationConnectionState GetWebPresentationConnectionStateFromMojo(
64 blink::mojom::PresentationConnectionState mojoSessionState) { 63 content::mojom::PresentationConnectionState mojoSessionState) {
65 switch (mojoSessionState) { 64 switch (mojoSessionState) {
66 case blink::mojom::PresentationConnectionState::CONNECTING: 65 case content::mojom::PresentationConnectionState::CONNECTING:
67 return blink::WebPresentationConnectionState::Connecting; 66 return blink::WebPresentationConnectionState::Connecting;
68 case blink::mojom::PresentationConnectionState::CONNECTED: 67 case content::mojom::PresentationConnectionState::CONNECTED:
69 return blink::WebPresentationConnectionState::Connected; 68 return blink::WebPresentationConnectionState::Connected;
70 case blink::mojom::PresentationConnectionState::CLOSED: 69 case content::mojom::PresentationConnectionState::CLOSED:
71 return blink::WebPresentationConnectionState::Closed; 70 return blink::WebPresentationConnectionState::Closed;
72 case blink::mojom::PresentationConnectionState::TERMINATED: 71 case content::mojom::PresentationConnectionState::TERMINATED:
73 return blink::WebPresentationConnectionState::Terminated; 72 return blink::WebPresentationConnectionState::Terminated;
74 default: 73 default:
75 NOTREACHED(); 74 NOTREACHED();
76 return blink::WebPresentationConnectionState::Terminated; 75 return blink::WebPresentationConnectionState::Terminated;
77 } 76 }
78 } 77 }
79 78
80 blink::WebPresentationConnectionCloseReason 79 blink::WebPresentationConnectionCloseReason
81 GetWebPresentationConnectionCloseReasonFromMojo( 80 GetWebPresentationConnectionCloseReasonFromMojo(
82 blink::mojom::PresentationConnectionCloseReason mojoConnectionCloseReason) { 81 content::mojom::PresentationConnectionCloseReason
82 mojoConnectionCloseReason) {
83 switch (mojoConnectionCloseReason) { 83 switch (mojoConnectionCloseReason) {
84 case blink::mojom::PresentationConnectionCloseReason::CONNECTION_ERROR: 84 case content::mojom::PresentationConnectionCloseReason::CONNECTION_ERROR:
85 return blink::WebPresentationConnectionCloseReason::Error; 85 return blink::WebPresentationConnectionCloseReason::Error;
86 case blink::mojom::PresentationConnectionCloseReason::CLOSED: 86 case content::mojom::PresentationConnectionCloseReason::CLOSED:
87 return blink::WebPresentationConnectionCloseReason::Closed; 87 return blink::WebPresentationConnectionCloseReason::Closed;
88 case blink::mojom::PresentationConnectionCloseReason::WENT_AWAY: 88 case content::mojom::PresentationConnectionCloseReason::WENT_AWAY:
89 return blink::WebPresentationConnectionCloseReason::WentAway; 89 return blink::WebPresentationConnectionCloseReason::WentAway;
90 default: 90 default:
91 NOTREACHED(); 91 NOTREACHED();
92 return blink::WebPresentationConnectionCloseReason::Error; 92 return blink::WebPresentationConnectionCloseReason::Error;
93 } 93 }
94 } 94 }
95 95
96 } // namespace 96 } // namespace
97 97
98 namespace content { 98 namespace content {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 size_t length) { 182 size_t length) {
183 DCHECK(data); 183 DCHECK(data);
184 if (length > kMaxPresentationConnectionMessageSize) { 184 if (length > kMaxPresentationConnectionMessageSize) {
185 // TODO(crbug.com/459008): Same as in sendString(). 185 // TODO(crbug.com/459008): Same as in sendString().
186 LOG(WARNING) << "data size exceeded limit!"; 186 LOG(WARNING) << "data size exceeded limit!";
187 return; 187 return;
188 } 188 }
189 189
190 message_request_queue_.push(base::WrapUnique(CreateSendBinaryMessageRequest( 190 message_request_queue_.push(base::WrapUnique(CreateSendBinaryMessageRequest(
191 presentationUrl, presentationId, 191 presentationUrl, presentationId,
192 blink::mojom::PresentationMessageType::BINARY, data, length))); 192 content::mojom::PresentationMessageType::BINARY, data, length)));
193 // Start processing request if only one in the queue. 193 // Start processing request if only one in the queue.
194 if (message_request_queue_.size() == 1) 194 if (message_request_queue_.size() == 1)
195 DoSendMessage(message_request_queue_.front().get()); 195 DoSendMessage(message_request_queue_.front().get());
196 } 196 }
197 197
198 void PresentationDispatcher::sendBlobData( 198 void PresentationDispatcher::sendBlobData(
199 const blink::WebURL& presentationUrl, 199 const blink::WebURL& presentationUrl,
200 const blink::WebString& presentationId, 200 const blink::WebString& presentationId,
201 const uint8_t* data, 201 const uint8_t* data,
202 size_t length) { 202 size_t length) {
203 DCHECK(data); 203 DCHECK(data);
204 if (length > kMaxPresentationConnectionMessageSize) { 204 if (length > kMaxPresentationConnectionMessageSize) {
205 // TODO(crbug.com/459008): Same as in sendString(). 205 // TODO(crbug.com/459008): Same as in sendString().
206 LOG(WARNING) << "data size exceeded limit!"; 206 LOG(WARNING) << "data size exceeded limit!";
207 return; 207 return;
208 } 208 }
209 209
210 message_request_queue_.push(base::WrapUnique(CreateSendBinaryMessageRequest( 210 message_request_queue_.push(base::WrapUnique(CreateSendBinaryMessageRequest(
211 presentationUrl, presentationId, 211 presentationUrl, presentationId,
212 blink::mojom::PresentationMessageType::BINARY, data, length))); 212 content::mojom::PresentationMessageType::BINARY, data, length)));
213 // Start processing request if only one in the queue. 213 // Start processing request if only one in the queue.
214 if (message_request_queue_.size() == 1) 214 if (message_request_queue_.size() == 1)
215 DoSendMessage(message_request_queue_.front().get()); 215 DoSendMessage(message_request_queue_.front().get());
216 } 216 }
217 217
218 void PresentationDispatcher::DoSendMessage(SendMessageRequest* request) { 218 void PresentationDispatcher::DoSendMessage(SendMessageRequest* request) {
219 ConnectToPresentationServiceIfNeeded(); 219 ConnectToPresentationServiceIfNeeded();
220 220
221 presentation_service_->SendConnectionMessage( 221 presentation_service_->SendConnectionMessage(
222 std::move(request->session_info), std::move(request->message), 222 std::move(request->session_info), std::move(request->message),
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 !iter.IsAtEnd(); iter.Advance()) { 382 !iter.IsAtEnd(); iter.Advance()) {
383 iter.GetCurrentValue()->onError(blink::WebPresentationError( 383 iter.GetCurrentValue()->onError(blink::WebPresentationError(
384 blink::WebPresentationError::ErrorTypeAvailabilityNotSupported, 384 blink::WebPresentationError::ErrorTypeAvailabilityNotSupported,
385 not_supported_error)); 385 not_supported_error));
386 } 386 }
387 status->availability_callbacks.Clear(); 387 status->availability_callbacks.Clear();
388 UpdateListeningState(status); 388 UpdateListeningState(status);
389 } 389 }
390 390
391 void PresentationDispatcher::OnDefaultSessionStarted( 391 void PresentationDispatcher::OnDefaultSessionStarted(
392 blink::mojom::PresentationSessionInfoPtr session_info) { 392 content::mojom::PresentationSessionInfoPtr session_info) {
393 if (!controller_) 393 if (!controller_)
394 return; 394 return;
395 395
396 if (!session_info.is_null()) { 396 if (!session_info.is_null()) {
397 presentation_service_->ListenForConnectionMessages(session_info.Clone()); 397 presentation_service_->ListenForConnectionMessages(session_info.Clone());
398 controller_->didStartDefaultSession( 398 controller_->didStartDefaultSession(
399 mojo::ConvertTo<blink::WebPresentationSessionInfo>(session_info)); 399 mojo::ConvertTo<blink::WebPresentationSessionInfo>(session_info));
400 } 400 }
401 } 401 }
402 402
403 void PresentationDispatcher::OnSessionCreated( 403 void PresentationDispatcher::OnSessionCreated(
404 std::unique_ptr<blink::WebPresentationConnectionCallback> callback, 404 std::unique_ptr<blink::WebPresentationConnectionCallback> callback,
405 blink::mojom::PresentationSessionInfoPtr session_info, 405 content::mojom::PresentationSessionInfoPtr session_info,
406 blink::mojom::PresentationErrorPtr error) { 406 content::mojom::PresentationErrorPtr error) {
407 DCHECK(callback); 407 DCHECK(callback);
408 if (!error.is_null()) { 408 if (!error.is_null()) {
409 DCHECK(session_info.is_null()); 409 DCHECK(session_info.is_null());
410 callback->onError(blink::WebPresentationError( 410 callback->onError(blink::WebPresentationError(
411 GetWebPresentationErrorTypeFromMojo(error->error_type), 411 GetWebPresentationErrorTypeFromMojo(error->error_type),
412 blink::WebString::fromUTF8(error->message))); 412 blink::WebString::fromUTF8(error->message)));
413 return; 413 return;
414 } 414 }
415 415
416 DCHECK(!session_info.is_null()); 416 DCHECK(!session_info.is_null());
417 presentation_service_->ListenForConnectionMessages(session_info.Clone()); 417 presentation_service_->ListenForConnectionMessages(session_info.Clone());
418 callback->onSuccess( 418 callback->onSuccess(
419 mojo::ConvertTo<blink::WebPresentationSessionInfo>(session_info)); 419 mojo::ConvertTo<blink::WebPresentationSessionInfo>(session_info));
420 } 420 }
421 421
422 void PresentationDispatcher::OnReceiverConnectionAvailable( 422 void PresentationDispatcher::OnReceiverConnectionAvailable(
423 blink::mojom::PresentationSessionInfoPtr session_info) { 423 content::mojom::PresentationSessionInfoPtr session_info) {
424 if (receiver_) { 424 if (receiver_) {
425 receiver_->onReceiverConnectionAvailable( 425 receiver_->onReceiverConnectionAvailable(
426 mojo::ConvertTo<blink::WebPresentationSessionInfo>(session_info)); 426 mojo::ConvertTo<blink::WebPresentationSessionInfo>(session_info));
427 } 427 }
428 } 428 }
429 429
430 void PresentationDispatcher::OnConnectionStateChanged( 430 void PresentationDispatcher::OnConnectionStateChanged(
431 blink::mojom::PresentationSessionInfoPtr session_info, 431 content::mojom::PresentationSessionInfoPtr session_info,
432 blink::mojom::PresentationConnectionState state) { 432 content::mojom::PresentationConnectionState state) {
433 if (!controller_) 433 if (!controller_)
434 return; 434 return;
435 435
436 controller_->didChangeSessionState( 436 controller_->didChangeSessionState(
437 mojo::ConvertTo<blink::WebPresentationSessionInfo>(session_info), 437 mojo::ConvertTo<blink::WebPresentationSessionInfo>(session_info),
438 GetWebPresentationConnectionStateFromMojo(state)); 438 GetWebPresentationConnectionStateFromMojo(state));
439 } 439 }
440 440
441 void PresentationDispatcher::OnConnectionClosed( 441 void PresentationDispatcher::OnConnectionClosed(
442 blink::mojom::PresentationSessionInfoPtr session_info, 442 content::mojom::PresentationSessionInfoPtr session_info,
443 blink::mojom::PresentationConnectionCloseReason reason, 443 content::mojom::PresentationConnectionCloseReason reason,
444 const std::string& message) { 444 const std::string& message) {
445 if (!controller_) 445 if (!controller_)
446 return; 446 return;
447 447
448 controller_->didCloseConnection( 448 controller_->didCloseConnection(
449 mojo::ConvertTo<blink::WebPresentationSessionInfo>(session_info), 449 mojo::ConvertTo<blink::WebPresentationSessionInfo>(session_info),
450 GetWebPresentationConnectionCloseReasonFromMojo(reason), 450 GetWebPresentationConnectionCloseReasonFromMojo(reason),
451 blink::WebString::fromUTF8(message)); 451 blink::WebString::fromUTF8(message));
452 } 452 }
453 453
454 void PresentationDispatcher::OnConnectionMessagesReceived( 454 void PresentationDispatcher::OnConnectionMessagesReceived(
455 blink::mojom::PresentationSessionInfoPtr session_info, 455 content::mojom::PresentationSessionInfoPtr session_info,
456 std::vector<blink::mojom::ConnectionMessagePtr> messages) { 456 std::vector<content::mojom::ConnectionMessagePtr> messages) {
457 if (!controller_) 457 if (!controller_)
458 return; 458 return;
459 459
460 for (size_t i = 0; i < messages.size(); ++i) { 460 for (size_t i = 0; i < messages.size(); ++i) {
461 // Note: Passing batches of messages to the Blink layer would be more 461 // Note: Passing batches of messages to the Blink layer would be more
462 // efficient. 462 // efficient.
463 auto web_session_info = 463 auto web_session_info =
464 mojo::ConvertTo<blink::WebPresentationSessionInfo>(session_info); 464 mojo::ConvertTo<blink::WebPresentationSessionInfo>(session_info);
465 switch (messages[i]->type) { 465 switch (messages[i]->type) {
466 case blink::mojom::PresentationMessageType::TEXT: { 466 case content::mojom::PresentationMessageType::TEXT: {
467 // TODO(mfoltz): Do we need to DCHECK(messages[i]->message)? 467 // TODO(mfoltz): Do we need to DCHECK(messages[i]->message)?
468 controller_->didReceiveSessionTextMessage( 468 controller_->didReceiveSessionTextMessage(
469 web_session_info, 469 web_session_info,
470 blink::WebString::fromUTF8(messages[i]->message.value())); 470 blink::WebString::fromUTF8(messages[i]->message.value()));
471 break; 471 break;
472 } 472 }
473 case blink::mojom::PresentationMessageType::BINARY: { 473 case content::mojom::PresentationMessageType::BINARY: {
474 // TODO(mfoltz): Do we need to DCHECK(messages[i]->data)? 474 // TODO(mfoltz): Do we need to DCHECK(messages[i]->data)?
475 controller_->didReceiveSessionBinaryMessage( 475 controller_->didReceiveSessionBinaryMessage(
476 web_session_info, &(messages[i]->data->front()), 476 web_session_info, &(messages[i]->data->front()),
477 messages[i]->data->size()); 477 messages[i]->data->size());
478 break; 478 break;
479 } 479 }
480 default: { 480 default: {
481 NOTREACHED(); 481 NOTREACHED();
482 break; 482 break;
483 } 483 }
(...skipping 21 matching lines...) Expand all
505 if (should_listen) { 505 if (should_listen) {
506 status->listening_state = ListeningState::WAITING; 506 status->listening_state = ListeningState::WAITING;
507 presentation_service_->ListenForScreenAvailability(status->url); 507 presentation_service_->ListenForScreenAvailability(status->url);
508 } else { 508 } else {
509 status->listening_state = ListeningState::INACTIVE; 509 status->listening_state = ListeningState::INACTIVE;
510 presentation_service_->StopListeningForScreenAvailability(status->url); 510 presentation_service_->StopListeningForScreenAvailability(status->url);
511 } 511 }
512 } 512 }
513 513
514 PresentationDispatcher::SendMessageRequest::SendMessageRequest( 514 PresentationDispatcher::SendMessageRequest::SendMessageRequest(
515 blink::mojom::PresentationSessionInfoPtr session_info, 515 content::mojom::PresentationSessionInfoPtr session_info,
516 blink::mojom::ConnectionMessagePtr message) 516 content::mojom::ConnectionMessagePtr message)
517 : session_info(std::move(session_info)), message(std::move(message)) {} 517 : session_info(std::move(session_info)), message(std::move(message)) {}
518 518
519 PresentationDispatcher::SendMessageRequest::~SendMessageRequest() {} 519 PresentationDispatcher::SendMessageRequest::~SendMessageRequest() {}
520 520
521 // static 521 // static
522 PresentationDispatcher::SendMessageRequest* 522 PresentationDispatcher::SendMessageRequest*
523 PresentationDispatcher::CreateSendTextMessageRequest( 523 PresentationDispatcher::CreateSendTextMessageRequest(
524 const blink::WebURL& presentationUrl, 524 const blink::WebURL& presentationUrl,
525 const blink::WebString& presentationId, 525 const blink::WebString& presentationId,
526 const blink::WebString& message) { 526 const blink::WebString& message) {
527 blink::mojom::PresentationSessionInfoPtr session_info = 527 content::mojom::PresentationSessionInfoPtr session_info =
528 blink::mojom::PresentationSessionInfo::New(); 528 content::mojom::PresentationSessionInfo::New();
529 session_info->url = presentationUrl; 529 session_info->url = presentationUrl;
530 session_info->id = presentationId.utf8(); 530 session_info->id = presentationId.utf8();
531 531
532 blink::mojom::ConnectionMessagePtr session_message = 532 content::mojom::ConnectionMessagePtr session_message =
533 blink::mojom::ConnectionMessage::New(); 533 content::mojom::ConnectionMessage::New();
534 session_message->type = blink::mojom::PresentationMessageType::TEXT; 534 session_message->type = content::mojom::PresentationMessageType::TEXT;
535 session_message->message = message.utf8(); 535 session_message->message = message.utf8();
536 return new SendMessageRequest(std::move(session_info), 536 return new SendMessageRequest(std::move(session_info),
537 std::move(session_message)); 537 std::move(session_message));
538 } 538 }
539 539
540 // static 540 // static
541 PresentationDispatcher::SendMessageRequest* 541 PresentationDispatcher::SendMessageRequest*
542 PresentationDispatcher::CreateSendBinaryMessageRequest( 542 PresentationDispatcher::CreateSendBinaryMessageRequest(
543 const blink::WebURL& presentationUrl, 543 const blink::WebURL& presentationUrl,
544 const blink::WebString& presentationId, 544 const blink::WebString& presentationId,
545 blink::mojom::PresentationMessageType type, 545 content::mojom::PresentationMessageType type,
546 const uint8_t* data, 546 const uint8_t* data,
547 size_t length) { 547 size_t length) {
548 blink::mojom::PresentationSessionInfoPtr session_info = 548 content::mojom::PresentationSessionInfoPtr session_info =
549 blink::mojom::PresentationSessionInfo::New(); 549 content::mojom::PresentationSessionInfo::New();
550 session_info->url = presentationUrl; 550 session_info->url = presentationUrl;
551 session_info->id = presentationId.utf8(); 551 session_info->id = presentationId.utf8();
552 552
553 blink::mojom::ConnectionMessagePtr session_message = 553 content::mojom::ConnectionMessagePtr session_message =
554 blink::mojom::ConnectionMessage::New(); 554 content::mojom::ConnectionMessage::New();
555 session_message->type = type; 555 session_message->type = type;
556 session_message->data = std::vector<uint8_t>(data, data + length); 556 session_message->data = std::vector<uint8_t>(data, data + length);
557 return new SendMessageRequest(std::move(session_info), 557 return new SendMessageRequest(std::move(session_info),
558 std::move(session_message)); 558 std::move(session_message));
559 } 559 }
560 560
561 PresentationDispatcher::AvailabilityStatus::AvailabilityStatus( 561 PresentationDispatcher::AvailabilityStatus::AvailabilityStatus(
562 const GURL& availability_url) 562 const GURL& availability_url)
563 : url(availability_url), 563 : url(availability_url),
564 last_known_availability(false), 564 last_known_availability(false),
565 listening_state(ListeningState::INACTIVE) {} 565 listening_state(ListeningState::INACTIVE) {}
566 566
567 PresentationDispatcher::AvailabilityStatus::~AvailabilityStatus() { 567 PresentationDispatcher::AvailabilityStatus::~AvailabilityStatus() {
568 } 568 }
569 569
570 } // namespace content 570 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698