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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 // Google public name servers (DNS). | 105 // Google public name servers (DNS). |
106 const char kGoogleNameServers[] = "8.8.4.4,8.8.8.8"; | 106 const char kGoogleNameServers[] = "8.8.4.4,8.8.8.8"; |
107 | 107 |
108 // Functions we call in JavaScript. | 108 // Functions we call in JavaScript. |
109 const char kRefreshNetworkDataFunction[] = | 109 const char kRefreshNetworkDataFunction[] = |
110 "options.network.NetworkList.refreshNetworkData"; | 110 "options.network.NetworkList.refreshNetworkData"; |
111 const char kSetDefaultNetworkIconsFunction[] = | 111 const char kSetDefaultNetworkIconsFunction[] = |
112 "options.network.NetworkList.setDefaultNetworkIcons"; | 112 "options.network.NetworkList.setDefaultNetworkIcons"; |
113 const char kShowDetailedInfoFunction[] = | 113 const char kShowDetailedInfoFunction[] = |
114 "options.internet.DetailsInternetPage.showDetailedInfo"; | 114 "options.internet.DetailsInternetPage.showDetailedInfo"; |
115 const char kUpdateConnectionDataFunction[] = | |
116 "options.internet.DetailsInternetPage.updateConnectionData"; | |
115 const char kUpdateCarrierFunction[] = | 117 const char kUpdateCarrierFunction[] = |
116 "options.internet.DetailsInternetPage.updateCarrier"; | 118 "options.internet.DetailsInternetPage.updateCarrier"; |
117 const char kUpdateSecurityTabFunction[] = | 119 const char kUpdateSecurityTabFunction[] = |
118 "options.internet.DetailsInternetPage.updateSecurityTab"; | 120 "options.internet.DetailsInternetPage.updateSecurityTab"; |
119 | 121 |
120 // These are used to register message handlers with JavaScript. | 122 // These are used to register message handlers with JavaScript. |
121 const char kBuyDataPlanMessage[] = "buyDataPlan"; | 123 const char kBuyDataPlanMessage[] = "buyDataPlan"; |
122 const char kChangePinMessage[] = "changePin"; | 124 const char kChangePinMessage[] = "changePin"; |
123 const char kDisableCellularMessage[] = "disableCellular"; | 125 const char kDisableCellularMessage[] = "disableCellular"; |
124 const char kDisableWifiMessage[] = "disableWifi"; | 126 const char kDisableWifiMessage[] = "disableWifi"; |
(...skipping 29 matching lines...) Expand all Loading... | |
154 const char kTagCellularBusy[] = "cellularBusy"; | 156 const char kTagCellularBusy[] = "cellularBusy"; |
155 const char kTagCellularEnabled[] = "cellularEnabled"; | 157 const char kTagCellularEnabled[] = "cellularEnabled"; |
156 const char kTagCellularSupportsScan[] = "cellularSupportsScan"; | 158 const char kTagCellularSupportsScan[] = "cellularSupportsScan"; |
157 const char kTagConnect[] = "connect"; | 159 const char kTagConnect[] = "connect"; |
158 const char kTagConnected[] = "connected"; | 160 const char kTagConnected[] = "connected"; |
159 const char kTagConnecting[] = "connecting"; | 161 const char kTagConnecting[] = "connecting"; |
160 const char kTagConnectionState[] = "connectionState"; | 162 const char kTagConnectionState[] = "connectionState"; |
161 const char kTagControlledBy[] = "controlledBy"; | 163 const char kTagControlledBy[] = "controlledBy"; |
162 const char kTagDataRemaining[] = "dataRemaining"; | 164 const char kTagDataRemaining[] = "dataRemaining"; |
163 const char kTagDeviceConnected[] = "deviceConnected"; | 165 const char kTagDeviceConnected[] = "deviceConnected"; |
166 const char kTagDisableConnectButton[] = "disableConnectButton"; | |
164 const char kTagDisconnect[] = "disconnect"; | 167 const char kTagDisconnect[] = "disconnect"; |
165 const char kTagEncryption[] = "encryption"; | 168 const char kTagEncryption[] = "encryption"; |
166 const char kTagErrorState[] = "errorState"; | 169 const char kTagErrorState[] = "errorState"; |
167 const char kTagEsn[] = "esn"; | 170 const char kTagEsn[] = "esn"; |
168 const char kTagFirmwareRevision[] = "firmwareRevision"; | 171 const char kTagFirmwareRevision[] = "firmwareRevision"; |
169 const char kTagForget[] = "forget"; | 172 const char kTagForget[] = "forget"; |
170 const char kTagFrequency[] = "frequency"; | 173 const char kTagFrequency[] = "frequency"; |
171 const char kTagGsm[] = "gsm"; | 174 const char kTagGsm[] = "gsm"; |
172 const char kTagHardwareAddress[] = "hardwareAddress"; | 175 const char kTagHardwareAddress[] = "hardwareAddress"; |
173 const char kTagHardwareRevision[] = "hardwareRevision"; | 176 const char kTagHardwareRevision[] = "hardwareRevision"; |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
518 hostname_ui_data.ParseOncProperty( | 521 hostname_ui_data.ParseOncProperty( |
519 vpn->ui_data(), &onc, | 522 vpn->ui_data(), &onc, |
520 base::StringPrintf("%s.%s", | 523 base::StringPrintf("%s.%s", |
521 chromeos::onc::kVPN, | 524 chromeos::onc::kVPN, |
522 chromeos::onc::vpn::kHost)); | 525 chromeos::onc::vpn::kHost)); |
523 SetValueDictionary(dictionary, kTagServerHostname, | 526 SetValueDictionary(dictionary, kTagServerHostname, |
524 new base::StringValue(vpn->server_hostname()), | 527 new base::StringValue(vpn->server_hostname()), |
525 hostname_ui_data); | 528 hostname_ui_data); |
526 } | 529 } |
527 | 530 |
531 // Activate the cellular device pointed to by the service path. | |
532 void Activate(std::string service_path) { | |
533 DCHECK(!service_path.empty()); | |
534 chromeos::Network *network = NULL; | |
Evan Stade
2013/01/09 23:24:08
asterisk before space
rkc
2013/01/09 23:34:35
Done.
| |
535 if (!service_path.empty()) | |
Evan Stade
2013/01/09 23:24:08
curlies
rkc
2013/01/09 23:34:35
Done.
| |
536 network = chromeos::CrosLibrary::Get()->GetNetworkLibrary()-> | |
537 FindNetworkByPath(service_path); | |
538 if (network->type() != chromeos::TYPE_CELLULAR) | |
539 return; | |
540 chromeos::CellularNetwork* cell_network = | |
541 (chromeos::CellularNetwork*) network; | |
Evan Stade
2013/01/09 23:24:08
use c++ style casts
rkc
2013/01/09 23:34:35
Done.
| |
542 cell_network->StartActivation(); | |
543 } | |
544 | |
545 // Check if the current cellular device can be activated by directly calling | |
546 // it's activate function instead of going through the activation process. | |
547 // Note: Currently Sprint is the only carrier that uses this. | |
548 bool UseDirectActivation() { | |
549 const chromeos::NetworkDevice* device = | |
550 chromeos::CrosLibrary::Get()->GetNetworkLibrary()->FindCellularDevice(); | |
551 if (device->carrier() == shill::kCarrierSprint) | |
Evan Stade
2013/01/09 23:24:08
nit: return device->carrier() == shill::kCarrierSp
rkc
2013/01/09 23:34:35
Fixed an unlikely but possible bug also.
Done.
| |
552 return true; | |
553 return false; | |
554 } | |
555 | |
528 // Given a list of supported carrier's by the device, return the index of | 556 // Given a list of supported carrier's by the device, return the index of |
529 // the carrier the device is currently using. | 557 // the carrier the device is currently using. |
530 int FindCurrentCarrierIndex(const base::ListValue* carriers, | 558 int FindCurrentCarrierIndex(const base::ListValue* carriers, |
531 const chromeos::NetworkDevice* device) { | 559 const chromeos::NetworkDevice* device) { |
532 DCHECK(carriers); | 560 DCHECK(carriers); |
533 DCHECK(device); | 561 DCHECK(device); |
534 | 562 |
535 bool gsm = (device->technology_family() == chromeos::TECHNOLOGY_FAMILY_GSM); | 563 bool gsm = (device->technology_family() == chromeos::TECHNOLOGY_FAMILY_GSM); |
536 int index = 0; | 564 int index = 0; |
537 for (base::ListValue::const_iterator it = carriers->begin(); | 565 for (base::ListValue::const_iterator it = carriers->begin(); |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
984 return web_ui_util::GetBitmapDataUrl(image_rep.sk_bitmap()); | 1012 return web_ui_util::GetBitmapDataUrl(image_rep.sk_bitmap()); |
985 } | 1013 } |
986 | 1014 |
987 void InternetOptionsHandler::RefreshNetworkData() { | 1015 void InternetOptionsHandler::RefreshNetworkData() { |
988 DictionaryValue dictionary; | 1016 DictionaryValue dictionary; |
989 FillNetworkInfo(&dictionary); | 1017 FillNetworkInfo(&dictionary); |
990 web_ui()->CallJavascriptFunction( | 1018 web_ui()->CallJavascriptFunction( |
991 kRefreshNetworkDataFunction, dictionary); | 1019 kRefreshNetworkDataFunction, dictionary); |
992 } | 1020 } |
993 | 1021 |
1022 void InternetOptionsHandler::UpdateConnectionData( | |
1023 const chromeos::Network* network) { | |
1024 DictionaryValue dictionary; | |
1025 PopulateConnectionDetails(network, &dictionary); | |
1026 web_ui()->CallJavascriptFunction( | |
1027 kUpdateConnectionDataFunction, dictionary); | |
1028 } | |
1029 | |
994 void InternetOptionsHandler::UpdateCarrier(bool success) { | 1030 void InternetOptionsHandler::UpdateCarrier(bool success) { |
995 base::FundamentalValue success_value(success); | 1031 base::FundamentalValue success_value(success); |
996 web_ui()->CallJavascriptFunction(kUpdateCarrierFunction, success_value); | 1032 web_ui()->CallJavascriptFunction(kUpdateCarrierFunction, success_value); |
997 } | 1033 } |
998 | 1034 |
999 void InternetOptionsHandler::OnNetworkManagerChanged( | 1035 void InternetOptionsHandler::OnNetworkManagerChanged( |
1000 chromeos::NetworkLibrary* cros) { | 1036 chromeos::NetworkLibrary* cros) { |
1001 if (!web_ui()) | 1037 if (!web_ui()) |
1002 return; | 1038 return; |
1003 MonitorNetworks(); | 1039 MonitorNetworks(); |
1004 RefreshNetworkData(); | 1040 RefreshNetworkData(); |
1005 } | 1041 } |
1006 | 1042 |
1007 void InternetOptionsHandler::OnNetworkChanged( | 1043 void InternetOptionsHandler::OnNetworkChanged( |
1008 chromeos::NetworkLibrary* cros, | 1044 chromeos::NetworkLibrary* cros, |
1009 const chromeos::Network* network) { | 1045 const chromeos::Network* network) { |
1010 if (web_ui()) | 1046 if (web_ui()) { |
1011 RefreshNetworkData(); | 1047 RefreshNetworkData(); |
1048 UpdateConnectionData(network); | |
1049 } | |
1012 } | 1050 } |
1013 | 1051 |
1014 // Monitor wireless networks for changes. It is only necessary | 1052 // Monitor wireless networks for changes. It is only necessary |
1015 // to set up individual observers for the cellular networks | 1053 // to set up individual observers for the cellular networks |
1016 // (if any) and for the connected Wi-Fi network (if any). The | 1054 // (if any) and for the connected Wi-Fi network (if any). The |
1017 // only change we are interested in for Wi-Fi networks is signal | 1055 // only change we are interested in for Wi-Fi networks is signal |
1018 // strength. For non-connected Wi-Fi networks, all information is | 1056 // strength. For non-connected Wi-Fi networks, all information is |
1019 // reported via scan results, which trigger network manager | 1057 // reported via scan results, which trigger network manager |
1020 // updates. Only the connected Wi-Fi network has changes reported | 1058 // updates. Only the connected Wi-Fi network has changes reported |
1021 // via service property updates. | 1059 // via service property updates. |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1275 // then just go with some defaults. | 1313 // then just go with some defaults. |
1276 dictionary.SetBoolean(kIpConfigAutoConfig, false); | 1314 dictionary.SetBoolean(kIpConfigAutoConfig, false); |
1277 dictionary.Set(kDictionarySavedIp, new DictionaryValue); | 1315 dictionary.Set(kDictionarySavedIp, new DictionaryValue); |
1278 SetValueDictionary(&dictionary, kDictionaryStaticIp, new DictionaryValue, | 1316 SetValueDictionary(&dictionary, kDictionaryStaticIp, new DictionaryValue, |
1279 property_ui_data); | 1317 property_ui_data); |
1280 } | 1318 } |
1281 | 1319 |
1282 chromeos::ConnectionType type = network->type(); | 1320 chromeos::ConnectionType type = network->type(); |
1283 dictionary.SetInteger(kTagType, type); | 1321 dictionary.SetInteger(kTagType, type); |
1284 dictionary.SetString(kTagServicePath, network->service_path()); | 1322 dictionary.SetString(kTagServicePath, network->service_path()); |
1285 dictionary.SetBoolean(kTagConnecting, network->connecting()); | |
1286 dictionary.SetBoolean(kTagConnected, network->connected()); | |
1287 dictionary.SetString(kTagConnectionState, network->GetStateString()); | |
1288 dictionary.SetString(kTagNetworkName, network->name()); | |
1289 dictionary.SetString(kTagNameServerType, name_server_type); | 1323 dictionary.SetString(kTagNameServerType, name_server_type); |
1290 dictionary.SetString(kTagNameServersGoogle, kGoogleNameServers); | 1324 dictionary.SetString(kTagNameServersGoogle, kGoogleNameServers); |
1291 | 1325 |
1292 // Only show proxy for remembered networks. | 1326 // Only show proxy for remembered networks. |
1293 chromeos::NetworkProfileType network_profile = network->profile_type(); | 1327 chromeos::NetworkProfileType network_profile = network->profile_type(); |
1294 dictionary.SetBoolean(kTagShowProxy, | 1328 dictionary.SetBoolean(kTagShowProxy, |
1295 network_profile != chromeos::PROFILE_NONE); | 1329 network_profile != chromeos::PROFILE_NONE); |
1296 | 1330 |
1297 // Enable static ip config for ethernet. For wifi, enable if flag is set. | 1331 // Enable static ip config for ethernet. For wifi, enable if flag is set. |
1298 bool staticIPConfig = type == chromeos::TYPE_ETHERNET || | 1332 bool staticIPConfig = type == chromeos::TYPE_ETHERNET || |
(...skipping 13 matching lines...) Expand all Loading... | |
1312 auto_connect_ui_data.ParseOncProperty( | 1346 auto_connect_ui_data.ParseOncProperty( |
1313 ui_data, onc, | 1347 ui_data, onc, |
1314 base::StringPrintf("%s.%s", | 1348 base::StringPrintf("%s.%s", |
1315 chromeos::onc::kWiFi, | 1349 chromeos::onc::kWiFi, |
1316 chromeos::onc::wifi::kAutoConnect)); | 1350 chromeos::onc::wifi::kAutoConnect)); |
1317 } | 1351 } |
1318 SetValueDictionary(&dictionary, kTagAutoConnect, | 1352 SetValueDictionary(&dictionary, kTagAutoConnect, |
1319 new base::FundamentalValue(network->auto_connect()), | 1353 new base::FundamentalValue(network->auto_connect()), |
1320 auto_connect_ui_data); | 1354 auto_connect_ui_data); |
1321 | 1355 |
1322 if (type == chromeos::TYPE_WIFI) { | 1356 PopulateConnectionDetails(network, &dictionary); |
1323 dictionary.SetBoolean(kTagDeviceConnected, cros_->wifi_connected()); | |
1324 PopulateWifiDetails(static_cast<const chromeos::WifiNetwork*>(network), | |
1325 &dictionary); | |
1326 } else if (type == chromeos::TYPE_WIMAX) { | |
1327 dictionary.SetBoolean(kTagDeviceConnected, cros_->wimax_connected()); | |
1328 PopulateWimaxDetails(static_cast<const chromeos::WimaxNetwork*>(network), | |
1329 &dictionary); | |
1330 } else if (type == chromeos::TYPE_CELLULAR) { | |
1331 dictionary.SetBoolean(kTagDeviceConnected, cros_->cellular_connected()); | |
1332 PopulateCellularDetails( | |
1333 static_cast<const chromeos::CellularNetwork*>(network), | |
1334 &dictionary); | |
1335 } else if (type == chromeos::TYPE_VPN) { | |
1336 dictionary.SetBoolean(kTagDeviceConnected, | |
1337 cros_->virtual_network_connected()); | |
1338 PopulateVPNDetails(static_cast<const chromeos::VirtualNetwork*>(network), | |
1339 *onc, | |
1340 &dictionary); | |
1341 } else if (type == chromeos::TYPE_ETHERNET) { | |
1342 dictionary.SetBoolean(kTagDeviceConnected, cros_->ethernet_connected()); | |
1343 } | |
1344 | |
1345 web_ui()->CallJavascriptFunction( | 1357 web_ui()->CallJavascriptFunction( |
1346 kShowDetailedInfoFunction, dictionary); | 1358 kShowDetailedInfoFunction, dictionary); |
1347 } | 1359 } |
1348 | 1360 |
1361 void InternetOptionsHandler::PopulateConnectionDetails( | |
1362 const chromeos::Network* network, DictionaryValue* dictionary) { | |
1363 chromeos::ConnectionType type = network->type(); | |
1364 dictionary->SetBoolean(kTagConnecting, network->connecting()); | |
1365 dictionary->SetBoolean(kTagConnected, network->connected()); | |
1366 dictionary->SetString(kTagConnectionState, network->GetStateString()); | |
1367 dictionary->SetString(kTagNetworkName, network->name()); | |
1368 | |
1369 if (type == chromeos::TYPE_WIFI) { | |
1370 dictionary->SetBoolean(kTagDeviceConnected, cros_->wifi_connected()); | |
1371 PopulateWifiDetails(static_cast<const chromeos::WifiNetwork*>(network), | |
1372 dictionary); | |
1373 } else if (type == chromeos::TYPE_WIMAX) { | |
1374 dictionary->SetBoolean(kTagDeviceConnected, cros_->wimax_connected()); | |
1375 PopulateWimaxDetails(static_cast<const chromeos::WimaxNetwork*>(network), | |
1376 dictionary); | |
1377 } else if (type == chromeos::TYPE_CELLULAR) { | |
1378 dictionary->SetBoolean(kTagDeviceConnected, cros_->cellular_connected()); | |
1379 PopulateCellularDetails( | |
1380 static_cast<const chromeos::CellularNetwork*>(network), | |
1381 dictionary); | |
1382 } else if (type == chromeos::TYPE_VPN) { | |
1383 dictionary->SetBoolean(kTagDeviceConnected, | |
1384 cros_->virtual_network_connected()); | |
1385 const base::DictionaryValue* onc = | |
1386 cros_->FindOncForNetwork(network->unique_id()); | |
1387 PopulateVPNDetails(static_cast<const chromeos::VirtualNetwork*>(network), | |
1388 *onc, | |
1389 dictionary); | |
1390 } else if (type == chromeos::TYPE_ETHERNET) { | |
1391 dictionary->SetBoolean(kTagDeviceConnected, cros_->ethernet_connected()); | |
1392 } | |
1393 } | |
1394 | |
1349 void InternetOptionsHandler::PopulateWifiDetails( | 1395 void InternetOptionsHandler::PopulateWifiDetails( |
1350 const chromeos::WifiNetwork* wifi, | 1396 const chromeos::WifiNetwork* wifi, |
1351 DictionaryValue* dictionary) { | 1397 DictionaryValue* dictionary) { |
1352 dictionary->SetString(kTagSsid, wifi->name()); | 1398 dictionary->SetString(kTagSsid, wifi->name()); |
1353 bool remembered = (wifi->profile_type() != chromeos::PROFILE_NONE); | 1399 bool remembered = (wifi->profile_type() != chromeos::PROFILE_NONE); |
1354 dictionary->SetBoolean(kTagRemembered, remembered); | 1400 dictionary->SetBoolean(kTagRemembered, remembered); |
1355 bool shared = wifi->profile_type() == chromeos::PROFILE_SHARED; | 1401 bool shared = wifi->profile_type() == chromeos::PROFILE_SHARED; |
1356 dictionary->SetBoolean(kTagShared, shared); | 1402 dictionary->SetBoolean(kTagShared, shared); |
1357 dictionary->SetString(kTagEncryption, wifi->GetEncryptionString()); | 1403 dictionary->SetString(kTagEncryption, wifi->GetEncryptionString()); |
1358 dictionary->SetString(kTagBssid, wifi->bssid()); | 1404 dictionary->SetString(kTagBssid, wifi->bssid()); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1468 FindCurrentCarrierIndex(supported_carriers, | 1514 FindCurrentCarrierIndex(supported_carriers, |
1469 device)); | 1515 device)); |
1470 } else { | 1516 } else { |
1471 // In case of any error, set the current carrier tag to -1 indicating | 1517 // In case of any error, set the current carrier tag to -1 indicating |
1472 // to the JS code to fallback to a single carrier. | 1518 // to the JS code to fallback to a single carrier. |
1473 dictionary->SetInteger(kTagCurrentCarrierIndex, -1); | 1519 dictionary->SetInteger(kTagCurrentCarrierIndex, -1); |
1474 } | 1520 } |
1475 } | 1521 } |
1476 } | 1522 } |
1477 | 1523 |
1478 SetActivationButtonVisibility(cellular, | 1524 SetCellularButtonsVisibility(cellular, |
1479 dictionary, | 1525 dictionary, |
1480 cros_->GetCellularHomeCarrierId()); | 1526 cros_->GetCellularHomeCarrierId()); |
1481 } | 1527 } |
1482 | 1528 |
1483 void InternetOptionsHandler::SetActivationButtonVisibility( | 1529 void InternetOptionsHandler::SetCellularButtonsVisibility( |
1484 const chromeos::CellularNetwork* cellular, | 1530 const chromeos::CellularNetwork* cellular, |
1485 DictionaryValue* dictionary, | 1531 DictionaryValue* dictionary, |
1486 const std::string& carrier_id) { | 1532 const std::string& carrier_id) { |
1533 if (cellular->activation_state() == chromeos::ACTIVATION_STATE_ACTIVATING || | |
1534 cellular->connecting()) { | |
1535 dictionary->SetBoolean(kTagDisableConnectButton, true); | |
1536 } else { | |
1537 dictionary->SetBoolean(kTagDisableConnectButton, false); | |
1538 } | |
1539 | |
1487 if (cellular->activation_state() != chromeos::ACTIVATION_STATE_ACTIVATING && | 1540 if (cellular->activation_state() != chromeos::ACTIVATION_STATE_ACTIVATING && |
1488 cellular->activation_state() != chromeos::ACTIVATION_STATE_ACTIVATED) { | 1541 cellular->activation_state() != chromeos::ACTIVATION_STATE_ACTIVATED) { |
1489 dictionary->SetBoolean(kTagShowActivateButton, true); | 1542 dictionary->SetBoolean(kTagShowActivateButton, true); |
1490 } else { | 1543 } else { |
1491 const chromeos::MobileConfig::Carrier* carrier = | 1544 const chromeos::MobileConfig::Carrier* carrier = |
1492 chromeos::MobileConfig::GetInstance()->GetCarrier(carrier_id); | 1545 chromeos::MobileConfig::GetInstance()->GetCarrier(carrier_id); |
1493 if (carrier && carrier->show_portal_button()) { | 1546 if (carrier && carrier->show_portal_button()) { |
1494 // This will trigger BuyDataPlanCallback() so that | 1547 // This will trigger BuyDataPlanCallback() so that |
1495 // chrome://mobilesetup/ will open carrier specific portal. | 1548 // chrome://mobilesetup/ will open carrier specific portal. |
1496 dictionary->SetBoolean(kTagShowViewAccountButton, true); | 1549 dictionary->SetBoolean(kTagShowViewAccountButton, true); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1555 if (command == kTagOptions) { | 1608 if (command == kTagOptions) { |
1556 cros_->RequestNetworkServiceProperties( | 1609 cros_->RequestNetworkServiceProperties( |
1557 service_path, | 1610 service_path, |
1558 base::Bind(&InternetOptionsHandler::PopulateDictionaryDetailsCallback, | 1611 base::Bind(&InternetOptionsHandler::PopulateDictionaryDetailsCallback, |
1559 weak_factory_.GetWeakPtr())); | 1612 weak_factory_.GetWeakPtr())); |
1560 } else if (command == kTagConnect) { | 1613 } else if (command == kTagConnect) { |
1561 ConnectToNetwork(network); | 1614 ConnectToNetwork(network); |
1562 } else if (command == kTagDisconnect && type != chromeos::TYPE_ETHERNET) { | 1615 } else if (command == kTagDisconnect && type != chromeos::TYPE_ETHERNET) { |
1563 cros_->DisconnectFromNetwork(network); | 1616 cros_->DisconnectFromNetwork(network); |
1564 } else if (command == kTagActivate && type == chromeos::TYPE_CELLULAR) { | 1617 } else if (command == kTagActivate && type == chromeos::TYPE_CELLULAR) { |
1565 ash::Shell::GetInstance()->delegate()->OpenMobileSetup( | 1618 if (!UseDirectActivation()) { |
1566 network->service_path()); | 1619 ash::Shell::GetInstance()->delegate()->OpenMobileSetup( |
1620 network->service_path()); | |
1621 } else { | |
1622 Activate(service_path); | |
1623 // Update network properties after we start activation. The Activate | |
1624 // call is a blocking call, which blocks on finishing the "start" of | |
1625 // the activation, hence when we query for network properties after | |
1626 // this call is done, we will have the "activating" activation state. | |
1627 UpdateConnectionData(network); | |
1628 } | |
1567 } else { | 1629 } else { |
1568 VLOG(1) << "Unknown command: " << command; | 1630 VLOG(1) << "Unknown command: " << command; |
1569 NOTREACHED(); | 1631 NOTREACHED(); |
1570 } | 1632 } |
1571 } | 1633 } |
1572 | 1634 |
1573 void InternetOptionsHandler::ToggleAirplaneModeCallback(const ListValue* args) { | 1635 void InternetOptionsHandler::ToggleAirplaneModeCallback(const ListValue* args) { |
1574 // TODO(kevers): The use of 'offline_mode' is not quite correct. Update once | 1636 // TODO(kevers): The use of 'offline_mode' is not quite correct. Update once |
1575 // we have proper back-end support. | 1637 // we have proper back-end support. |
1576 cros_->EnableOfflineMode(!cros_->offline_mode()); | 1638 cros_->EnableOfflineMode(!cros_->offline_mode()); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1760 | 1822 |
1761 dictionary->SetBoolean(kTagWimaxEnabled, cros_->wimax_enabled()); | 1823 dictionary->SetBoolean(kTagWimaxEnabled, cros_->wimax_enabled()); |
1762 dictionary->SetBoolean(kTagWimaxAvailable, cros_->wimax_available()); | 1824 dictionary->SetBoolean(kTagWimaxAvailable, cros_->wimax_available()); |
1763 dictionary->SetBoolean(kTagWimaxBusy, cros_->wimax_busy()); | 1825 dictionary->SetBoolean(kTagWimaxBusy, cros_->wimax_busy()); |
1764 // TODO(kevers): The use of 'offline_mode' is not quite correct. Update once | 1826 // TODO(kevers): The use of 'offline_mode' is not quite correct. Update once |
1765 // we have proper back-end support. | 1827 // we have proper back-end support. |
1766 dictionary->SetBoolean(kTagAirplaneMode, cros_->offline_mode()); | 1828 dictionary->SetBoolean(kTagAirplaneMode, cros_->offline_mode()); |
1767 } | 1829 } |
1768 | 1830 |
1769 } // namespace options | 1831 } // namespace options |
OLD | NEW |