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

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

Issue 2108973002: [Media Router] Return NotFoundError on dialog exit if appropriate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 | « no previous file | 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 c5572be8d05e283ea506b6bbc59239c35aca9810..882839d990d6a2546ed4411d7dd47a981dc6dffa 100644
--- a/chrome/browser/ui/webui/media_router/media_router_ui.cc
+++ b/chrome/browser/ui/webui/media_router/media_router_ui.cc
@@ -203,11 +203,23 @@ MediaRouterUI::~MediaRouterUI() {
presentation_service_delegate_->RemoveDefaultPresentationRequestObserver(
this);
// If |create_session_request_| still exists, then it means presentation route
- // request was never attempted.
+ // request was never attempted. This could be because the dialog defaults to
imcheng 2016/06/29 17:28:03 nit: I would just leave out the part about default
btolsch 2016/06/30 07:29:16 Done.
+ // mirroring when no devices support the presentation url.
if (create_session_request_) {
- create_session_request_->InvokeErrorCallback(content::PresentationError(
- content::PRESENTATION_ERROR_SESSION_REQUEST_CANCELLED,
- "Dialog closed."));
+ bool presentation_sinks_available = std::any_of(
+ sinks_.begin(), sinks_.end(), [](const MediaSinkWithCastModes& sink) {
+ return sink.cast_modes.find(MediaCastMode::DEFAULT) !=
imcheng 2016/06/29 17:28:03 nit: return sink.cast_modes.ContainsValue(MediaCas
btolsch 2016/06/30 07:29:16 Done.
imcheng 2016/06/30 18:24:46 Thanks. Apologies for suggesting the wrong syntax
+ sink.cast_modes.end();
+ });
+ if (presentation_sinks_available) {
+ create_session_request_->InvokeErrorCallback(content::PresentationError(
+ content::PRESENTATION_ERROR_SESSION_REQUEST_CANCELLED,
+ "Dialog closed."));
+ } else {
+ create_session_request_->InvokeErrorCallback(content::PresentationError(
+ content::PRESENTATION_ERROR_NO_AVAILABLE_SCREENS,
+ "No screens found."));
+ }
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698