| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/webui/media_router/media_router_ui.h" | 5 #include "chrome/browser/ui/webui/media_router/media_router_ui.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <unordered_map> | 9 #include <unordered_map> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 this); | 196 this); |
| 197 // If |create_session_request_| still exists, then it means presentation route | 197 // If |create_session_request_| still exists, then it means presentation route |
| 198 // request was never attempted. | 198 // request was never attempted. |
| 199 if (create_session_request_) { | 199 if (create_session_request_) { |
| 200 bool presentation_sinks_available = std::any_of( | 200 bool presentation_sinks_available = std::any_of( |
| 201 sinks_.begin(), sinks_.end(), [](const MediaSinkWithCastModes& sink) { | 201 sinks_.begin(), sinks_.end(), [](const MediaSinkWithCastModes& sink) { |
| 202 return base::ContainsValue(sink.cast_modes, MediaCastMode::DEFAULT); | 202 return base::ContainsValue(sink.cast_modes, MediaCastMode::DEFAULT); |
| 203 }); | 203 }); |
| 204 if (presentation_sinks_available) { | 204 if (presentation_sinks_available) { |
| 205 create_session_request_->InvokeErrorCallback(content::PresentationError( | 205 create_session_request_->InvokeErrorCallback(content::PresentationError( |
| 206 content::PRESENTATION_ERROR_SESSION_REQUEST_CANCELLED, | 206 content::PRESENTATION_ERROR_PRESENTATION_REQUEST_CANCELLED, |
| 207 "Dialog closed.")); | 207 "Dialog closed.")); |
| 208 } else { | 208 } else { |
| 209 create_session_request_->InvokeErrorCallback(content::PresentationError( | 209 create_session_request_->InvokeErrorCallback(content::PresentationError( |
| 210 content::PRESENTATION_ERROR_NO_AVAILABLE_SCREENS, | 210 content::PRESENTATION_ERROR_NO_AVAILABLE_SCREENS, |
| 211 "No screens found.")); | 211 "No screens found.")); |
| 212 } | 212 } |
| 213 } | 213 } |
| 214 } | 214 } |
| 215 | 215 |
| 216 void MediaRouterUI::InitWithDefaultMediaSource( | 216 void MediaRouterUI::InitWithDefaultMediaSource( |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 } | 761 } |
| 762 | 762 |
| 763 std::string MediaRouterUI::GetSerializedInitiatorOrigin() const { | 763 std::string MediaRouterUI::GetSerializedInitiatorOrigin() const { |
| 764 url::Origin origin = initiator_ | 764 url::Origin origin = initiator_ |
| 765 ? url::Origin(initiator_->GetLastCommittedURL()) | 765 ? url::Origin(initiator_->GetLastCommittedURL()) |
| 766 : url::Origin(); | 766 : url::Origin(); |
| 767 return origin.Serialize(); | 767 return origin.Serialize(); |
| 768 } | 768 } |
| 769 | 769 |
| 770 } // namespace media_router | 770 } // namespace media_router |
| OLD | NEW |