OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/options/chromeos/internet_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/chromeos/internet_options_handler.h" |
6 | 6 |
7 #include <ctype.h> | 7 #include <ctype.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 } | 239 } |
240 | 240 |
241 scoped_ptr<base::DictionaryValue> PopulateConnectionDetails( | 241 scoped_ptr<base::DictionaryValue> PopulateConnectionDetails( |
242 const NetworkState* network, | 242 const NetworkState* network, |
243 const base::DictionaryValue& onc_properties) { | 243 const base::DictionaryValue& onc_properties) { |
244 scoped_ptr<base::DictionaryValue> dictionary(onc_properties.DeepCopy()); | 244 scoped_ptr<base::DictionaryValue> dictionary(onc_properties.DeepCopy()); |
245 | 245 |
246 // Append Service Path for now. | 246 // Append Service Path for now. |
247 dictionary->SetString(kNetworkInfoKeyServicePath, network->path()); | 247 dictionary->SetString(kNetworkInfoKeyServicePath, network->path()); |
248 // Append a Chrome specific translated error message. | 248 // Append a Chrome specific translated error message. |
249 dictionary->SetString( | 249 dictionary->SetString(kTagErrorMessage, |
250 kTagErrorMessage, | 250 ash::NetworkConnect::Get()->GetErrorString( |
251 ash::network_connect::ErrorString(network->error(), network->path())); | 251 network->error(), network->path())); |
252 | 252 |
253 return dictionary.Pass(); | 253 return dictionary.Pass(); |
254 } | 254 } |
255 | 255 |
256 // Helper methods for SetIPConfigProperties | 256 // Helper methods for SetIPConfigProperties |
257 bool AppendPropertyKeyIfPresent(const std::string& key, | 257 bool AppendPropertyKeyIfPresent(const std::string& key, |
258 const base::DictionaryValue& old_properties, | 258 const base::DictionaryValue& old_properties, |
259 std::vector<std::string>* property_keys) { | 259 std::vector<std::string>* property_keys) { |
260 if (old_properties.HasKey(key)) { | 260 if (old_properties.HasKey(key)) { |
261 property_keys->push_back(key); | 261 property_keys->push_back(key); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 | 390 |
391 void InternetOptionsHandler::ShowMorePlanInfoCallback( | 391 void InternetOptionsHandler::ShowMorePlanInfoCallback( |
392 const base::ListValue* args) { | 392 const base::ListValue* args) { |
393 if (!web_ui()) | 393 if (!web_ui()) |
394 return; | 394 return; |
395 std::string service_path; | 395 std::string service_path; |
396 if (args->GetSize() != 1 || !args->GetString(0, &service_path)) { | 396 if (args->GetSize() != 1 || !args->GetString(0, &service_path)) { |
397 NOTREACHED(); | 397 NOTREACHED(); |
398 return; | 398 return; |
399 } | 399 } |
400 ash::network_connect::ShowMobileSetup(service_path); | 400 ash::NetworkConnect::Get()->ShowMobileSetup(service_path); |
401 } | 401 } |
402 | 402 |
403 void InternetOptionsHandler::SetApnCallback(const base::ListValue* args) { | 403 void InternetOptionsHandler::SetApnCallback(const base::ListValue* args) { |
404 std::string service_path; | 404 std::string service_path; |
405 if (!args->GetString(0, &service_path)) { | 405 if (!args->GetString(0, &service_path)) { |
406 NOTREACHED(); | 406 NOTREACHED(); |
407 return; | 407 return; |
408 } | 408 } |
409 NetworkHandler::Get()->network_configuration_handler()->GetProperties( | 409 NetworkHandler::Get()->network_configuration_handler()->GetProperties( |
410 service_path, | 410 service_path, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 } | 460 } |
461 | 461 |
462 void InternetOptionsHandler::CarrierStatusCallback() { | 462 void InternetOptionsHandler::CarrierStatusCallback() { |
463 NetworkStateHandler* handler = NetworkHandler::Get()->network_state_handler(); | 463 NetworkStateHandler* handler = NetworkHandler::Get()->network_state_handler(); |
464 const DeviceState* device = | 464 const DeviceState* device = |
465 handler->GetDeviceStateByType(NetworkTypePattern::Cellular()); | 465 handler->GetDeviceStateByType(NetworkTypePattern::Cellular()); |
466 if (device && (device->carrier() == shill::kCarrierSprint)) { | 466 if (device && (device->carrier() == shill::kCarrierSprint)) { |
467 const NetworkState* network = | 467 const NetworkState* network = |
468 handler->FirstNetworkByType(NetworkTypePattern::Cellular()); | 468 handler->FirstNetworkByType(NetworkTypePattern::Cellular()); |
469 if (network && network->path() == details_path_) { | 469 if (network && network->path() == details_path_) { |
470 ash::network_connect::ActivateCellular(network->path()); | 470 ash::NetworkConnect::Get()->ActivateCellular(network->path()); |
471 UpdateConnectionData(network->path()); | 471 UpdateConnectionData(network->path()); |
472 } | 472 } |
473 } | 473 } |
474 UpdateCarrier(); | 474 UpdateCarrier(); |
475 } | 475 } |
476 | 476 |
477 void InternetOptionsHandler::SetCarrierCallback(const base::ListValue* args) { | 477 void InternetOptionsHandler::SetCarrierCallback(const base::ListValue* args) { |
478 std::string service_path; | 478 std::string service_path; |
479 std::string carrier; | 479 std::string carrier; |
480 if (args->GetSize() != 2 || | 480 if (args->GetSize() != 2 || |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 const base::ListValue* args) { | 579 const base::ListValue* args) { |
580 NetworkHandler::Get()->network_state_handler()->RequestScan(); | 580 NetworkHandler::Get()->network_state_handler()->RequestScan(); |
581 } | 581 } |
582 | 582 |
583 void InternetOptionsHandler::StartConnectCallback(const base::ListValue* args) { | 583 void InternetOptionsHandler::StartConnectCallback(const base::ListValue* args) { |
584 std::string service_path; | 584 std::string service_path; |
585 if (!args->GetString(0, &service_path)) { | 585 if (!args->GetString(0, &service_path)) { |
586 NOTREACHED(); | 586 NOTREACHED(); |
587 return; | 587 return; |
588 } | 588 } |
589 ash::network_connect::ConnectToNetwork(service_path); | 589 ash::NetworkConnect::Get()->ConnectToNetwork(service_path); |
590 } | 590 } |
591 | 591 |
592 void InternetOptionsHandler::StartDisconnectCallback( | 592 void InternetOptionsHandler::StartDisconnectCallback( |
593 const base::ListValue* args) { | 593 const base::ListValue* args) { |
594 std::string service_path; | 594 std::string service_path; |
595 if (!args->GetString(0, &service_path)) { | 595 if (!args->GetString(0, &service_path)) { |
596 NOTREACHED(); | 596 NOTREACHED(); |
597 return; | 597 return; |
598 } | 598 } |
599 NetworkHandler::Get()->network_connection_handler()->DisconnectNetwork( | 599 NetworkHandler::Get()->network_connection_handler()->DisconnectNetwork( |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 NetworkHandler::Get()->network_configuration_handler()-> | 885 NetworkHandler::Get()->network_configuration_handler()-> |
886 RemoveConfiguration( | 886 RemoveConfiguration( |
887 service_path, | 887 service_path, |
888 base::Bind(&base::DoNothing), | 888 base::Bind(&base::DoNothing), |
889 base::Bind(&ShillError, "NetworkCommand: " + command)); | 889 base::Bind(&ShillError, "NetworkCommand: " + command)); |
890 } else if (command == kTagShowDetails) { | 890 } else if (command == kTagShowDetails) { |
891 SendShowDetailedInfo(service_path); | 891 SendShowDetailedInfo(service_path); |
892 } else if (command == kTagConfigure) { | 892 } else if (command == kTagConfigure) { |
893 NetworkConfigView::Show(service_path, GetNativeWindow()); | 893 NetworkConfigView::Show(service_path, GetNativeWindow()); |
894 } else if (command == kTagActivate && type == shill::kTypeCellular) { | 894 } else if (command == kTagActivate && type == shill::kTypeCellular) { |
895 ash::network_connect::ActivateCellular(service_path); | 895 ash::NetworkConnect::Get()->ActivateCellular(service_path); |
896 // Activation may update network properties (e.g. ActivationState), so | 896 // Activation may update network properties (e.g. ActivationState), so |
897 // request them here in case they change. | 897 // request them here in case they change. |
898 UpdateConnectionData(service_path); | 898 UpdateConnectionData(service_path); |
899 } else { | 899 } else { |
900 LOG(ERROR) << "Unknown internet options command: " << command; | 900 LOG(ERROR) << "Unknown internet options command: " << command; |
901 NOTREACHED(); | 901 NOTREACHED(); |
902 } | 902 } |
903 } | 903 } |
904 | 904 |
905 void InternetOptionsHandler::AddConnection(const std::string& type) { | 905 void InternetOptionsHandler::AddConnection(const std::string& type) { |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1031 dictionary->SetBoolean( | 1031 dictionary->SetBoolean( |
1032 kTagWimaxAvailable, | 1032 kTagWimaxAvailable, |
1033 handler->IsTechnologyAvailable(NetworkTypePattern::Wimax())); | 1033 handler->IsTechnologyAvailable(NetworkTypePattern::Wimax())); |
1034 dictionary->SetBoolean( | 1034 dictionary->SetBoolean( |
1035 kTagWimaxEnabled, | 1035 kTagWimaxEnabled, |
1036 handler->IsTechnologyEnabled(NetworkTypePattern::Wimax())); | 1036 handler->IsTechnologyEnabled(NetworkTypePattern::Wimax())); |
1037 } | 1037 } |
1038 | 1038 |
1039 } // namespace options | 1039 } // namespace options |
1040 } // namespace chromeos | 1040 } // namespace chromeos |
OLD | NEW |