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

Unified Diff: chrome/browser/ui/webui/media_router/media_router_ui.cc

Issue 1173753003: [Media Router] Implement JoinRoute + update CreateRoute API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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/ui/webui/media_router/media_router_ui.cc
diff --git a/chrome/browser/ui/webui/media_router/media_router_ui.cc b/chrome/browser/ui/webui/media_router/media_router_ui.cc
index d7b2b2a8703782158774c09624409c53e7caaffa..555ebaa6f460a183d05a31b23ad1bf57e4c63457 100644
--- a/chrome/browser/ui/webui/media_router/media_router_ui.cc
+++ b/chrome/browser/ui/webui/media_router/media_router_ui.cc
@@ -36,6 +36,8 @@ namespace media_router {
namespace {
std::string GetHostFromURL(const GURL& gurl) {
+ if (gurl.is_empty())
+ return std::string();
std::string host = gurl.host();
if (StartsWithASCII(host, "www.", false))
host = host.substr(4);
@@ -295,6 +297,7 @@ void MediaRouterUI::OnRouteResponseReceived(scoped_ptr<MediaRoute> route,
bool MediaRouterUI::DoCreateRoute(const MediaSink::Id& sink_id,
MediaCastMode cast_mode) {
DCHECK(query_result_manager_.get());
+ DCHECK(initiator_);
// Note that there is a rarely-encountered bug, where the MediaCastMode to
// MediaSource mapping could have been updated, between when the user
@@ -310,10 +313,23 @@ bool MediaRouterUI::DoCreateRoute(const MediaSink::Id& sink_id,
has_pending_route_request_ = true;
requesting_route_for_default_source_ = cast_mode == MediaCastMode::DEFAULT;
- router_->CreateRoute(source.id(), sink_id,
+ GURL origin;
+ // TODO(imcheng): What is the origin if not creating route in DEFAULT mode?
mark a. foltz 2015/06/10 23:18:51 If the user is e.g. initiating tab mirroring it sh
imcheng (use chromium acct) 2015/06/11 22:49:12 Done.
+ if (requesting_route_for_default_source_) {
+ origin = frame_url_.GetOrigin();
+ DCHECK(origin.is_valid());
+ }
+ DVLOG(1) << "DoCreateRoute: origin: " << origin;
+
+ router_->CreateRoute(source.id(), sink_id, origin,
+ SessionTabHelper::IdForTab(initiator_),
base::Bind(&MediaRouterUI::OnRouteResponseReceived,
weak_factory_.GetWeakPtr()));
return true;
}
+std::string MediaRouterUI::GetFrameURLHost() const {
+ return GetHostFromURL(frame_url_);
+}
+
} // namespace media_router

Powered by Google App Engine
This is Rietveld 408576698