| 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 19 matching lines...) Expand all Loading... |
| 30 #include "chrome/browser/chromeos/cros/cros_library.h" | 30 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 31 #include "chrome/browser/chromeos/cros/network_library.h" | 31 #include "chrome/browser/chromeos/cros/network_library.h" |
| 32 #include "chrome/browser/chromeos/cros/network_property_ui_data.h" | 32 #include "chrome/browser/chromeos/cros/network_property_ui_data.h" |
| 33 #include "chrome/browser/chromeos/enrollment_dialog_view.h" | 33 #include "chrome/browser/chromeos/enrollment_dialog_view.h" |
| 34 #include "chrome/browser/chromeos/mobile_config.h" | 34 #include "chrome/browser/chromeos/mobile_config.h" |
| 35 #include "chrome/browser/chromeos/options/network_config_view.h" | 35 #include "chrome/browser/chromeos/options/network_config_view.h" |
| 36 #include "chrome/browser/chromeos/proxy_config_service_impl.h" | 36 #include "chrome/browser/chromeos/proxy_config_service_impl.h" |
| 37 #include "chrome/browser/chromeos/settings/cros_settings.h" | 37 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 38 #include "chrome/browser/chromeos/sim_dialog_delegate.h" | 38 #include "chrome/browser/chromeos/sim_dialog_delegate.h" |
| 39 #include "chrome/browser/chromeos/status/network_menu_icon.h" | 39 #include "chrome/browser/chromeos/status/network_menu_icon.h" |
| 40 #include "chrome/browser/chromeos/ui_proxy_config_service.h" |
| 40 #include "chrome/browser/net/pref_proxy_config_tracker.h" | 41 #include "chrome/browser/net/pref_proxy_config_tracker.h" |
| 41 #include "chrome/browser/profiles/profile.h" | 42 #include "chrome/browser/profiles/profile.h" |
| 42 #include "chrome/browser/profiles/profile_manager.h" | 43 #include "chrome/browser/profiles/profile_manager.h" |
| 43 #include "chrome/browser/ui/browser.h" | 44 #include "chrome/browser/ui/browser.h" |
| 44 #include "chrome/browser/ui/browser_finder.h" | 45 #include "chrome/browser/ui/browser_finder.h" |
| 45 #include "chrome/browser/ui/browser_window.h" | 46 #include "chrome/browser/ui/browser_window.h" |
| 46 #include "chrome/browser/ui/host_desktop.h" | 47 #include "chrome/browser/ui/host_desktop.h" |
| 47 #include "chrome/browser/ui/singleton_tabs.h" | 48 #include "chrome/browser/ui/singleton_tabs.h" |
| 48 #include "chrome/common/chrome_notification_types.h" | 49 #include "chrome/common/chrome_notification_types.h" |
| 49 #include "chrome/common/time_format.h" | 50 #include "chrome/common/time_format.h" |
| 50 #include "chromeos/chromeos_switches.h" | 51 #include "chromeos/chromeos_switches.h" |
| 51 #include "chromeos/network/network_ip_config.h" | 52 #include "chromeos/network/network_ip_config.h" |
| 53 #include "chromeos/network/network_ui_data.h" |
| 52 #include "chromeos/network/network_util.h" | 54 #include "chromeos/network/network_util.h" |
| 53 #include "chromeos/network/onc/onc_constants.h" | 55 #include "chromeos/network/onc/onc_constants.h" |
| 54 #include "content/public/browser/notification_service.h" | 56 #include "content/public/browser/notification_service.h" |
| 55 #include "content/public/browser/web_contents.h" | 57 #include "content/public/browser/web_contents.h" |
| 56 #include "content/public/browser/web_ui.h" | 58 #include "content/public/browser/web_ui.h" |
| 57 #include "grit/ash_resources.h" | 59 #include "grit/ash_resources.h" |
| 58 #include "grit/ash_strings.h" | 60 #include "grit/ash_strings.h" |
| 59 #include "grit/chromium_strings.h" | 61 #include "grit/chromium_strings.h" |
| 60 #include "grit/generated_resources.h" | 62 #include "grit/generated_resources.h" |
| 61 #include "grit/locale_settings.h" | 63 #include "grit/locale_settings.h" |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 const base::DictionaryValue& onc, | 517 const base::DictionaryValue& onc, |
| 516 DictionaryValue* dictionary) { | 518 DictionaryValue* dictionary) { |
| 517 dictionary->SetString(kTagService_name, vpn->name()); | 519 dictionary->SetString(kTagService_name, vpn->name()); |
| 518 bool remembered = (vpn->profile_type() != chromeos::PROFILE_NONE); | 520 bool remembered = (vpn->profile_type() != chromeos::PROFILE_NONE); |
| 519 dictionary->SetBoolean(kTagRemembered, remembered); | 521 dictionary->SetBoolean(kTagRemembered, remembered); |
| 520 dictionary->SetString(kTagProvider_type, vpn->GetProviderTypeString()); | 522 dictionary->SetString(kTagProvider_type, vpn->GetProviderTypeString()); |
| 521 dictionary->SetString(kTagUsername, vpn->username()); | 523 dictionary->SetString(kTagUsername, vpn->username()); |
| 522 | 524 |
| 523 chromeos::NetworkPropertyUIData hostname_ui_data; | 525 chromeos::NetworkPropertyUIData hostname_ui_data; |
| 524 hostname_ui_data.ParseOncProperty( | 526 hostname_ui_data.ParseOncProperty( |
| 525 vpn->ui_data(), &onc, | 527 vpn->ui_data().onc_source(), &onc, |
| 526 base::StringPrintf("%s.%s", | 528 base::StringPrintf("%s.%s", |
| 527 chromeos::onc::network_config::kVPN, | 529 chromeos::onc::network_config::kVPN, |
| 528 chromeos::onc::vpn::kHost)); | 530 chromeos::onc::vpn::kHost)); |
| 529 SetValueDictionary(dictionary, kTagServerHostname, | 531 SetValueDictionary(dictionary, kTagServerHostname, |
| 530 new base::StringValue(vpn->server_hostname()), | 532 new base::StringValue(vpn->server_hostname()), |
| 531 hostname_ui_data); | 533 hostname_ui_data); |
| 532 } | 534 } |
| 533 | 535 |
| 534 // Activate the cellular device pointed to by the service path. | 536 // Activate the cellular device pointed to by the service path. |
| 535 void Activate(std::string service_path) { | 537 void Activate(std::string service_path) { |
| (...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1251 std::string properties_json; | 1253 std::string properties_json; |
| 1252 base::JSONWriter::WriteWithOptions(shill_properties, | 1254 base::JSONWriter::WriteWithOptions(shill_properties, |
| 1253 base::JSONWriter::OPTIONS_PRETTY_PRINT, | 1255 base::JSONWriter::OPTIONS_PRETTY_PRINT, |
| 1254 &properties_json); | 1256 &properties_json); |
| 1255 VLOG(2) << "Shill Properties: " << std::endl << properties_json; | 1257 VLOG(2) << "Shill Properties: " << std::endl << properties_json; |
| 1256 } | 1258 } |
| 1257 chromeos::Network* network = cros_->FindNetworkByPath(service_path); | 1259 chromeos::Network* network = cros_->FindNetworkByPath(service_path); |
| 1258 if (!network) | 1260 if (!network) |
| 1259 return; | 1261 return; |
| 1260 | 1262 |
| 1261 Profile::FromWebUI(web_ui())->GetProxyConfigTracker()->UISetCurrentNetwork( | 1263 Profile::FromWebUI(web_ui())-> |
| 1262 service_path); | 1264 GetProxyConfigTracker()->GetUIService().SetCurrentNetwork(service_path); |
| 1263 | 1265 |
| 1264 const chromeos::NetworkUIData& ui_data = network->ui_data(); | 1266 const chromeos::NetworkUIData& ui_data = network->ui_data(); |
| 1265 const chromeos::NetworkPropertyUIData property_ui_data(ui_data); | 1267 const chromeos::NetworkPropertyUIData property_ui_data(ui_data.onc_source()); |
| 1266 const base::DictionaryValue* onc = | 1268 const base::DictionaryValue* onc = |
| 1267 cros_->FindOncForNetwork(network->unique_id()); | 1269 cros_->FindOncForNetwork(network->unique_id()); |
| 1268 | 1270 |
| 1269 base::DictionaryValue dictionary; | 1271 base::DictionaryValue dictionary; |
| 1270 if (!hardware_address.empty()) | 1272 if (!hardware_address.empty()) |
| 1271 dictionary.SetString(kTagHardwareAddress, hardware_address); | 1273 dictionary.SetString(kTagHardwareAddress, hardware_address); |
| 1272 | 1274 |
| 1273 // The DHCP IPConfig contains the values that are actually in use at the | 1275 // The DHCP IPConfig contains the values that are actually in use at the |
| 1274 // moment, even if some are overridden by static IP values. | 1276 // moment, even if some are overridden by static IP values. |
| 1275 scoped_ptr<DictionaryValue> ipconfig_dhcp(new DictionaryValue); | 1277 scoped_ptr<DictionaryValue> ipconfig_dhcp(new DictionaryValue); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1349 CommandLine::ForCurrentProcess()->HasSwitch( | 1351 CommandLine::ForCurrentProcess()->HasSwitch( |
| 1350 chromeos::switches::kEnableStaticIPConfig)); | 1352 chromeos::switches::kEnableStaticIPConfig)); |
| 1351 dictionary.SetBoolean(kTagShowStaticIPConfig, staticIPConfig); | 1353 dictionary.SetBoolean(kTagShowStaticIPConfig, staticIPConfig); |
| 1352 | 1354 |
| 1353 dictionary.SetBoolean(kTagShowPreferred, | 1355 dictionary.SetBoolean(kTagShowPreferred, |
| 1354 network_profile == chromeos::PROFILE_USER); | 1356 network_profile == chromeos::PROFILE_USER); |
| 1355 SetValueDictionary(&dictionary, kTagPreferred, | 1357 SetValueDictionary(&dictionary, kTagPreferred, |
| 1356 new base::FundamentalValue(network->preferred()), | 1358 new base::FundamentalValue(network->preferred()), |
| 1357 property_ui_data); | 1359 property_ui_data); |
| 1358 | 1360 |
| 1359 chromeos::NetworkPropertyUIData auto_connect_ui_data(ui_data); | 1361 chromeos::NetworkPropertyUIData auto_connect_ui_data(ui_data.onc_source()); |
| 1360 std::string onc_path_to_auto_connect; | 1362 std::string onc_path_to_auto_connect; |
| 1361 if (type == chromeos::TYPE_WIFI) { | 1363 if (type == chromeos::TYPE_WIFI) { |
| 1362 onc_path_to_auto_connect = base::StringPrintf( | 1364 onc_path_to_auto_connect = base::StringPrintf( |
| 1363 "%s.%s", | 1365 "%s.%s", |
| 1364 chromeos::onc::network_config::kWiFi, | 1366 chromeos::onc::network_config::kWiFi, |
| 1365 chromeos::onc::wifi::kAutoConnect); | 1367 chromeos::onc::wifi::kAutoConnect); |
| 1366 } else if (type == chromeos::TYPE_VPN) { | 1368 } else if (type == chromeos::TYPE_VPN) { |
| 1367 onc_path_to_auto_connect = base::StringPrintf( | 1369 onc_path_to_auto_connect = base::StringPrintf( |
| 1368 "%s.%s", | 1370 "%s.%s", |
| 1369 chromeos::onc::network_config::kVPN, | 1371 chromeos::onc::network_config::kVPN, |
| 1370 chromeos::onc::vpn::kAutoConnect); | 1372 chromeos::onc::vpn::kAutoConnect); |
| 1371 } | 1373 } |
| 1372 if (!onc_path_to_auto_connect.empty()) { | 1374 if (!onc_path_to_auto_connect.empty()) { |
| 1373 auto_connect_ui_data.ParseOncProperty( | 1375 auto_connect_ui_data.ParseOncProperty( |
| 1374 ui_data, | 1376 ui_data.onc_source(), |
| 1375 onc, | 1377 onc, |
| 1376 onc_path_to_auto_connect); | 1378 onc_path_to_auto_connect); |
| 1377 } | 1379 } |
| 1378 SetValueDictionary(&dictionary, kTagAutoConnect, | 1380 SetValueDictionary(&dictionary, kTagAutoConnect, |
| 1379 new base::FundamentalValue(network->auto_connect()), | 1381 new base::FundamentalValue(network->auto_connect()), |
| 1380 auto_connect_ui_data); | 1382 auto_connect_ui_data); |
| 1381 | 1383 |
| 1382 PopulateConnectionDetails(network, &dictionary); | 1384 PopulateConnectionDetails(network, &dictionary); |
| 1383 web_ui()->CallJavascriptFunction( | 1385 web_ui()->CallJavascriptFunction( |
| 1384 kShowDetailedInfoFunction, dictionary); | 1386 kShowDetailedInfoFunction, dictionary); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1485 | 1487 |
| 1486 dictionary->Set(kTagApn, CreateDictionaryFromCellularApn(cellular->apn())); | 1488 dictionary->Set(kTagApn, CreateDictionaryFromCellularApn(cellular->apn())); |
| 1487 dictionary->Set(kTagLastGoodApn, | 1489 dictionary->Set(kTagLastGoodApn, |
| 1488 CreateDictionaryFromCellularApn(cellular->last_good_apn())); | 1490 CreateDictionaryFromCellularApn(cellular->last_good_apn())); |
| 1489 | 1491 |
| 1490 // Device settings. | 1492 // Device settings. |
| 1491 const chromeos::NetworkDevice* device = | 1493 const chromeos::NetworkDevice* device = |
| 1492 cros_->FindNetworkDeviceByPath(cellular->device_path()); | 1494 cros_->FindNetworkDeviceByPath(cellular->device_path()); |
| 1493 if (device) { | 1495 if (device) { |
| 1494 const chromeos::NetworkPropertyUIData cellular_property_ui_data( | 1496 const chromeos::NetworkPropertyUIData cellular_property_ui_data( |
| 1495 cellular->ui_data()); | 1497 cellular->ui_data().onc_source()); |
| 1496 dictionary->SetString(kTagManufacturer, device->manufacturer()); | 1498 dictionary->SetString(kTagManufacturer, device->manufacturer()); |
| 1497 dictionary->SetString(kTagModelId, device->model_id()); | 1499 dictionary->SetString(kTagModelId, device->model_id()); |
| 1498 dictionary->SetString(kTagFirmwareRevision, device->firmware_revision()); | 1500 dictionary->SetString(kTagFirmwareRevision, device->firmware_revision()); |
| 1499 dictionary->SetString(kTagHardwareRevision, device->hardware_revision()); | 1501 dictionary->SetString(kTagHardwareRevision, device->hardware_revision()); |
| 1500 dictionary->SetString(kTagPrlVersion, | 1502 dictionary->SetString(kTagPrlVersion, |
| 1501 base::StringPrintf("%u", device->prl_version())); | 1503 base::StringPrintf("%u", device->prl_version())); |
| 1502 dictionary->SetString(kTagMeid, device->meid()); | 1504 dictionary->SetString(kTagMeid, device->meid()); |
| 1503 dictionary->SetString(kTagIccid, device->iccid()); | 1505 dictionary->SetString(kTagIccid, device->iccid()); |
| 1504 dictionary->SetString(kTagImei, device->imei()); | 1506 dictionary->SetString(kTagImei, device->imei()); |
| 1505 dictionary->SetString(kTagMdn, device->mdn()); | 1507 dictionary->SetString(kTagMdn, device->mdn()); |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1863 | 1865 |
| 1864 dictionary->SetBoolean(kTagWimaxEnabled, cros_->wimax_enabled()); | 1866 dictionary->SetBoolean(kTagWimaxEnabled, cros_->wimax_enabled()); |
| 1865 dictionary->SetBoolean(kTagWimaxAvailable, cros_->wimax_available()); | 1867 dictionary->SetBoolean(kTagWimaxAvailable, cros_->wimax_available()); |
| 1866 dictionary->SetBoolean(kTagWimaxBusy, cros_->wimax_busy()); | 1868 dictionary->SetBoolean(kTagWimaxBusy, cros_->wimax_busy()); |
| 1867 // TODO(kevers): The use of 'offline_mode' is not quite correct. Update once | 1869 // TODO(kevers): The use of 'offline_mode' is not quite correct. Update once |
| 1868 // we have proper back-end support. | 1870 // we have proper back-end support. |
| 1869 dictionary->SetBoolean(kTagAirplaneMode, cros_->offline_mode()); | 1871 dictionary->SetBoolean(kTagAirplaneMode, cros_->offline_mode()); |
| 1870 } | 1872 } |
| 1871 | 1873 |
| 1872 } // namespace options | 1874 } // namespace options |
| OLD | NEW |