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

Unified Diff: chrome/browser/media/router/presentation_service_delegate_impl.cc

Issue 2666743002: Manual Revert of Convert MediaRouter mojom apis to intake url::Origin objects instead of strings (p… (Closed)
Patch Set: fix merge conflict 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 side-by-side diff with in-line comments
Download patch
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 78f9a4ae2a9eb3c1eb1e06fa33dbc619b0041a4b..e938d757883b27bf872c800695bdb5cb58167398 100644
--- a/chrome/browser/media/router/presentation_service_delegate_impl.cc
+++ b/chrome/browser/media/router/presentation_service_delegate_impl.cc
@@ -60,12 +60,14 @@ RenderFrameHostId GetRenderFrameHostId(RenderFrameHost* render_frame_host) {
// Gets the last committed URL for the render frame specified by
// |render_frame_host_id|.
-url::Origin GetLastCommittedURLForFrame(
- RenderFrameHostId render_frame_host_id) {
+GURL GetLastCommittedURLForFrame(RenderFrameHostId render_frame_host_id) {
RenderFrameHost* render_frame_host = RenderFrameHost::FromID(
render_frame_host_id.first, render_frame_host_id.second);
- DCHECK(render_frame_host);
- return render_frame_host->GetLastCommittedOrigin();
+ if (!render_frame_host)
+ return GURL();
+
+ // TODO(crbug.com/632623): Use url::Origin in place of GURL for origins
+ return render_frame_host->GetLastCommittedOrigin().GetURL();
}
// Observes messages originating from the MediaSink connected to a MediaRoute
@@ -229,7 +231,7 @@ bool PresentationFrame::SetScreenAvailabilityListener(
sinks_observer.reset(new PresentationMediaSinksObserver(
router_, listener, source,
- GetLastCommittedURLForFrame(render_frame_host_id_)));
+ GetLastCommittedURLForFrame(render_frame_host_id_).GetOrigin()));
if (!sinks_observer->Init()) {
url_to_sinks_observer_.erase(source.id());
@@ -548,10 +550,9 @@ void PresentationFrameManager::SetDefaultPresentationUrls(
ClearDefaultPresentationRequest();
} else {
DCHECK(!callback.is_null());
- const auto& frame_origin =
- GetLastCommittedURLForFrame(render_frame_host_id);
+ GURL frame_url(GetLastCommittedURLForFrame(render_frame_host_id));
PresentationRequest request(render_frame_host_id, default_presentation_urls,
- frame_origin);
+ frame_url);
default_presentation_started_callback_ = callback;
SetDefaultPresentationRequest(request);
}
@@ -804,8 +805,8 @@ void PresentationServiceDelegateImpl::JoinSession(
return;
}
- const url::Origin& origin = GetLastCommittedURLForFrame(
- RenderFrameHostId(render_process_id, render_frame_id));
+ const url::Origin& origin = url::Origin(GetLastCommittedURLForFrame(
+ RenderFrameHostId(render_process_id, render_frame_id)));
#if !defined(OS_ANDROID)
if (IsAutoJoinPresentationId(presentation_id) &&
@@ -826,7 +827,7 @@ void PresentationServiceDelegateImpl::JoinSession(
weak_factory_.GetWeakPtr(), render_process_id, render_frame_id,
presentation_url, presentation_id, success_cb, error_cb));
router_->JoinRoute(MediaSourceForPresentationUrl(presentation_url).id(),
- presentation_id, origin, web_contents_,
+ presentation_id, origin.GetURL(), web_contents_,
route_response_callbacks, base::TimeDelta(), incognito);
}

Powered by Google App Engine
This is Rietveld 408576698