Index: chrome/browser/media/router/presentation_service_delegate_impl.cc |
diff --git a/chrome/browser/media/router/presentation_service_delegate_impl.cc b/chrome/browser/media/router/presentation_service_delegate_impl.cc |
index d0c574cfd30e5b0d9beee443660035d56d5e9618..f401199a5f07ddcfd1c18b133169f25242087e4a 100644 |
--- a/chrome/browser/media/router/presentation_service_delegate_impl.cc |
+++ b/chrome/browser/media/router/presentation_service_delegate_impl.cc |
@@ -21,6 +21,8 @@ |
#include "chrome/browser/media/router/media_router_factory.h" |
#include "chrome/browser/media/router/media_sink.h" |
#include "chrome/browser/media/router/media_source_helper.h" |
+#include "chrome/browser/media/router/offscreen_presentation_manager.h" |
+#include "chrome/browser/media/router/offscreen_presentation_manager_factory.h" |
#include "chrome/browser/media/router/presentation_media_sinks_observer.h" |
#include "chrome/browser/media/router/route_message.h" |
#include "chrome/browser/media/router/route_message_observer.h" |
@@ -31,6 +33,7 @@ |
#include "content/public/browser/presentation_session.h" |
#include "content/public/browser/render_frame_host.h" |
#include "content/public/browser/render_process_host.h" |
+#include "url/gurl.h" |
DEFINE_WEB_CONTENTS_USER_DATA_KEY( |
media_router::PresentationServiceDelegateImpl); |
@@ -41,7 +44,7 @@ namespace media_router { |
namespace { |
-using DelegateObserver = content::PresentationServiceDelegate::Observer; |
+using DelegateObserver = content::PresentationServiceDelegateBase::Observer; |
// Returns the unique identifier for the supplied RenderFrameHost. |
RenderFrameHostId GetRenderFrameHostId(RenderFrameHost* render_frame_host) { |
@@ -756,11 +759,13 @@ void PresentationServiceDelegateImpl::OnStartSessionSucceeded( |
int render_frame_id, |
const content::PresentationSessionStartedCallback& success_cb, |
const content::PresentationSessionInfo& new_session, |
- const MediaRoute::Id& route_id) { |
+ const MediaRoute& route) { |
+ const MediaRoute::Id& route_id = route.media_route_id(); |
DVLOG(1) << "OnStartSessionSucceeded: " |
<< "route_id: " << route_id |
<< ", presentation URL: " << new_session.presentation_url |
- << ", presentation ID: " << new_session.presentation_id; |
+ << ", presentation ID: " << new_session.presentation_id |
+ << ", is_offscreen_presentation: " << new_session.is_offscreen; |
frame_manager_->OnPresentationSessionStarted( |
RenderFrameHostId(render_process_id, render_frame_id), new_session, |
route_id); |
@@ -915,6 +920,19 @@ void PresentationServiceDelegateImpl::ListenForConnectionStateChange( |
state_changed_cb); |
} |
+void PresentationServiceDelegateImpl::ConnectToOffscreenPresentation( |
+ int render_process_id, |
+ int render_frame_id, |
+ const content::PresentationSessionInfo& session, |
+ content::PresentationConnectionPtr connection) { |
+ RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id); |
+ auto offscreen_presentation_manager = OffscreenPresentationManagerFactory:: |
+ GetOrCreateForControllerBrowserContext(web_contents_); |
+ offscreen_presentation_manager->RegisterOffscreenPresentationController( |
+ session.presentation_id, GURL(session.presentation_url), |
+ render_frame_host_id, std::move(connection)); |
+} |
+ |
void PresentationServiceDelegateImpl::OnRouteResponse( |
const PresentationRequest& presentation_request, |
const RouteRequestResult& result) { |