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

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

Issue 1911183002: [Media Router] Implement an internal Media Routes observer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/mojo/media_router_mojo_impl.cc
diff --git a/chrome/browser/media/router/mojo/media_router_mojo_impl.cc b/chrome/browser/media/router/mojo/media_router_mojo_impl.cc
index af1fe22694b3cf2f536cdfca80f816c6278c6d64..710e0bd479bfc547d7e9778303688ce5bef738f7 100644
--- a/chrome/browser/media/router/mojo/media_router_mojo_impl.cc
+++ b/chrome/browser/media/router/mojo/media_router_mojo_impl.cc
@@ -290,8 +290,6 @@ void MediaRouterMojoImpl::RouteResponseReceived(
} else {
result = RouteRequestResult::FromSuccess(
media_route.To<std::unique_ptr<MediaRoute>>(), presentation_id);
- if (result->route()->off_the_record())
- OnOffTheRecordRouteCreated(result->route()->media_route_id());
}
// TODO(imcheng): Add UMA histogram based on result code (crbug.com/583044).
@@ -336,12 +334,21 @@ void MediaRouterMojoImpl::JoinRoute(
bool off_the_record) {
DCHECK(thread_checker_.CalledOnValidThread());
+ std::unique_ptr<RouteRequestResult> error_result;
if (!origin.is_valid()) {
DVLOG_WITH_INSTANCE(1) << "Invalid origin: " << origin;
- std::unique_ptr<RouteRequestResult> result = RouteRequestResult::FromError(
+ error_result = RouteRequestResult::FromError(
"Invalid origin", RouteRequestResult::INVALID_ORIGIN);
+ }
+
+ if (!HasLocalRoute()) {
+ error_result = RouteRequestResult::FromError(
+ "Route not found", RouteRequestResult::ROUTE_NOT_FOUND);
+ }
+
+ if (error_result) {
for (const MediaRouteResponseCallback& callback : callbacks)
- callback.Run(*result);
+ callback.Run(*error_result);
return;
}
@@ -659,7 +666,6 @@ void MediaRouterMojoImpl::DoConnectRouteByRouteId(
void MediaRouterMojoImpl::DoTerminateRoute(const MediaRoute::Id& route_id) {
DVLOG_WITH_INSTANCE(1) << "DoTerminateRoute " << route_id;
media_route_provider_->TerminateRoute(route_id);
- OnRouteTerminated(route_id);
}
void MediaRouterMojoImpl::DoDetachRoute(const MediaRoute::Id& route_id) {

Powered by Google App Engine
This is Rietveld 408576698