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; | |
535 if (!service_path.empty()) | |
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; | |
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 | |
552 if (device->technology_family() == chromeos::TECHNOLOGY_FAMILY_GSM) | |
Greg Spencer (Chromium)
2013/01/09 19:34:32
Why do we need to check this if we then check for
rkc
2013/01/09 22:19:14
You're right, the check is superfluous, removed.
D
| |
553 return false; | |
554 if (device->carrier() == shill::kCarrierSprint) | |
555 return true; | |
556 return false; | |
557 } | |
558 | |
528 // Given a list of supported carrier's by the device, return the index of | 559 // Given a list of supported carrier's by the device, return the index of |
529 // the carrier the device is currently using. | 560 // the carrier the device is currently using. |
530 int FindCurrentCarrierIndex(const base::ListValue* carriers, | 561 int FindCurrentCarrierIndex(const base::ListValue* carriers, |
531 const chromeos::NetworkDevice* device) { | 562 const chromeos::NetworkDevice* device) { |
532 DCHECK(carriers); | 563 DCHECK(carriers); |
533 DCHECK(device); | 564 DCHECK(device); |
534 | 565 |
535 bool gsm = (device->technology_family() == chromeos::TECHNOLOGY_FAMILY_GSM); | 566 bool gsm = (device->technology_family() == chromeos::TECHNOLOGY_FAMILY_GSM); |
536 int index = 0; | 567 int index = 0; |
537 for (base::ListValue::const_iterator it = carriers->begin(); | 568 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()); | 1015 return web_ui_util::GetBitmapDataUrl(image_rep.sk_bitmap()); |
985 } | 1016 } |
986 | 1017 |
987 void InternetOptionsHandler::RefreshNetworkData() { | 1018 void InternetOptionsHandler::RefreshNetworkData() { |
988 DictionaryValue dictionary; | 1019 DictionaryValue dictionary; |
989 FillNetworkInfo(&dictionary); | 1020 FillNetworkInfo(&dictionary); |
990 web_ui()->CallJavascriptFunction( | 1021 web_ui()->CallJavascriptFunction( |
991 kRefreshNetworkDataFunction, dictionary); | 1022 kRefreshNetworkDataFunction, dictionary); |
992 } | 1023 } |
993 | 1024 |
1025 void InternetOptionsHandler::UpdateConnectionData( | |
1026 const chromeos::Network* network) { | |
1027 DictionaryValue dictionary; | |
1028 PopulateConnectionDetails(network, &dictionary); | |
1029 web_ui()->CallJavascriptFunction( | |
1030 kUpdateConnectionDataFunction, dictionary); | |
1031 } | |
1032 | |
994 void InternetOptionsHandler::UpdateCarrier(bool success) { | 1033 void InternetOptionsHandler::UpdateCarrier(bool success) { |
995 base::FundamentalValue success_value(success); | 1034 base::FundamentalValue success_value(success); |
996 web_ui()->CallJavascriptFunction(kUpdateCarrierFunction, success_value); | 1035 web_ui()->CallJavascriptFunction(kUpdateCarrierFunction, success_value); |
997 } | 1036 } |
998 | 1037 |
999 void InternetOptionsHandler::OnNetworkManagerChanged( | 1038 void InternetOptionsHandler::OnNetworkManagerChanged( |
1000 chromeos::NetworkLibrary* cros) { | 1039 chromeos::NetworkLibrary* cros) { |
1001 if (!web_ui()) | 1040 if (!web_ui()) |
1002 return; | 1041 return; |
1003 MonitorNetworks(); | 1042 MonitorNetworks(); |
1004 RefreshNetworkData(); | 1043 RefreshNetworkData(); |
1005 } | 1044 } |
1006 | 1045 |
1007 void InternetOptionsHandler::OnNetworkChanged( | 1046 void InternetOptionsHandler::OnNetworkChanged( |
1008 chromeos::NetworkLibrary* cros, | 1047 chromeos::NetworkLibrary* cros, |
1009 const chromeos::Network* network) { | 1048 const chromeos::Network* network) { |
1010 if (web_ui()) | 1049 if (web_ui()) { |
1011 RefreshNetworkData(); | 1050 RefreshNetworkData(); |
1051 UpdateConnectionData(network); | |
1052 } | |
1012 } | 1053 } |
1013 | 1054 |
1014 // Monitor wireless networks for changes. It is only necessary | 1055 // Monitor wireless networks for changes. It is only necessary |
1015 // to set up individual observers for the cellular networks | 1056 // to set up individual observers for the cellular networks |
1016 // (if any) and for the connected Wi-Fi network (if any). The | 1057 // (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 | 1058 // only change we are interested in for Wi-Fi networks is signal |
1018 // strength. For non-connected Wi-Fi networks, all information is | 1059 // strength. For non-connected Wi-Fi networks, all information is |
1019 // reported via scan results, which trigger network manager | 1060 // reported via scan results, which trigger network manager |
1020 // updates. Only the connected Wi-Fi network has changes reported | 1061 // updates. Only the connected Wi-Fi network has changes reported |
1021 // via service property updates. | 1062 // via service property updates. |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1275 // then just go with some defaults. | 1316 // then just go with some defaults. |
1276 dictionary.SetBoolean(kIpConfigAutoConfig, false); | 1317 dictionary.SetBoolean(kIpConfigAutoConfig, false); |
1277 dictionary.Set(kDictionarySavedIp, new DictionaryValue); | 1318 dictionary.Set(kDictionarySavedIp, new DictionaryValue); |
1278 SetValueDictionary(&dictionary, kDictionaryStaticIp, new DictionaryValue, | 1319 SetValueDictionary(&dictionary, kDictionaryStaticIp, new DictionaryValue, |
1279 property_ui_data); | 1320 property_ui_data); |
1280 } | 1321 } |
1281 | 1322 |
1282 chromeos::ConnectionType type = network->type(); | 1323 chromeos::ConnectionType type = network->type(); |
1283 dictionary.SetInteger(kTagType, type); | 1324 dictionary.SetInteger(kTagType, type); |
1284 dictionary.SetString(kTagServicePath, network->service_path()); | 1325 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); | 1326 dictionary.SetString(kTagNameServerType, name_server_type); |
1290 dictionary.SetString(kTagNameServersGoogle, kGoogleNameServers); | 1327 dictionary.SetString(kTagNameServersGoogle, kGoogleNameServers); |
1291 | 1328 |
1292 // Only show proxy for remembered networks. | 1329 // Only show proxy for remembered networks. |
1293 chromeos::NetworkProfileType network_profile = network->profile_type(); | 1330 chromeos::NetworkProfileType network_profile = network->profile_type(); |
1294 dictionary.SetBoolean(kTagShowProxy, | 1331 dictionary.SetBoolean(kTagShowProxy, |
1295 network_profile != chromeos::PROFILE_NONE); | 1332 network_profile != chromeos::PROFILE_NONE); |
1296 | 1333 |
1297 // Enable static ip config for ethernet. For wifi, enable if flag is set. | 1334 // Enable static ip config for ethernet. For wifi, enable if flag is set. |
1298 bool staticIPConfig = type == chromeos::TYPE_ETHERNET || | 1335 bool staticIPConfig = type == chromeos::TYPE_ETHERNET || |
(...skipping 13 matching lines...) Expand all Loading... | |
1312 auto_connect_ui_data.ParseOncProperty( | 1349 auto_connect_ui_data.ParseOncProperty( |
1313 ui_data, onc, | 1350 ui_data, onc, |
1314 base::StringPrintf("%s.%s", | 1351 base::StringPrintf("%s.%s", |
1315 chromeos::onc::kWiFi, | 1352 chromeos::onc::kWiFi, |
1316 chromeos::onc::wifi::kAutoConnect)); | 1353 chromeos::onc::wifi::kAutoConnect)); |
1317 } | 1354 } |
1318 SetValueDictionary(&dictionary, kTagAutoConnect, | 1355 SetValueDictionary(&dictionary, kTagAutoConnect, |
1319 new base::FundamentalValue(network->auto_connect()), | 1356 new base::FundamentalValue(network->auto_connect()), |
1320 auto_connect_ui_data); | 1357 auto_connect_ui_data); |
1321 | 1358 |
1322 if (type == chromeos::TYPE_WIFI) { | 1359 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( | 1360 web_ui()->CallJavascriptFunction( |
1346 kShowDetailedInfoFunction, dictionary); | 1361 kShowDetailedInfoFunction, dictionary); |
1347 } | 1362 } |
1348 | 1363 |
1364 void InternetOptionsHandler::PopulateConnectionDetails( | |
1365 const chromeos::Network* network, DictionaryValue* dictionary) { | |
1366 chromeos::ConnectionType type = network->type(); | |
1367 dictionary->SetBoolean(kTagConnecting, network->connecting()); | |
1368 dictionary->SetBoolean(kTagConnected, network->connected()); | |
1369 dictionary->SetString(kTagConnectionState, network->GetStateString()); | |
1370 dictionary->SetString(kTagNetworkName, network->name()); | |
1371 | |
1372 if (type == chromeos::TYPE_WIFI) { | |
1373 dictionary->SetBoolean(kTagDeviceConnected, cros_->wifi_connected()); | |
1374 PopulateWifiDetails(static_cast<const chromeos::WifiNetwork*>(network), | |
1375 dictionary); | |
1376 } else if (type == chromeos::TYPE_WIMAX) { | |
1377 dictionary->SetBoolean(kTagDeviceConnected, cros_->wimax_connected()); | |
1378 PopulateWimaxDetails(static_cast<const chromeos::WimaxNetwork*>(network), | |
1379 dictionary); | |
1380 } else if (type == chromeos::TYPE_CELLULAR) { | |
1381 dictionary->SetBoolean(kTagDeviceConnected, cros_->cellular_connected()); | |
1382 PopulateCellularDetails( | |
1383 static_cast<const chromeos::CellularNetwork*>(network), | |
1384 dictionary); | |
1385 } else if (type == chromeos::TYPE_VPN) { | |
1386 dictionary->SetBoolean(kTagDeviceConnected, | |
1387 cros_->virtual_network_connected()); | |
1388 const base::DictionaryValue* onc = | |
1389 cros_->FindOncForNetwork(network->unique_id()); | |
1390 PopulateVPNDetails(static_cast<const chromeos::VirtualNetwork*>(network), | |
1391 *onc, | |
1392 dictionary); | |
1393 } else if (type == chromeos::TYPE_ETHERNET) { | |
1394 dictionary->SetBoolean(kTagDeviceConnected, cros_->ethernet_connected()); | |
1395 } | |
1396 } | |
1397 | |
1349 void InternetOptionsHandler::PopulateWifiDetails( | 1398 void InternetOptionsHandler::PopulateWifiDetails( |
1350 const chromeos::WifiNetwork* wifi, | 1399 const chromeos::WifiNetwork* wifi, |
1351 DictionaryValue* dictionary) { | 1400 DictionaryValue* dictionary) { |
1352 dictionary->SetString(kTagSsid, wifi->name()); | 1401 dictionary->SetString(kTagSsid, wifi->name()); |
1353 bool remembered = (wifi->profile_type() != chromeos::PROFILE_NONE); | 1402 bool remembered = (wifi->profile_type() != chromeos::PROFILE_NONE); |
1354 dictionary->SetBoolean(kTagRemembered, remembered); | 1403 dictionary->SetBoolean(kTagRemembered, remembered); |
1355 bool shared = wifi->profile_type() == chromeos::PROFILE_SHARED; | 1404 bool shared = wifi->profile_type() == chromeos::PROFILE_SHARED; |
1356 dictionary->SetBoolean(kTagShared, shared); | 1405 dictionary->SetBoolean(kTagShared, shared); |
1357 dictionary->SetString(kTagEncryption, wifi->GetEncryptionString()); | 1406 dictionary->SetString(kTagEncryption, wifi->GetEncryptionString()); |
1358 dictionary->SetString(kTagBssid, wifi->bssid()); | 1407 dictionary->SetString(kTagBssid, wifi->bssid()); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1468 FindCurrentCarrierIndex(supported_carriers, | 1517 FindCurrentCarrierIndex(supported_carriers, |
1469 device)); | 1518 device)); |
1470 } else { | 1519 } else { |
1471 // In case of any error, set the current carrier tag to -1 indicating | 1520 // In case of any error, set the current carrier tag to -1 indicating |
1472 // to the JS code to fallback to a single carrier. | 1521 // to the JS code to fallback to a single carrier. |
1473 dictionary->SetInteger(kTagCurrentCarrierIndex, -1); | 1522 dictionary->SetInteger(kTagCurrentCarrierIndex, -1); |
1474 } | 1523 } |
1475 } | 1524 } |
1476 } | 1525 } |
1477 | 1526 |
1478 SetActivationButtonVisibility(cellular, | 1527 SetCellularButtonsVisibility(cellular, |
1479 dictionary, | 1528 dictionary, |
1480 cros_->GetCellularHomeCarrierId()); | 1529 cros_->GetCellularHomeCarrierId()); |
1481 } | 1530 } |
1482 | 1531 |
1483 void InternetOptionsHandler::SetActivationButtonVisibility( | 1532 void InternetOptionsHandler::SetCellularButtonsVisibility( |
1484 const chromeos::CellularNetwork* cellular, | 1533 const chromeos::CellularNetwork* cellular, |
1485 DictionaryValue* dictionary, | 1534 DictionaryValue* dictionary, |
1486 const std::string& carrier_id) { | 1535 const std::string& carrier_id) { |
1536 if (cellular->activation_state() == chromeos::ACTIVATION_STATE_ACTIVATING || | |
1537 cellular->connecting()) { | |
1538 dictionary->SetBoolean(kTagDisableConnectButton, true); | |
1539 } else { | |
1540 dictionary->SetBoolean(kTagDisableConnectButton, false); | |
1541 } | |
1542 | |
1487 if (cellular->activation_state() != chromeos::ACTIVATION_STATE_ACTIVATING && | 1543 if (cellular->activation_state() != chromeos::ACTIVATION_STATE_ACTIVATING && |
1488 cellular->activation_state() != chromeos::ACTIVATION_STATE_ACTIVATED) { | 1544 cellular->activation_state() != chromeos::ACTIVATION_STATE_ACTIVATED) { |
1489 dictionary->SetBoolean(kTagShowActivateButton, true); | 1545 dictionary->SetBoolean(kTagShowActivateButton, true); |
1490 } else { | 1546 } else { |
1491 const chromeos::MobileConfig::Carrier* carrier = | 1547 const chromeos::MobileConfig::Carrier* carrier = |
1492 chromeos::MobileConfig::GetInstance()->GetCarrier(carrier_id); | 1548 chromeos::MobileConfig::GetInstance()->GetCarrier(carrier_id); |
1493 if (carrier && carrier->show_portal_button()) { | 1549 if (carrier && carrier->show_portal_button()) { |
1494 // This will trigger BuyDataPlanCallback() so that | 1550 // This will trigger BuyDataPlanCallback() so that |
1495 // chrome://mobilesetup/ will open carrier specific portal. | 1551 // chrome://mobilesetup/ will open carrier specific portal. |
1496 dictionary->SetBoolean(kTagShowViewAccountButton, true); | 1552 dictionary->SetBoolean(kTagShowViewAccountButton, true); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1555 if (command == kTagOptions) { | 1611 if (command == kTagOptions) { |
1556 cros_->RequestNetworkServiceProperties( | 1612 cros_->RequestNetworkServiceProperties( |
1557 service_path, | 1613 service_path, |
1558 base::Bind(&InternetOptionsHandler::PopulateDictionaryDetailsCallback, | 1614 base::Bind(&InternetOptionsHandler::PopulateDictionaryDetailsCallback, |
1559 weak_factory_.GetWeakPtr())); | 1615 weak_factory_.GetWeakPtr())); |
1560 } else if (command == kTagConnect) { | 1616 } else if (command == kTagConnect) { |
1561 ConnectToNetwork(network); | 1617 ConnectToNetwork(network); |
1562 } else if (command == kTagDisconnect && type != chromeos::TYPE_ETHERNET) { | 1618 } else if (command == kTagDisconnect && type != chromeos::TYPE_ETHERNET) { |
1563 cros_->DisconnectFromNetwork(network); | 1619 cros_->DisconnectFromNetwork(network); |
1564 } else if (command == kTagActivate && type == chromeos::TYPE_CELLULAR) { | 1620 } else if (command == kTagActivate && type == chromeos::TYPE_CELLULAR) { |
1565 ash::Shell::GetInstance()->delegate()->OpenMobileSetup( | 1621 if (!UseDirectActivation()) { |
1566 network->service_path()); | 1622 ash::Shell::GetInstance()->delegate()->OpenMobileSetup( |
1623 network->service_path()); | |
1624 } else { | |
1625 Activate(service_path); | |
1626 // Update network properties after we start activation. The Activate | |
1627 // call is a blocking call, which blocks on finishing the "start" of | |
1628 // the activation, hence when we query for network properties after | |
1629 // this call is done, we will have the "activating" activation state. | |
1630 UpdateConnectionData(network); | |
1631 } | |
1567 } else { | 1632 } else { |
1568 VLOG(1) << "Unknown command: " << command; | 1633 VLOG(1) << "Unknown command: " << command; |
1569 NOTREACHED(); | 1634 NOTREACHED(); |
1570 } | 1635 } |
1571 } | 1636 } |
1572 | 1637 |
1573 void InternetOptionsHandler::ToggleAirplaneModeCallback(const ListValue* args) { | 1638 void InternetOptionsHandler::ToggleAirplaneModeCallback(const ListValue* args) { |
1574 // TODO(kevers): The use of 'offline_mode' is not quite correct. Update once | 1639 // TODO(kevers): The use of 'offline_mode' is not quite correct. Update once |
1575 // we have proper back-end support. | 1640 // we have proper back-end support. |
1576 cros_->EnableOfflineMode(!cros_->offline_mode()); | 1641 cros_->EnableOfflineMode(!cros_->offline_mode()); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1760 | 1825 |
1761 dictionary->SetBoolean(kTagWimaxEnabled, cros_->wimax_enabled()); | 1826 dictionary->SetBoolean(kTagWimaxEnabled, cros_->wimax_enabled()); |
1762 dictionary->SetBoolean(kTagWimaxAvailable, cros_->wimax_available()); | 1827 dictionary->SetBoolean(kTagWimaxAvailable, cros_->wimax_available()); |
1763 dictionary->SetBoolean(kTagWimaxBusy, cros_->wimax_busy()); | 1828 dictionary->SetBoolean(kTagWimaxBusy, cros_->wimax_busy()); |
1764 // TODO(kevers): The use of 'offline_mode' is not quite correct. Update once | 1829 // TODO(kevers): The use of 'offline_mode' is not quite correct. Update once |
1765 // we have proper back-end support. | 1830 // we have proper back-end support. |
1766 dictionary->SetBoolean(kTagAirplaneMode, cros_->offline_mode()); | 1831 dictionary->SetBoolean(kTagAirplaneMode, cros_->offline_mode()); |
1767 } | 1832 } |
1768 | 1833 |
1769 } // namespace options | 1834 } // namespace options |
OLD | NEW |