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 f401199a5f07ddcfd1c18b133169f25242087e4a..b1adae4f9b482f87b8656a38f4b0b50c9ae19b4c 100644 |
--- a/chrome/browser/media/router/presentation_service_delegate_impl.cc |
+++ b/chrome/browser/media/router/presentation_service_delegate_impl.cc |
@@ -174,7 +174,7 @@ class PresentationFrame { |
RenderFrameHostId render_frame_host_id_; |
// References to the owning WebContents, and the corresponding MediaRouter. |
- const content::WebContents* web_contents_; |
+ content::WebContents* web_contents_; |
MediaRouter* router_; |
DelegateObserver* delegate_observer_; |
@@ -257,8 +257,14 @@ bool PresentationFrame::HasScreenAvailabilityListenerForTest( |
} |
void PresentationFrame::Reset() { |
- for (const auto& pid_route_id : presentation_id_to_route_id_) |
+ auto offscreen_presentation_manager = OffscreenPresentationManagerFactory:: |
+ GetOrCreateForControllerBrowserContext(web_contents_); |
+ |
+ for (const auto& pid_route_id : presentation_id_to_route_id_) { |
+ offscreen_presentation_manager->UnregisterOffscreenPresentationController( |
+ pid_route_id.first, render_frame_host_id_); |
router_->DetachRoute(pid_route_id.second); |
+ } |
presentation_id_to_route_id_.clear(); |
url_to_sinks_observer_.clear(); |