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

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

Issue 2060433004: [Media Router] Close dialog after resolving presentation request (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 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
« no previous file with comments | « chrome/browser/ui/webui/media_router/media_router_ui.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 bb045896b2dbbab917e2daab026bbe6732e93690..0f7f1918bb39ab52f821946ba4286f59c6a8db50 100644
--- a/chrome/browser/ui/webui/media_router/media_router_ui.cc
+++ b/chrome/browser/ui/webui/media_router/media_router_ui.cc
@@ -400,21 +400,23 @@ bool MediaRouterUI::SetRouteParameters(
DVLOG(1) << "DoCreateRoute: origin: " << *origin;
- // There are 3 cases. In all cases the MediaRouterUI will need to be notified.
+ // There are 3 cases. In cases (1) and (3) the MediaRouterUI will need to be
+ // notified. In case (2) the dialog will be closed.
// (1) Non-presentation route request (e.g., mirroring). No additional
// notification necessary.
// (2) Presentation route request for a Presentation API startSession call.
// The startSession (CreatePresentationConnectionRequest) will need to be
- // answered with the
- // route response.
+ // answered with the route response.
// (3) Browser-initiated presentation route request. If successful,
// PresentationServiceDelegateImpl will have to be notified. Note that we
// treat subsequent route requests from a Presentation API-initiated dialogs
// as browser-initiated.
- route_response_callbacks->push_back(base::Bind(
- &MediaRouterUI::OnRouteResponseReceived, weak_factory_.GetWeakPtr(),
- current_route_request_id_, sink_id, cast_mode,
- base::UTF8ToUTF16(GetTruncatedPresentationRequestSourceName())));
+ if (!for_default_source || !create_session_request_) {
+ route_response_callbacks->push_back(base::Bind(
+ &MediaRouterUI::OnRouteResponseReceived, weak_factory_.GetWeakPtr(),
+ current_route_request_id_, sink_id, cast_mode,
+ base::UTF8ToUTF16(GetTruncatedPresentationRequestSourceName())));
+ }
if (for_default_source) {
if (create_session_request_) {
// |create_session_request_| will be nullptr after this call, as the
@@ -422,6 +424,9 @@ bool MediaRouterUI::SetRouteParameters(
route_response_callbacks->push_back(
base::Bind(&CreatePresentationConnectionRequest::HandleRouteResponse,
base::Passed(&create_session_request_)));
+ route_response_callbacks->push_back(
+ base::Bind(&MediaRouterUI::HandleCreateSessionRequestRouteResponse,
+ weak_factory_.GetWeakPtr()));
} else if (presentation_service_delegate_) {
route_response_callbacks->push_back(
base::Bind(&PresentationServiceDelegateImpl::OnRouteResponse,
@@ -543,6 +548,11 @@ void MediaRouterUI::OnRouteResponseReceived(
SendIssueForRouteTimeout(cast_mode, presentation_request_source_name);
}
+void MediaRouterUI::HandleCreateSessionRequestRouteResponse(
+ const RouteRequestResult&) {
+ Close();
+}
+
void MediaRouterUI::OnSearchSinkResponseReceived(
MediaCastMode cast_mode,
const MediaSink::Id& found_sink_id) {
« no previous file with comments | « chrome/browser/ui/webui/media_router/media_router_ui.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698