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

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

Issue 2613153003: [Presentation API] Replaces type converters with typemaps (Closed)
Patch Set: Extend presentation ID max length to 64. Created 3 years, 10 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/stl_util.h" 14 #include "base/stl_util.h"
15 #include "base/threading/thread_task_runner_handle.h" 15 #include "base/threading/thread_task_runner_handle.h"
16 #include "content/public/common/presentation_constants.h" 16 #include "content/public/common/presentation_constants.h"
17 #include "content/public/renderer/render_frame.h" 17 #include "content/public/renderer/render_frame.h"
18 #include "content/renderer/presentation/presentation_connection_proxy.h" 18 #include "content/renderer/presentation/presentation_connection_proxy.h"
19 #include "mojo/public/cpp/bindings/type_converter.h"
20 #include "services/service_manager/public/cpp/interface_provider.h" 19 #include "services/service_manager/public/cpp/interface_provider.h"
21 #include "third_party/WebKit/public/platform/WebString.h" 20 #include "third_party/WebKit/public/platform/WebString.h"
22 #include "third_party/WebKit/public/platform/WebURL.h" 21 #include "third_party/WebKit/public/platform/WebURL.h"
23 #include "third_party/WebKit/public/platform/WebVector.h" 22 #include "third_party/WebKit/public/platform/WebVector.h"
24 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nAvailabilityObserver.h" 23 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nAvailabilityObserver.h"
25 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nConnection.h" 24 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nConnection.h"
26 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nConnectionCallbacks.h" 25 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nConnectionCallbacks.h"
27 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nController.h" 26 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nController.h"
28 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nError.h" 27 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nError.h"
29 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nReceiver.h" 28 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nReceiver.h"
30 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nSessionInfo.h" 29 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nSessionInfo.h"
31 #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"
32 #include "third_party/WebKit/public/web/WebLocalFrame.h" 31 #include "third_party/WebKit/public/web/WebLocalFrame.h"
33 #include "url/gurl.h" 32 #include "url/gurl.h"
34 33
35 namespace mojo { 34 namespace content {
36
37 // Temporary type converter since Presentation API has not been Onion Soup-ed.
38 template <>
39 struct TypeConverter<blink::WebPresentationSessionInfo,
40 blink::mojom::PresentationSessionInfoPtr> {
41 static blink::WebPresentationSessionInfo Convert(
42 const blink::mojom::PresentationSessionInfoPtr& input) {
43 return blink::WebPresentationSessionInfo(
44 blink::WebURL(input->url), blink::WebString::fromUTF8(input->id));
45 }
46 };
47
48 } // namespace mojo
49 35
50 namespace { 36 namespace {
51 37
52 blink::WebPresentationError::ErrorType GetWebPresentationErrorTypeFromMojo( 38 blink::WebPresentationError::ErrorType GetWebPresentationErrorType(
53 blink::mojom::PresentationErrorType mojoErrorType) { 39 PresentationErrorType errorType) {
54 switch (mojoErrorType) { 40 switch (errorType) {
55 case blink::mojom::PresentationErrorType::NO_AVAILABLE_SCREENS: 41 case PresentationErrorType::PRESENTATION_ERROR_NO_AVAILABLE_SCREENS:
56 return blink::WebPresentationError::ErrorTypeNoAvailableScreens; 42 return blink::WebPresentationError::ErrorTypeNoAvailableScreens;
57 case blink::mojom::PresentationErrorType::SESSION_REQUEST_CANCELLED: 43 case PresentationErrorType::PRESENTATION_ERROR_SESSION_REQUEST_CANCELLED:
58 return blink::WebPresentationError::ErrorTypeSessionRequestCancelled; 44 return blink::WebPresentationError::ErrorTypeSessionRequestCancelled;
59 case blink::mojom::PresentationErrorType::NO_PRESENTATION_FOUND: 45 case PresentationErrorType::PRESENTATION_ERROR_NO_PRESENTATION_FOUND:
60 return blink::WebPresentationError::ErrorTypeNoPresentationFound; 46 return blink::WebPresentationError::ErrorTypeNoPresentationFound;
61 case blink::mojom::PresentationErrorType::PREVIOUS_START_IN_PROGRESS: 47 case PresentationErrorType::PRESENTATION_ERROR_PREVIOUS_START_IN_PROGRESS:
62 return blink::WebPresentationError::ErrorTypePreviousStartInProgress; 48 return blink::WebPresentationError::ErrorTypePreviousStartInProgress;
63 case blink::mojom::PresentationErrorType::UNKNOWN: 49 case PresentationErrorType::PRESENTATION_ERROR_UNKNOWN:
64 default: 50 default:
65 return blink::WebPresentationError::ErrorTypeUnknown; 51 return blink::WebPresentationError::ErrorTypeUnknown;
66 } 52 }
67 } 53 }
68 54
69 blink::WebPresentationConnectionState GetWebPresentationConnectionStateFromMojo( 55 blink::WebPresentationConnectionState GetWebPresentationConnectionState(
70 blink::mojom::PresentationConnectionState mojoSessionState) { 56 PresentationConnectionState sessionState) {
71 switch (mojoSessionState) { 57 switch (sessionState) {
72 case blink::mojom::PresentationConnectionState::CONNECTING: 58 case PresentationConnectionState::PRESENTATION_CONNECTION_STATE_CONNECTING:
73 return blink::WebPresentationConnectionState::Connecting; 59 return blink::WebPresentationConnectionState::Connecting;
74 case blink::mojom::PresentationConnectionState::CONNECTED: 60 case PresentationConnectionState::PRESENTATION_CONNECTION_STATE_CONNECTED:
75 return blink::WebPresentationConnectionState::Connected; 61 return blink::WebPresentationConnectionState::Connected;
76 case blink::mojom::PresentationConnectionState::CLOSED: 62 case PresentationConnectionState::PRESENTATION_CONNECTION_STATE_CLOSED:
77 return blink::WebPresentationConnectionState::Closed; 63 return blink::WebPresentationConnectionState::Closed;
78 case blink::mojom::PresentationConnectionState::TERMINATED: 64 case PresentationConnectionState::PRESENTATION_CONNECTION_STATE_TERMINATED:
79 return blink::WebPresentationConnectionState::Terminated; 65 return blink::WebPresentationConnectionState::Terminated;
80 default: 66 default:
81 NOTREACHED(); 67 NOTREACHED();
82 return blink::WebPresentationConnectionState::Terminated; 68 return blink::WebPresentationConnectionState::Terminated;
83 } 69 }
84 } 70 }
85 71
86 blink::WebPresentationConnectionCloseReason 72 blink::WebPresentationConnectionCloseReason
87 GetWebPresentationConnectionCloseReasonFromMojo( 73 GetWebPresentationConnectionCloseReason(
88 blink::mojom::PresentationConnectionCloseReason mojoConnectionCloseReason) { 74 PresentationConnectionCloseReason connectionCloseReason) {
89 switch (mojoConnectionCloseReason) { 75 switch (connectionCloseReason) {
90 case blink::mojom::PresentationConnectionCloseReason::CONNECTION_ERROR: 76 case PresentationConnectionCloseReason::
77 PRESENTATION_CONNECTION_CLOSE_REASON_CONNECTION_ERROR:
91 return blink::WebPresentationConnectionCloseReason::Error; 78 return blink::WebPresentationConnectionCloseReason::Error;
92 case blink::mojom::PresentationConnectionCloseReason::CLOSED: 79 case PresentationConnectionCloseReason::
80 PRESENTATION_CONNECTION_CLOSE_REASON_CLOSED:
93 return blink::WebPresentationConnectionCloseReason::Closed; 81 return blink::WebPresentationConnectionCloseReason::Closed;
94 case blink::mojom::PresentationConnectionCloseReason::WENT_AWAY: 82 case PresentationConnectionCloseReason::
83 PRESENTATION_CONNECTION_CLOSE_REASON_WENT_AWAY:
95 return blink::WebPresentationConnectionCloseReason::WentAway; 84 return blink::WebPresentationConnectionCloseReason::WentAway;
96 default: 85 default:
97 NOTREACHED(); 86 NOTREACHED();
98 return blink::WebPresentationConnectionCloseReason::Error; 87 return blink::WebPresentationConnectionCloseReason::Error;
99 } 88 }
100 } 89 }
101 } // namespace 90 } // namespace
102 91
103 namespace content {
104
105 PresentationDispatcher::PresentationDispatcher(RenderFrame* render_frame) 92 PresentationDispatcher::PresentationDispatcher(RenderFrame* render_frame)
106 : RenderFrameObserver(render_frame), 93 : RenderFrameObserver(render_frame),
107 controller_(nullptr), 94 controller_(nullptr),
108 receiver_(nullptr), 95 receiver_(nullptr),
109 binding_(this) {} 96 binding_(this) {}
110 97
111 PresentationDispatcher::~PresentationDispatcher() { 98 PresentationDispatcher::~PresentationDispatcher() {
112 // Controller should be destroyed before the dispatcher when frame is 99 // Controller should be destroyed before the dispatcher when frame is
113 // destroyed. 100 // destroyed.
114 DCHECK(!controller_); 101 DCHECK(!controller_);
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 MaybeStopListeningToURL(availability_url); 463 MaybeStopListeningToURL(availability_url);
477 464
478 modified_listeners.insert(listener.get()); 465 modified_listeners.insert(listener.get());
479 } 466 }
480 467
481 for (auto* listener : modified_listeners) 468 for (auto* listener : modified_listeners)
482 TryRemoveAvailabilityListener(listener); 469 TryRemoveAvailabilityListener(listener);
483 } 470 }
484 471
485 void PresentationDispatcher::OnDefaultSessionStarted( 472 void PresentationDispatcher::OnDefaultSessionStarted(
486 blink::mojom::PresentationSessionInfoPtr session_info) { 473 const PresentationSessionInfo& session_info) {
487 if (!controller_) 474 if (!controller_)
488 return; 475 return;
489 476
490 if (!session_info.is_null()) { 477 presentation_service_->ListenForConnectionMessages(session_info);
491 presentation_service_->ListenForConnectionMessages(session_info.Clone()); 478 auto* connection =
492 auto* connection = controller_->didStartDefaultSession( 479 controller_->didStartDefaultSession(blink::WebPresentationSessionInfo(
493 mojo::ConvertTo<blink::WebPresentationSessionInfo>(session_info)); 480 session_info.presentation_url,
494 connection->bindProxy( 481 blink::WebString::fromUTF8(session_info.presentation_id)));
495 base::MakeUnique<ControllerConnectionProxy>(connection)); 482 connection->bindProxy(
496 } 483 base::MakeUnique<ControllerConnectionProxy>(connection));
497 } 484 }
498 485
499 void PresentationDispatcher::OnSessionCreated( 486 void PresentationDispatcher::OnSessionCreated(
500 std::unique_ptr<blink::WebPresentationConnectionCallbacks> callback, 487 std::unique_ptr<blink::WebPresentationConnectionCallbacks> callback,
501 blink::mojom::PresentationSessionInfoPtr session_info, 488 const base::Optional<PresentationSessionInfo>& session_info,
502 blink::mojom::PresentationErrorPtr error) { 489 const base::Optional<PresentationError>& error) {
503 DCHECK(callback); 490 DCHECK(callback);
504 if (!error.is_null()) { 491 if (error) {
505 DCHECK(session_info.is_null()); 492 DCHECK(!session_info);
506 callback->onError(blink::WebPresentationError( 493 callback->onError(blink::WebPresentationError(
507 GetWebPresentationErrorTypeFromMojo(error->error_type), 494 GetWebPresentationErrorType(error->error_type),
508 blink::WebString::fromUTF8(error->message))); 495 blink::WebString::fromUTF8(error->message)));
509 return; 496 return;
510 } 497 }
511 498
512 DCHECK(!session_info.is_null()); 499 DCHECK(session_info);
513 presentation_service_->ListenForConnectionMessages(session_info.Clone()); 500 presentation_service_->ListenForConnectionMessages(session_info.value());
514 callback->onSuccess( 501 callback->onSuccess(blink::WebPresentationSessionInfo(
515 mojo::ConvertTo<blink::WebPresentationSessionInfo>(session_info)); 502 session_info->presentation_url,
503 blink::WebString::fromUTF8(session_info->presentation_id)));
516 504
517 auto* connection = callback->getConnection(); 505 auto* connection = callback->getConnection();
518 connection->bindProxy( 506 connection->bindProxy(
519 base::MakeUnique<ControllerConnectionProxy>(connection)); 507 base::MakeUnique<ControllerConnectionProxy>(connection));
520 } 508 }
521 509
522 void PresentationDispatcher::OnReceiverConnectionAvailable( 510 void PresentationDispatcher::OnReceiverConnectionAvailable(
523 blink::mojom::PresentationSessionInfoPtr session_info, 511 const PresentationSessionInfo& session_info,
524 blink::mojom::PresentationConnectionPtr controller_connection_ptr, 512 blink::mojom::PresentationConnectionPtr controller_connection_ptr,
525 blink::mojom::PresentationConnectionRequest receiver_connection_request) { 513 blink::mojom::PresentationConnectionRequest receiver_connection_request) {
526 DCHECK(receiver_); 514 DCHECK(receiver_);
527 // Bind receiver_connection_proxy with PresentationConnection in receiver 515 // Bind receiver_connection_proxy with PresentationConnection in receiver
528 // page. 516 // page.
529 auto* connection = receiver_->onReceiverConnectionAvailable( 517 auto* connection = receiver_->onReceiverConnectionAvailable(
530 mojo::ConvertTo<blink::WebPresentationSessionInfo>(session_info)); 518 blink::WebPresentationSessionInfo(
519 session_info.presentation_url,
520 blink::WebString::fromUTF8(session_info.presentation_id)));
531 auto* receiver_connection_proxy = new ReceiverConnectionProxy(connection); 521 auto* receiver_connection_proxy = new ReceiverConnectionProxy(connection);
532 connection->bindProxy(base::WrapUnique(receiver_connection_proxy)); 522 connection->bindProxy(base::WrapUnique(receiver_connection_proxy));
533 523
534 receiver_connection_proxy->Bind(std::move(receiver_connection_request)); 524 receiver_connection_proxy->Bind(std::move(receiver_connection_request));
535 receiver_connection_proxy->BindControllerConnection( 525 receiver_connection_proxy->BindControllerConnection(
536 std::move(controller_connection_ptr)); 526 std::move(controller_connection_ptr));
537 } 527 }
538 528
539 void PresentationDispatcher::OnConnectionStateChanged( 529 void PresentationDispatcher::OnConnectionStateChanged(
540 blink::mojom::PresentationSessionInfoPtr session_info, 530 const PresentationSessionInfo& session_info,
541 blink::mojom::PresentationConnectionState state) { 531 PresentationConnectionState state) {
542 if (!controller_) 532 if (!controller_)
543 return; 533 return;
544 534
545 controller_->didChangeSessionState( 535 controller_->didChangeSessionState(
546 mojo::ConvertTo<blink::WebPresentationSessionInfo>(session_info), 536 blink::WebPresentationSessionInfo(
547 GetWebPresentationConnectionStateFromMojo(state)); 537 session_info.presentation_url,
538 blink::WebString::fromUTF8(session_info.presentation_id)),
539 GetWebPresentationConnectionState(state));
548 } 540 }
549 541
550 void PresentationDispatcher::OnConnectionClosed( 542 void PresentationDispatcher::OnConnectionClosed(
551 blink::mojom::PresentationSessionInfoPtr session_info, 543 const PresentationSessionInfo& session_info,
552 blink::mojom::PresentationConnectionCloseReason reason, 544 PresentationConnectionCloseReason reason,
553 const std::string& message) { 545 const std::string& message) {
554 if (!controller_) 546 if (!controller_)
555 return; 547 return;
556 548
557 controller_->didCloseConnection( 549 controller_->didCloseConnection(
558 mojo::ConvertTo<blink::WebPresentationSessionInfo>(session_info), 550 blink::WebPresentationSessionInfo(
559 GetWebPresentationConnectionCloseReasonFromMojo(reason), 551 session_info.presentation_url,
552 blink::WebString::fromUTF8(session_info.presentation_id)),
553 GetWebPresentationConnectionCloseReason(reason),
560 blink::WebString::fromUTF8(message)); 554 blink::WebString::fromUTF8(message));
561 } 555 }
562 556
563 void PresentationDispatcher::OnConnectionMessagesReceived( 557 void PresentationDispatcher::OnConnectionMessagesReceived(
564 blink::mojom::PresentationSessionInfoPtr session_info, 558 const PresentationSessionInfo& session_info,
565 std::vector<blink::mojom::ConnectionMessagePtr> messages) { 559 std::vector<blink::mojom::ConnectionMessagePtr> messages) {
566 if (!controller_) 560 if (!controller_)
567 return; 561 return;
568 562
569 for (size_t i = 0; i < messages.size(); ++i) { 563 for (size_t i = 0; i < messages.size(); ++i) {
570 // Note: Passing batches of messages to the Blink layer would be more 564 // Note: Passing batches of messages to the Blink layer would be more
571 // efficient. 565 // efficient.
572 auto web_session_info = 566 auto web_session_info = blink::WebPresentationSessionInfo(
573 mojo::ConvertTo<blink::WebPresentationSessionInfo>(session_info); 567 session_info.presentation_url,
568 blink::WebString::fromUTF8(session_info.presentation_id));
569
574 switch (messages[i]->type) { 570 switch (messages[i]->type) {
575 case blink::mojom::PresentationMessageType::TEXT: { 571 case blink::mojom::PresentationMessageType::TEXT: {
576 // TODO(mfoltz): Do we need to DCHECK(messages[i]->message)? 572 // TODO(mfoltz): Do we need to DCHECK(messages[i]->message)?
577 controller_->didReceiveSessionTextMessage( 573 controller_->didReceiveSessionTextMessage(
578 web_session_info, 574 web_session_info,
579 blink::WebString::fromUTF8(messages[i]->message.value())); 575 blink::WebString::fromUTF8(messages[i]->message.value()));
580 break; 576 break;
581 } 577 }
582 case blink::mojom::PresentationMessageType::BINARY: { 578 case blink::mojom::PresentationMessageType::BINARY: {
583 // TODO(mfoltz): Do we need to DCHECK(messages[i]->data)? 579 // TODO(mfoltz): Do we need to DCHECK(messages[i]->data)?
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 auto screen_availability = 691 auto screen_availability =
696 status ? status->last_known_availability : ScreenAvailability::UNKNOWN; 692 status ? status->last_known_availability : ScreenAvailability::UNKNOWN;
697 current_availability = 693 current_availability =
698 std::max(current_availability, static_cast<int>(screen_availability)); 694 std::max(current_availability, static_cast<int>(screen_availability));
699 } 695 }
700 696
701 return static_cast<ScreenAvailability>(current_availability); 697 return static_cast<ScreenAvailability>(current_availability);
702 } 698 }
703 699
704 PresentationDispatcher::SendMessageRequest::SendMessageRequest( 700 PresentationDispatcher::SendMessageRequest::SendMessageRequest(
705 blink::mojom::PresentationSessionInfoPtr session_info, 701 const PresentationSessionInfo& session_info,
706 blink::mojom::ConnectionMessagePtr message, 702 blink::mojom::ConnectionMessagePtr message,
707 const blink::WebPresentationConnectionProxy* connection_proxy) 703 const blink::WebPresentationConnectionProxy* connection_proxy)
708 : session_info(std::move(session_info)), 704 : session_info(session_info),
709 message(std::move(message)), 705 message(std::move(message)),
710 connection_proxy(connection_proxy) {} 706 connection_proxy(connection_proxy) {}
711 707
712 PresentationDispatcher::SendMessageRequest::~SendMessageRequest() {} 708 PresentationDispatcher::SendMessageRequest::~SendMessageRequest() {}
713 709
714 // static 710 // static
715 PresentationDispatcher::SendMessageRequest* 711 PresentationDispatcher::SendMessageRequest*
716 PresentationDispatcher::CreateSendTextMessageRequest( 712 PresentationDispatcher::CreateSendTextMessageRequest(
717 const blink::WebURL& presentationUrl, 713 const blink::WebURL& presentationUrl,
718 const blink::WebString& presentationId, 714 const blink::WebString& presentationId,
719 const blink::WebString& message, 715 const blink::WebString& message,
720 const blink::WebPresentationConnectionProxy* connection_proxy) { 716 const blink::WebPresentationConnectionProxy* connection_proxy) {
721 blink::mojom::PresentationSessionInfoPtr session_info = 717 PresentationSessionInfo session_info(GURL(presentationUrl),
722 blink::mojom::PresentationSessionInfo::New(); 718 presentationId.utf8());
723 session_info->url = presentationUrl;
724 session_info->id = presentationId.utf8();
725 719
726 blink::mojom::ConnectionMessagePtr session_message = 720 blink::mojom::ConnectionMessagePtr session_message =
727 blink::mojom::ConnectionMessage::New(); 721 blink::mojom::ConnectionMessage::New();
728 session_message->type = blink::mojom::PresentationMessageType::TEXT; 722 session_message->type = blink::mojom::PresentationMessageType::TEXT;
729 session_message->message = message.utf8(); 723 session_message->message = message.utf8();
730 return new SendMessageRequest(std::move(session_info), 724 return new SendMessageRequest(session_info, std::move(session_message),
731 std::move(session_message), connection_proxy); 725 connection_proxy);
732 } 726 }
733 727
734 // static 728 // static
735 PresentationDispatcher::SendMessageRequest* 729 PresentationDispatcher::SendMessageRequest*
736 PresentationDispatcher::CreateSendBinaryMessageRequest( 730 PresentationDispatcher::CreateSendBinaryMessageRequest(
737 const blink::WebURL& presentationUrl, 731 const blink::WebURL& presentationUrl,
738 const blink::WebString& presentationId, 732 const blink::WebString& presentationId,
739 blink::mojom::PresentationMessageType type, 733 blink::mojom::PresentationMessageType type,
740 const uint8_t* data, 734 const uint8_t* data,
741 size_t length, 735 size_t length,
742 const blink::WebPresentationConnectionProxy* connection_proxy) { 736 const blink::WebPresentationConnectionProxy* connection_proxy) {
743 blink::mojom::PresentationSessionInfoPtr session_info = 737 PresentationSessionInfo session_info(GURL(presentationUrl),
744 blink::mojom::PresentationSessionInfo::New(); 738 presentationId.utf8());
745 session_info->url = presentationUrl;
746 session_info->id = presentationId.utf8();
747 739
748 blink::mojom::ConnectionMessagePtr session_message = 740 blink::mojom::ConnectionMessagePtr session_message =
749 blink::mojom::ConnectionMessage::New(); 741 blink::mojom::ConnectionMessage::New();
750 session_message->type = type; 742 session_message->type = type;
751 session_message->data = std::vector<uint8_t>(data, data + length); 743 session_message->data = std::vector<uint8_t>(data, data + length);
752 return new SendMessageRequest(std::move(session_info), 744 return new SendMessageRequest(session_info, std::move(session_message),
753 std::move(session_message), connection_proxy); 745 connection_proxy);
754 } 746 }
755 747
756 PresentationDispatcher::AvailabilityListener::AvailabilityListener( 748 PresentationDispatcher::AvailabilityListener::AvailabilityListener(
757 const std::vector<GURL>& availability_urls) 749 const std::vector<GURL>& availability_urls)
758 : urls(availability_urls) {} 750 : urls(availability_urls) {}
759 751
760 PresentationDispatcher::AvailabilityListener::~AvailabilityListener() {} 752 PresentationDispatcher::AvailabilityListener::~AvailabilityListener() {}
761 753
762 PresentationDispatcher::ListeningStatus::ListeningStatus( 754 PresentationDispatcher::ListeningStatus::ListeningStatus(
763 const GURL& availability_url) 755 const GURL& availability_url)
764 : url(availability_url), 756 : url(availability_url),
765 last_known_availability(ScreenAvailability::UNKNOWN), 757 last_known_availability(ScreenAvailability::UNKNOWN),
766 listening_state(ListeningState::INACTIVE) {} 758 listening_state(ListeningState::INACTIVE) {}
767 759
768 PresentationDispatcher::ListeningStatus::~ListeningStatus() {} 760 PresentationDispatcher::ListeningStatus::~ListeningStatus() {}
769 761
770 } // namespace content 762 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698