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

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

Issue 2627463003: Convert MediaRouter mojom apis to intake url::Origin objects instead of strings (Closed)
Patch Set: comment and ternary op 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 ba385dcebbcfb22ffd203b33dc3086aeb4549f2c..f7541b316e5ed530053e769c5d4369d6aed82bae 100644
--- a/chrome/browser/media/router/presentation_service_delegate_impl.cc
+++ b/chrome/browser/media/router/presentation_service_delegate_impl.cc
@@ -57,14 +57,12 @@ RenderFrameHostId GetRenderFrameHostId(RenderFrameHost* render_frame_host) {
// Gets the last committed URL for the render frame specified by
// |render_frame_host_id|.
-GURL GetLastCommittedURLForFrame(RenderFrameHostId render_frame_host_id) {
+url::Origin GetLastCommittedURLForFrame(
+ RenderFrameHostId render_frame_host_id) {
RenderFrameHost* render_frame_host = RenderFrameHost::FromID(
render_frame_host_id.first, render_frame_host_id.second);
- 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();
+ return render_frame_host ? render_frame_host->GetLastCommittedOrigin()
dcheng 2017/01/26 04:16:32 I was trying to figure out why |render_frame_host|
steimel 2017/01/27 00:28:59 Just had some offline discussion with mfoltz@ and
imcheng 2017/01/27 00:55:06 I think what dcheng@ is saying is the correspondin
imcheng 2017/01/27 01:04:36 Filed crbug.com/685879
dcheng 2017/01/27 09:11:11 So it sounds like for now, we still need the NULL
steimel 2017/01/27 18:55:19 Hmm so what's getting cleaned up? Do you mean remo
imcheng 2017/01/27 19:02:50 I do not think the nullptr check is necessary. To
+ : url::Origin();
}
// Observes messages originating from the MediaSink connected to a MediaRoute
@@ -236,7 +234,7 @@ bool PresentationFrame::SetScreenAvailabilityListener(
sinks_observer.reset(new PresentationMediaSinksObserver(
router_, listener, source,
- GetLastCommittedURLForFrame(render_frame_host_id_).GetOrigin()));
+ GetLastCommittedURLForFrame(render_frame_host_id_)));
if (!sinks_observer->Init()) {
url_to_sinks_observer_.erase(source.id());
@@ -560,9 +558,10 @@ void PresentationFrameManager::SetDefaultPresentationUrls(
ClearDefaultPresentationRequest();
} else {
DCHECK(!callback.is_null());
- GURL frame_url(GetLastCommittedURLForFrame(render_frame_host_id));
+ const auto& frame_origin =
+ GetLastCommittedURLForFrame(render_frame_host_id);
PresentationRequest request(render_frame_host_id, default_presentation_urls,
- frame_url);
+ frame_origin);
default_presentation_started_callback_ = callback;
SetDefaultPresentationRequest(request);
}
@@ -831,8 +830,8 @@ void PresentationServiceDelegateImpl::JoinSession(
return;
}
- const url::Origin& origin = url::Origin(GetLastCommittedURLForFrame(
- RenderFrameHostId(render_process_id, render_frame_id)));
+ const url::Origin& origin = GetLastCommittedURLForFrame(
+ RenderFrameHostId(render_process_id, render_frame_id));
#if !defined(OS_ANDROID)
if (IsAutoJoinPresentationId(presentation_id) &&
@@ -853,7 +852,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.GetURL(), web_contents_,
+ presentation_id, origin, web_contents_,
route_response_callbacks, base::TimeDelta(), incognito);
}

Powered by Google App Engine
This is Rietveld 408576698