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 <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 #ifndef NDEBUG | 142 #ifndef NDEBUG |
143 for (const MediaRoute& existing_route : routes_for_display) { | 143 for (const MediaRoute& existing_route : routes_for_display) { |
144 if (existing_route.media_sink_id() == route.media_sink_id()) { | 144 if (existing_route.media_sink_id() == route.media_sink_id()) { |
145 DVLOG(2) << "Received another route for display with the same sink" | 145 DVLOG(2) << "Received another route for display with the same sink" |
146 << " id as an existing route. " << route.media_route_id() | 146 << " id as an existing route. " << route.media_route_id() |
147 << " has the same sink id as " | 147 << " has the same sink id as " |
148 << existing_route.media_sink_id() << "."; | 148 << existing_route.media_sink_id() << "."; |
149 } | 149 } |
150 } | 150 } |
151 #endif | 151 #endif |
152 if (ContainsValue(joinable_route_ids, route.media_route_id())) { | 152 if (base::ContainsValue(joinable_route_ids, route.media_route_id())) { |
153 joinable_route_ids_for_display.push_back(route.media_route_id()); | 153 joinable_route_ids_for_display.push_back(route.media_route_id()); |
154 } | 154 } |
155 | 155 |
156 routes_for_display.push_back(route); | 156 routes_for_display.push_back(route); |
157 } | 157 } |
158 } | 158 } |
159 | 159 |
160 callback_.Run(routes_for_display, joinable_route_ids_for_display); | 160 callback_.Run(routes_for_display, joinable_route_ids_for_display); |
161 } | 161 } |
162 | 162 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 | 200 |
201 if (query_result_manager_.get()) query_result_manager_->RemoveObserver(this); | 201 if (query_result_manager_.get()) query_result_manager_->RemoveObserver(this); |
202 if (presentation_service_delegate_.get()) | 202 if (presentation_service_delegate_.get()) |
203 presentation_service_delegate_->RemoveDefaultPresentationRequestObserver( | 203 presentation_service_delegate_->RemoveDefaultPresentationRequestObserver( |
204 this); | 204 this); |
205 // If |create_session_request_| still exists, then it means presentation route | 205 // If |create_session_request_| still exists, then it means presentation route |
206 // request was never attempted. | 206 // request was never attempted. |
207 if (create_session_request_) { | 207 if (create_session_request_) { |
208 bool presentation_sinks_available = std::any_of( | 208 bool presentation_sinks_available = std::any_of( |
209 sinks_.begin(), sinks_.end(), [](const MediaSinkWithCastModes& sink) { | 209 sinks_.begin(), sinks_.end(), [](const MediaSinkWithCastModes& sink) { |
210 return ContainsValue(sink.cast_modes, MediaCastMode::DEFAULT); | 210 return base::ContainsValue(sink.cast_modes, MediaCastMode::DEFAULT); |
211 }); | 211 }); |
212 if (presentation_sinks_available) { | 212 if (presentation_sinks_available) { |
213 create_session_request_->InvokeErrorCallback(content::PresentationError( | 213 create_session_request_->InvokeErrorCallback(content::PresentationError( |
214 content::PRESENTATION_ERROR_SESSION_REQUEST_CANCELLED, | 214 content::PRESENTATION_ERROR_SESSION_REQUEST_CANCELLED, |
215 "Dialog closed.")); | 215 "Dialog closed.")); |
216 } else { | 216 } else { |
217 create_session_request_->InvokeErrorCallback(content::PresentationError( | 217 create_session_request_->InvokeErrorCallback(content::PresentationError( |
218 content::PRESENTATION_ERROR_NO_AVAILABLE_SCREENS, | 218 content::PRESENTATION_ERROR_NO_AVAILABLE_SCREENS, |
219 "No screens found.")); | 219 "No screens found.")); |
220 } | 220 } |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 base::Time::Now() - start_time_); | 698 base::Time::Now() - start_time_); |
699 start_time_ = base::Time(); | 699 start_time_ = base::Time(); |
700 } | 700 } |
701 } | 701 } |
702 | 702 |
703 void MediaRouterUI::UpdateMaxDialogHeight(int height) { | 703 void MediaRouterUI::UpdateMaxDialogHeight(int height) { |
704 handler_->UpdateMaxDialogHeight(height); | 704 handler_->UpdateMaxDialogHeight(height); |
705 } | 705 } |
706 | 706 |
707 } // namespace media_router | 707 } // namespace media_router |
OLD | NEW |