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

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

Issue 1693963003: Pass origin to StartObservingMediaSinks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ready for Review Created 4 years, 10 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/media_router_mojo_impl.cc
diff --git a/chrome/browser/media/router/media_router_mojo_impl.cc b/chrome/browser/media/router/media_router_mojo_impl.cc
index f4dd4916ce6cdce4ca013c182c70381809feaa26..fae1167c7a3816f57ff1a8e5d664666808b9ae75 100644
--- a/chrome/browser/media/router/media_router_mojo_impl.cc
+++ b/chrome/browser/media/router/media_router_mojo_impl.cc
@@ -414,6 +414,8 @@ bool MediaRouterMojoImpl::RegisterMediaSinksObserver(
MediaSinksObserver* observer) {
DCHECK(thread_checker_.CalledOnValidThread());
+ const GURL& origin = observer->origin();
+ DCHECK(origin.is_valid());
mark a. foltz 2016/02/17 21:50:51 You might want to DCHECK or LOG(WARNING) that the
matt.boetger 2016/02/18 00:50:33 Done.
// Create an observer list for the media source and add |observer|
// to it. Fail if |observer| is already registered.
const std::string& source_id = observer->source().id();
@@ -422,11 +424,13 @@ bool MediaRouterMojoImpl::RegisterMediaSinksObserver(
if (!sinks_query) {
new_query = true;
sinks_query = new MediaSinksQuery;
+ sinks_query->origin = origin;
sinks_queries_.add(source_id, make_scoped_ptr(sinks_query));
} else {
DCHECK(!sinks_query->observers.HasObserver(observer));
}
+
mark a. foltz 2016/02/17 21:50:51 Extra newline
matt.boetger 2016/02/18 00:50:33 Done.
// If sink availability is UNAVAILABLE, then there is no need to call MRPM.
// |observer| can be immediately notified with an empty list.
sinks_query->observers.AddObserver(observer);
@@ -437,7 +441,7 @@ bool MediaRouterMojoImpl::RegisterMediaSinksObserver(
if (new_query) {
SetWakeReason(MediaRouteProviderWakeReason::START_OBSERVING_MEDIA_SINKS);
RunOrDefer(base::Bind(&MediaRouterMojoImpl::DoStartObservingMediaSinks,
- base::Unretained(this), source_id));
+ base::Unretained(this), source_id, origin));
} else if (sinks_query->has_cached_result) {
observer->OnSinksReceived(sinks_query->cached_sink_list);
}
@@ -746,7 +750,8 @@ void MediaRouterMojoImpl::OnSinkAvailabilityUpdated(
// Sinks are now available. Tell MRPM to start all sink queries again.
for (const auto& source_and_query : sinks_queries_) {
RunOrDefer(base::Bind(&MediaRouterMojoImpl::DoStartObservingMediaSinks,
- base::Unretained(this), source_and_query.first));
+ base::Unretained(this), source_and_query.first,
+ source_and_query.second->origin));
}
}
}
@@ -763,7 +768,8 @@ bool MediaRouterMojoImpl::HasLocalDisplayRoute() const {
}
void MediaRouterMojoImpl::DoStartObservingMediaSinks(
- const MediaSource::Id& source_id) {
+ const MediaSource::Id& source_id, const GURL& origin) {
+ DCHECK(origin.is_valid());
DVLOG_WITH_INSTANCE(1) << "DoStartObservingMediaSinks: " << source_id;
// No need to call MRPM if there are no sinks available.
if (availability_ == interfaces::MediaRouter::SinkAvailability::UNAVAILABLE)
@@ -775,7 +781,8 @@ void MediaRouterMojoImpl::DoStartObservingMediaSinks(
return;
DVLOG_WITH_INSTANCE(1) << "MRPM.StartObservingMediaSinks: " << source_id;
- media_route_provider_->StartObservingMediaSinks(source_id);
+ media_route_provider_->StartObservingMediaSinks(source_id,
+ origin.is_empty() ? "" : origin.spec());
sinks_query->is_active = true;
}

Powered by Google App Engine
This is Rietveld 408576698