Chromium Code Reviews| 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.")); |
| + } |
| } |
| } |