| 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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 base::DictionaryValue initial_data; | 402 base::DictionaryValue initial_data; |
| 403 | 403 |
| 404 // "No Cast devices found?" Chromecast help center page. | 404 // "No Cast devices found?" Chromecast help center page. |
| 405 initial_data.SetString("deviceMissingUrl", | 405 initial_data.SetString("deviceMissingUrl", |
| 406 base::StringPrintf(kHelpPageUrlPrefix, 3249268)); | 406 base::StringPrintf(kHelpPageUrlPrefix, 3249268)); |
| 407 | 407 |
| 408 std::unique_ptr<base::DictionaryValue> sinks_and_identity( | 408 std::unique_ptr<base::DictionaryValue> sinks_and_identity( |
| 409 SinksAndIdentityToValue(media_router_ui_->sinks(), GetAccountInfo())); | 409 SinksAndIdentityToValue(media_router_ui_->sinks(), GetAccountInfo())); |
| 410 initial_data.Set("sinksAndIdentity", sinks_and_identity.release()); | 410 initial_data.Set("sinksAndIdentity", sinks_and_identity.release()); |
| 411 | 411 |
| 412 std::unique_ptr<base::ListValue> routes(RoutesToValue( | |
| 413 media_router_ui_->routes(), media_router_ui_->joinable_route_ids(), | |
| 414 media_router_ui_->current_cast_modes())); | |
| 415 initial_data.Set("routes", routes.release()); | |
| 416 | |
| 417 const std::set<MediaCastMode> cast_modes = media_router_ui_->cast_modes(); | 412 const std::set<MediaCastMode> cast_modes = media_router_ui_->cast_modes(); |
| 418 std::unique_ptr<base::ListValue> cast_modes_list(CastModesToValue( | 413 std::unique_ptr<base::ListValue> cast_modes_list(CastModesToValue( |
| 419 cast_modes, media_router_ui_->GetPresentationRequestSourceName())); | 414 cast_modes, media_router_ui_->GetPresentationRequestSourceName())); |
| 420 initial_data.Set("castModes", cast_modes_list.release()); | 415 initial_data.Set("castModes", cast_modes_list.release()); |
| 421 | 416 |
| 422 web_ui()->CallJavascriptFunctionUnsafe(kSetInitialData, initial_data); | 417 web_ui()->CallJavascriptFunctionUnsafe(kSetInitialData, initial_data); |
| 423 media_router_ui_->UIInitialized(); | 418 media_router_ui_->UIInitialized(); |
| 424 } | 419 } |
| 425 | 420 |
| 426 void MediaRouterWebUIMessageHandler::OnCreateRoute( | 421 void MediaRouterWebUIMessageHandler::OnCreateRoute( |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 880 } | 875 } |
| 881 | 876 |
| 882 return value; | 877 return value; |
| 883 } | 878 } |
| 884 | 879 |
| 885 void MediaRouterWebUIMessageHandler::SetWebUIForTest(content::WebUI* web_ui) { | 880 void MediaRouterWebUIMessageHandler::SetWebUIForTest(content::WebUI* web_ui) { |
| 886 set_web_ui(web_ui); | 881 set_web_ui(web_ui); |
| 887 } | 882 } |
| 888 | 883 |
| 889 } // namespace media_router | 884 } // namespace media_router |
| OLD | NEW |