| 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_webui_message_handle
r.h" | 5 #include "chrome/browser/ui/webui/media_router/media_router_webui_message_handle
r.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 873 std::unique_ptr<base::ListValue> MediaRouterWebUIMessageHandler::RoutesToValue( | 873 std::unique_ptr<base::ListValue> MediaRouterWebUIMessageHandler::RoutesToValue( |
| 874 const std::vector<MediaRoute>& routes, | 874 const std::vector<MediaRoute>& routes, |
| 875 const std::vector<MediaRoute::Id>& joinable_route_ids, | 875 const std::vector<MediaRoute::Id>& joinable_route_ids, |
| 876 const std::unordered_map<MediaRoute::Id, MediaCastMode>& current_cast_modes) | 876 const std::unordered_map<MediaRoute::Id, MediaCastMode>& current_cast_modes) |
| 877 const { | 877 const { |
| 878 std::unique_ptr<base::ListValue> value(new base::ListValue); | 878 std::unique_ptr<base::ListValue> value(new base::ListValue); |
| 879 const std::string& extension_id = | 879 const std::string& extension_id = |
| 880 media_router_ui_->GetRouteProviderExtensionId(); | 880 media_router_ui_->GetRouteProviderExtensionId(); |
| 881 | 881 |
| 882 for (const MediaRoute& route : routes) { | 882 for (const MediaRoute& route : routes) { |
| 883 bool can_join = ContainsValue(joinable_route_ids, route.media_route_id()); | 883 bool can_join = |
| 884 base::ContainsValue(joinable_route_ids, route.media_route_id()); |
| 884 int current_cast_mode = CurrentCastModeForRouteId(route.media_route_id(), | 885 int current_cast_mode = CurrentCastModeForRouteId(route.media_route_id(), |
| 885 current_cast_modes); | 886 current_cast_modes); |
| 886 std::unique_ptr<base::DictionaryValue> route_val(RouteToValue( | 887 std::unique_ptr<base::DictionaryValue> route_val(RouteToValue( |
| 887 route, can_join, extension_id, incognito_, current_cast_mode)); | 888 route, can_join, extension_id, incognito_, current_cast_mode)); |
| 888 value->Append(std::move(route_val)); | 889 value->Append(std::move(route_val)); |
| 889 } | 890 } |
| 890 | 891 |
| 891 return value; | 892 return value; |
| 892 } | 893 } |
| 893 | 894 |
| 894 void MediaRouterWebUIMessageHandler::SetWebUIForTest(content::WebUI* web_ui) { | 895 void MediaRouterWebUIMessageHandler::SetWebUIForTest(content::WebUI* web_ui) { |
| 895 set_web_ui(web_ui); | 896 set_web_ui(web_ui); |
| 896 } | 897 } |
| 897 | 898 |
| 898 } // namespace media_router | 899 } // namespace media_router |
| OLD | NEW |