Index: content/renderer/presentation/presentation_dispatcher.cc |
diff --git a/content/renderer/presentation/presentation_dispatcher.cc b/content/renderer/presentation/presentation_dispatcher.cc |
index a0b3125568cfa47217c6424ab470549d34f99c92..321acb43d4a72a53fa5c6fcb65d4b1d3a45260ba 100644 |
--- a/content/renderer/presentation/presentation_dispatcher.cc |
+++ b/content/renderer/presentation/presentation_dispatcher.cc |
@@ -81,8 +81,8 @@ namespace content { |
PresentationDispatcher::PresentationDispatcher(RenderFrame* render_frame) |
: RenderFrameObserver(render_frame), |
controller_(nullptr), |
- binding_(this) { |
-} |
+ receiver_(nullptr), |
+ binding_(this) {} |
PresentationDispatcher::~PresentationDispatcher() { |
// Controller should be destroyed before the dispatcher when frame is |
@@ -394,16 +394,35 @@ void PresentationDispatcher::OnSessionCreated( |
DCHECK(!session_info.is_null()); |
presentation_service_->ListenForSessionMessages(session_info.Clone()); |
- callback->onSuccess( |
- base::MakeUnique<PresentationConnectionClient>(std::move(session_info))); |
+ |
+ RendererPresentationConnection* controller_connection_proxy = |
mark a. foltz
2016/10/10 18:28:52
How do you know this connection is for an offscree
zhaobin
2016/10/12 02:27:33
Done.
|
+ new RendererPresentationConnection(); |
+ // Bind controller_connection_proxy with PresentationConnection |
+ // in controller page. |
+ callback->onSuccess(base::MakeUnique<PresentationConnectionClient>( |
imcheng
2016/10/12 02:22:55
It looks like we don't need the 2-argument Present
zhaobin
2016/10/13 02:33:52
Did some changes in new patch so we use 2-argument
|
+ session_info.Clone(), controller_connection_proxy)); |
+ |
+ // Pass controller_connection_proxy to PSImpl and register |
+ // it with OffscreenPresentationManager. |
+ presentation_service_->SetPresentationConnection( |
+ session_info.Clone(), controller_connection_proxy->Bind()); |
imcheng
2016/10/12 02:22:54
|controller_connection_proxy| might have already b
zhaobin
2016/10/13 02:33:52
Done.
|
} |
void PresentationDispatcher::OnReceiverConnectionAvailable( |
- blink::mojom::PresentationSessionInfoPtr session_info) { |
- if (receiver_) { |
- receiver_->onReceiverConnectionAvailable( |
- new PresentationConnectionClient(std::move(session_info))); |
- } |
+ blink::mojom::PresentationSessionInfoPtr session_info, |
+ blink::mojom::PresentationConnectionPtr controller) { |
+ if (!receiver_) |
+ return; |
+ |
+ RendererPresentationConnection* receiver_connection_proxy = |
+ new RendererPresentationConnection(); |
+ // Bind receiver_connection_proxy with PresentationConnection |
+ // in receiver page. |
+ receiver_->onReceiverConnectionAvailable(new PresentationConnectionClient( |
+ std::move(session_info), receiver_connection_proxy)); |
+ |
+ controller->SetTargetConnection(receiver_connection_proxy->Bind()); |
+ receiver_connection_proxy->SetTargetConnection(std::move(controller)); |
} |
void PresentationDispatcher::OnConnectionStateChanged( |