Chromium Code Reviews| 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 25 matching lines...) Expand all Loading... | |
| 36 #include "chromeos/network/network_connection_handler.h" | 36 #include "chromeos/network/network_connection_handler.h" |
| 37 #include "chromeos/network/network_device_handler.h" | 37 #include "chromeos/network/network_device_handler.h" |
| 38 #include "chromeos/network/network_event_log.h" | 38 #include "chromeos/network/network_event_log.h" |
| 39 #include "chromeos/network/network_ip_config.h" | 39 #include "chromeos/network/network_ip_config.h" |
| 40 #include "chromeos/network/network_profile.h" | 40 #include "chromeos/network/network_profile.h" |
| 41 #include "chromeos/network/network_profile_handler.h" | 41 #include "chromeos/network/network_profile_handler.h" |
| 42 #include "chromeos/network/network_state.h" | 42 #include "chromeos/network/network_state.h" |
| 43 #include "chromeos/network/network_state_handler.h" | 43 #include "chromeos/network/network_state_handler.h" |
| 44 #include "chromeos/network/network_util.h" | 44 #include "chromeos/network/network_util.h" |
| 45 #include "chromeos/network/onc/onc_signature.h" | 45 #include "chromeos/network/onc/onc_signature.h" |
| 46 #include "chromeos/network/onc/onc_translation_tables.h" | |
| 46 #include "chromeos/network/onc/onc_translator.h" | 47 #include "chromeos/network/onc/onc_translator.h" |
| 47 #include "chromeos/network/onc/onc_utils.h" | 48 #include "chromeos/network/onc/onc_utils.h" |
| 48 #include "components/onc/onc_constants.h" | 49 #include "components/onc/onc_constants.h" |
| 49 #include "content/public/browser/user_metrics.h" | 50 #include "content/public/browser/user_metrics.h" |
| 50 #include "content/public/browser/web_contents.h" | 51 #include "content/public/browser/web_contents.h" |
| 51 #include "content/public/browser/web_ui.h" | 52 #include "content/public/browser/web_ui.h" |
| 52 #include "grit/ash_resources.h" | 53 #include "grit/ash_resources.h" |
| 53 #include "grit/ui_chromeos_resources.h" | 54 #include "grit/ui_chromeos_resources.h" |
| 54 #include "third_party/cros_system_api/dbus/service_constants.h" | 55 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 55 #include "ui/base/resource/resource_bundle.h" | 56 #include "ui/base/resource/resource_bundle.h" |
| 56 #include "ui/base/webui/web_ui_util.h" | 57 #include "ui/base/webui/web_ui_util.h" |
| 57 #include "ui/chromeos/network/network_icon.h" | 58 #include "ui/chromeos/network/network_icon.h" |
| 58 #include "ui/gfx/image/image_skia.h" | 59 #include "ui/gfx/image/image_skia.h" |
| 59 | 60 |
| 60 namespace chromeos { | 61 namespace chromeos { |
| 61 namespace options { | 62 namespace options { |
| 62 | 63 |
| 63 namespace { | 64 namespace { |
| 64 | 65 |
| 66 // The key in a Managed Value dictionary for translated values. | |
| 67 // TODO(stevenjb): Consider making this part of the ONC spec. | |
| 68 const char kTranslatedKey[] = "Translated"; | |
| 69 | |
| 65 // Keys for the network description dictionary passed to the web ui. Make sure | 70 // Keys for the network description dictionary passed to the web ui. Make sure |
| 66 // to keep the strings in sync with what the JavaScript side uses. | 71 // to keep the strings in sync with what the JavaScript side uses. |
| 67 const char kNetworkInfoKeyIconURL[] = "iconURL"; | 72 const char kNetworkInfoKeyIconURL[] = "iconURL"; |
| 68 const char kNetworkInfoKeyServicePath[] = "servicePath"; | 73 const char kNetworkInfoKeyServicePath[] = "servicePath"; |
| 69 const char kNetworkInfoKeyPolicyManaged[] = "policyManaged"; | 74 const char kNetworkInfoKeyPolicyManaged[] = "policyManaged"; |
| 70 | 75 |
| 71 // These are keys for getting IP information from the web ui. | 76 // These are keys for getting IP information from the web ui. |
| 72 const char kIpConfigAddress[] = "address"; | 77 const char kIpConfigAddress[] = "address"; |
| 73 const char kIpConfigPrefixLength[] = "prefixLength"; | 78 const char kIpConfigPrefixLength[] = "prefixLength"; |
| 74 const char kIpConfigNetmask[] = "netmask"; | 79 const char kIpConfigNetmask[] = "netmask"; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 const char kTagLanguage[] = "language"; | 147 const char kTagLanguage[] = "language"; |
| 143 const char kTagLastGoodApn[] = "lastGoodApn"; | 148 const char kTagLastGoodApn[] = "lastGoodApn"; |
| 144 const char kTagLocalizedName[] = "localizedName"; | 149 const char kTagLocalizedName[] = "localizedName"; |
| 145 const char kTagName[] = "name"; | 150 const char kTagName[] = "name"; |
| 146 const char kTagNameServersGoogle[] = "nameServersGoogle"; | 151 const char kTagNameServersGoogle[] = "nameServersGoogle"; |
| 147 const char kTagNameServerType[] = "nameServerType"; | 152 const char kTagNameServerType[] = "nameServerType"; |
| 148 const char kTagNetworkId[] = "networkId"; | 153 const char kTagNetworkId[] = "networkId"; |
| 149 const char kTagOptions[] = "options"; | 154 const char kTagOptions[] = "options"; |
| 150 const char kTagPassword[] = "password"; | 155 const char kTagPassword[] = "password"; |
| 151 const char kTagPolicy[] = "policy"; | 156 const char kTagPolicy[] = "policy"; |
| 152 const char kTagPreferred[] = "preferred"; | |
| 153 const char kTagProviderType[] = "providerType"; | |
| 154 const char kTagProviderApnList[] = "providerApnList"; | 157 const char kTagProviderApnList[] = "providerApnList"; |
| 155 const char kTagRecommended[] = "recommended"; | 158 const char kTagRecommended[] = "recommended"; |
| 156 const char kTagRecommendedValue[] = "recommendedValue"; | 159 const char kTagRecommendedValue[] = "recommendedValue"; |
| 157 const char kTagRemembered[] = "remembered"; | 160 const char kTagRemembered[] = "remembered"; |
| 158 const char kTagRememberedList[] = "rememberedList"; | 161 const char kTagRememberedList[] = "rememberedList"; |
| 159 const char kTagRestrictedPool[] = "restrictedPool"; | 162 const char kTagRestrictedPool[] = "restrictedPool"; |
| 160 const char kTagRoamingState[] = "roamingState"; | 163 const char kTagRoamingState[] = "roamingState"; |
| 161 const char kTagServerHostname[] = "serverHostname"; | |
| 162 const char kTagCarriers[] = "carriers"; | 164 const char kTagCarriers[] = "carriers"; |
| 163 const char kTagCurrentCarrierIndex[] = "currentCarrierIndex"; | 165 const char kTagCurrentCarrierIndex[] = "currentCarrierIndex"; |
| 164 const char kTagShared[] = "shared"; | 166 const char kTagShared[] = "shared"; |
| 165 const char kTagShowActivateButton[] = "showActivateButton"; | 167 const char kTagShowActivateButton[] = "showActivateButton"; |
| 166 const char kTagShowViewAccountButton[] = "showViewAccountButton"; | 168 const char kTagShowViewAccountButton[] = "showViewAccountButton"; |
| 167 const char kTagSimCardLockEnabled[] = "simCardLockEnabled"; | 169 const char kTagSimCardLockEnabled[] = "simCardLockEnabled"; |
| 168 const char kTagSupportUrl[] = "supportUrl"; | 170 const char kTagSupportUrl[] = "supportUrl"; |
| 169 const char kTagTrue[] = "true"; | 171 const char kTagTrue[] = "true"; |
| 170 const char kTagUsername[] = "username"; | 172 const char kTagUsername[] = "username"; |
| 171 const char kTagValue[] = "value"; | 173 const char kTagValue[] = "value"; |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 330 if (onc_source == ::onc::ONC_SOURCE_DEVICE_POLICY) | 332 if (onc_source == ::onc::ONC_SOURCE_DEVICE_POLICY) |
| 331 return ::onc::kAugmentationSharedSetting; | 333 return ::onc::kAugmentationSharedSetting; |
| 332 return ::onc::kAugmentationUserSetting; | 334 return ::onc::kAugmentationUserSetting; |
| 333 } | 335 } |
| 334 | 336 |
| 335 // Creates a GetManagedProperties style dictionary and adds it to |settings|. | 337 // Creates a GetManagedProperties style dictionary and adds it to |settings|. |
| 336 // |default_value| represents either the recommended value if |recommended| | 338 // |default_value| represents either the recommended value if |recommended| |
| 337 // is true, or the enforced value if |recommended| is false. | 339 // is true, or the enforced value if |recommended| is false. |
| 338 // Note(stevenjb): This is bridge code until we use GetManagedProperties to | 340 // Note(stevenjb): This is bridge code until we use GetManagedProperties to |
| 339 // retrieve Shill properties. | 341 // retrieve Shill properties. |
| 340 void SetManagedValueDictionary(const char* key, | 342 void SetManagedValueDictionaryEx(const char* settings_dict_key, |
| 341 const base::Value* value, | 343 const base::Value* value, |
| 342 ::onc::ONCSource onc_source, | 344 ::onc::ONCSource onc_source, |
| 343 bool recommended, | 345 bool recommended, |
| 344 const base::Value* default_value, | 346 const base::Value* default_value, |
| 345 base::DictionaryValue* settings) { | 347 base::DictionaryValue* settings_dict) { |
| 346 base::DictionaryValue* dict = new base::DictionaryValue(); | 348 base::DictionaryValue* dict = new base::DictionaryValue(); |
| 347 settings->Set(key, dict); | 349 settings_dict->Set(settings_dict_key, dict); |
|
pneubeck (no reviews)
2014/08/19 19:26:38
nit:
maybe clarify at the comment of this function
stevenjb
2014/08/19 23:20:17
This was not intended to support path expansion, s
| |
| 348 | 350 |
| 349 DCHECK(value); | 351 DCHECK(value); |
| 350 dict->Set(::onc::kAugmentationActiveSetting, value->DeepCopy()); | 352 dict->Set(::onc::kAugmentationActiveSetting, value->DeepCopy()); |
| 351 | 353 |
| 352 if (onc_source == ::onc::ONC_SOURCE_NONE) | 354 if (onc_source == ::onc::ONC_SOURCE_NONE) |
| 353 return; | 355 return; |
| 354 | 356 |
| 355 if (recommended) { | 357 if (recommended) { |
| 356 // If an ONC property is 'Recommended' it can be edited by the user. | 358 // If an ONC property is 'Recommended' it can be edited by the user. |
| 357 std::string editable = GetOncEditableString(onc_source); | 359 std::string editable = GetOncEditableString(onc_source); |
| 358 dict->Set(editable, new base::FundamentalValue(true)); | 360 dict->Set(editable, new base::FundamentalValue(true)); |
| 359 } | 361 } |
| 360 if (default_value) { | 362 if (default_value) { |
| 361 std::string policy_source = GetOncPolicyString(onc_source); | 363 std::string policy_source = GetOncPolicyString(onc_source); |
| 362 dict->Set(policy_source, default_value->DeepCopy()); | 364 dict->Set(policy_source, default_value->DeepCopy()); |
| 363 if (recommended && !value->Equals(default_value)) { | 365 if (recommended && !value->Equals(default_value)) { |
| 364 std::string setting_source = GetOncSettingString(onc_source); | 366 std::string setting_source = GetOncSettingString(onc_source); |
| 365 dict->Set(setting_source, value->DeepCopy()); | 367 dict->Set(setting_source, value->DeepCopy()); |
| 366 dict->SetString(::onc::kAugmentationEffectiveSetting, setting_source); | 368 dict->SetString(::onc::kAugmentationEffectiveSetting, setting_source); |
| 367 } else { | 369 } else { |
| 368 dict->SetString(::onc::kAugmentationEffectiveSetting, policy_source); | 370 dict->SetString(::onc::kAugmentationEffectiveSetting, policy_source); |
| 369 } | 371 } |
| 370 } | 372 } |
| 371 } | 373 } |
| 372 | 374 |
| 375 void SetManagedValueDictionary(const std::string& guid, | |
| 376 const char* settings_dict_key, | |
| 377 const base::Value* value, | |
| 378 const std::string& onc_key, | |
| 379 base::DictionaryValue* settings_dict) { | |
| 380 | |
|
pneubeck (no reviews)
2014/08/19 19:26:37
nit: drop empty line
stevenjb
2014/08/19 23:20:18
Done.
| |
| 381 ::onc::ONCSource onc_source = ::onc::ONC_SOURCE_NONE; | |
| 382 const base::DictionaryValue* onc = | |
| 383 onc::FindPolicyForActiveUser(guid, &onc_source); | |
| 384 DCHECK_EQ(onc == NULL, onc_source == ::onc::ONC_SOURCE_NONE); | |
| 385 const base::Value* default_value = NULL; | |
| 386 if (onc) | |
| 387 onc->Get(onc_key, &default_value); | |
| 388 SetManagedValueDictionaryEx(settings_dict_key, | |
| 389 value, | |
| 390 onc_source, | |
| 391 onc::IsRecommendedValue(onc, onc_key), | |
| 392 default_value, | |
| 393 settings_dict); | |
| 394 } | |
| 395 | |
| 396 // Creates a GetManagedProperties style dictionary with an Active value and | |
| 397 // a Translated value, and adds it to |settings|. | |
| 398 // Note(stevenjb): This is bridge code until we use GetManagedProperties to | |
| 399 // retrieve Shill properties and include Translated values. | |
| 400 void SetTranslatedDictionary(const char* settings_dict_key, | |
| 401 const std::string& value, | |
| 402 const std::string& translated_value, | |
| 403 base::DictionaryValue* settings_dict) { | |
| 404 base::DictionaryValue* dict = new base::DictionaryValue(); | |
| 405 settings_dict->Set(settings_dict_key, dict); | |
| 406 dict->SetString(::onc::kAugmentationActiveSetting, value); | |
| 407 dict->SetString(kTranslatedKey, translated_value); | |
| 408 } | |
| 409 | |
| 373 std::string CopyStringFromDictionary(const base::DictionaryValue& source, | 410 std::string CopyStringFromDictionary(const base::DictionaryValue& source, |
| 374 const std::string& src_key, | 411 const std::string& src_key, |
| 375 const std::string& dest_key, | 412 const std::string& dest_key, |
| 376 base::DictionaryValue* dest) { | 413 base::DictionaryValue* dest) { |
| 377 std::string string_value; | 414 std::string string_value; |
| 378 if (source.GetStringWithoutPathExpansion(src_key, &string_value)) | 415 if (source.GetStringWithoutPathExpansion(src_key, &string_value)) |
| 379 dest->SetStringWithoutPathExpansion(dest_key, string_value); | 416 dest->SetStringWithoutPathExpansion(dest_key, string_value); |
| 380 return string_value; | 417 return string_value; |
| 381 } | 418 } |
| 382 | 419 |
| 383 // Fills |dictionary| with the configuration details of |vpn|. |onc| is required | 420 // Fills |dictionary| with the configuration details of |vpn|. |onc| is required |
| 384 // for augmenting the policy-managed information. | 421 // for augmenting the policy-managed information. |
| 385 void PopulateVPNDetails(const NetworkState* vpn, | 422 void PopulateVPNDetails(const NetworkState* vpn, |
| 386 const base::DictionaryValue& shill_properties, | 423 const base::DictionaryValue& shill_properties, |
| 387 base::DictionaryValue* dictionary) { | 424 base::DictionaryValue* dictionary) { |
| 388 // Name and Remembered are set in PopulateConnectionDetails(). | 425 // Name and Remembered are set in PopulateConnectionDetails(). |
| 389 // Provider properties are stored in the "Provider" dictionary. | 426 // Provider properties are stored in the "Provider" dictionary. |
| 390 const base::DictionaryValue* provider_properties = NULL; | 427 const base::DictionaryValue* shill_provider_properties = NULL; |
| 391 if (!shill_properties.GetDictionaryWithoutPathExpansion( | 428 if (!shill_properties.GetDictionaryWithoutPathExpansion( |
| 392 shill::kProviderProperty, &provider_properties)) { | 429 shill::kProviderProperty, &shill_provider_properties)) { |
| 393 LOG(ERROR) << "No provider properties for VPN: " << vpn->path(); | 430 LOG(ERROR) << "No provider properties for VPN: " << vpn->path(); |
| 394 return; | 431 return; |
| 395 } | 432 } |
| 396 std::string provider_type; | 433 base::DictionaryValue* vpn_dictionary = new base::DictionaryValue; |
| 397 provider_properties->GetStringWithoutPathExpansion( | 434 dictionary->Set(::onc::network_config::kVPN, vpn_dictionary); |
| 398 shill::kTypeProperty, &provider_type); | 435 |
| 399 dictionary->SetString(kTagProviderType, | 436 std::string shill_provider_type; |
| 400 internet_options_strings::ProviderTypeString( | 437 if (!shill_provider_properties->GetStringWithoutPathExpansion( |
| 401 provider_type, | 438 shill::kTypeProperty, &shill_provider_type)) { |
| 402 *provider_properties)); | 439 LOG(ERROR) << "Shill VPN has no Provider.Type: " << vpn->path(); |
| 440 return; | |
| 441 } | |
| 442 std::string onc_provider_type; | |
| 443 onc::TranslateStringToONC( | |
| 444 onc::kVPNTypeTable, shill_provider_type, &onc_provider_type); | |
| 445 SetTranslatedDictionary( | |
| 446 ::onc::vpn::kType, | |
| 447 onc_provider_type, | |
| 448 internet_options_strings::ProviderTypeString(shill_provider_type, | |
| 449 *shill_provider_properties), | |
| 450 vpn_dictionary); | |
| 451 | |
| 452 base::DictionaryValue* provider_dictionary = new base::DictionaryValue; | |
|
pneubeck (no reviews)
2014/08/19 19:26:37
I have the impression that 'provider' is not the r
stevenjb
2014/08/19 23:20:17
Renamed provider_type_dictionary since that is wha
| |
| 453 vpn_dictionary->Set(onc_provider_type, provider_dictionary); | |
|
pneubeck (no reviews)
2014/08/19 19:26:38
This will not work: The possible subdictionaries a
stevenjb
2014/08/19 23:20:18
Gah. OK, so... what? Let me look at the doc again.
| |
| 403 | 454 |
| 404 std::string username; | 455 std::string username; |
| 405 if (provider_type == shill::kProviderOpenVpn) { | 456 if (shill_provider_type == shill::kProviderOpenVpn) { |
| 406 provider_properties->GetStringWithoutPathExpansion( | 457 shill_provider_properties->GetStringWithoutPathExpansion( |
| 407 shill::kOpenVPNUserProperty, &username); | 458 shill::kOpenVPNUserProperty, &username); |
| 408 } else { | 459 } else { |
| 409 provider_properties->GetStringWithoutPathExpansion( | 460 shill_provider_properties->GetStringWithoutPathExpansion( |
| 410 shill::kL2tpIpsecUserProperty, &username); | 461 shill::kL2tpIpsecUserProperty, &username); |
| 411 } | 462 } |
| 412 dictionary->SetString(kTagUsername, username); | 463 provider_dictionary->SetString(::onc::vpn::kUsername, username); |
|
pneubeck (no reviews)
2014/08/19 19:26:37
The username is never set in IPsec but only in L2T
stevenjb
2014/08/19 23:20:18
OK, I think I maybe have this right now...
| |
| 413 | 464 |
| 414 ::onc::ONCSource onc_source = ::onc::ONC_SOURCE_NONE; | |
| 415 const base::DictionaryValue* onc = | |
| 416 onc::FindPolicyForActiveUser(vpn->guid(), &onc_source); | |
| 417 | |
| 418 NetworkPropertyUIData hostname_ui_data; | |
| 419 hostname_ui_data.ParseOncProperty( | |
| 420 onc_source, | |
| 421 onc, | |
| 422 ::onc::network_config::VpnProperty(::onc::vpn::kHost)); | |
| 423 std::string provider_host; | 465 std::string provider_host; |
| 424 provider_properties->GetStringWithoutPathExpansion( | 466 shill_provider_properties->GetStringWithoutPathExpansion( |
| 425 shill::kHostProperty, &provider_host); | 467 shill::kHostProperty, &provider_host); |
| 426 SetValueDictionary(kTagServerHostname, | 468 SetManagedValueDictionary( |
| 427 new base::StringValue(provider_host), | 469 vpn->guid(), |
| 428 hostname_ui_data, | 470 ::onc::vpn::kHost, |
|
pneubeck (no reviews)
2014/08/19 19:26:38
optional nit: having the same key with different p
stevenjb
2014/08/19 23:20:17
I really don't like using Value::Set with '.' sepa
| |
| 429 dictionary); | 471 new base::StringValue(provider_host), |
|
pneubeck (no reviews)
2014/08/19 19:26:38
memory leak, see other comment.
stevenjb
2014/08/19 23:20:17
Bah, this is what happens when... nevermind. Fixed
| |
| 472 ::onc::network_config::VpnProperty(::onc::vpn::kHost), | |
| 473 vpn_dictionary); | |
| 430 } | 474 } |
| 431 | 475 |
| 432 // Given a list of supported carrier's by the device, return the index of | 476 // Given a list of supported carrier's by the device, return the index of |
| 433 // the carrier the device is currently using. | 477 // the carrier the device is currently using. |
| 434 int FindCurrentCarrierIndex(const base::ListValue* carriers, | 478 int FindCurrentCarrierIndex(const base::ListValue* carriers, |
| 435 const DeviceState* device) { | 479 const DeviceState* device) { |
| 436 DCHECK(carriers); | 480 DCHECK(carriers); |
| 437 DCHECK(device); | 481 DCHECK(device); |
| 438 bool gsm = (device->technology_family() == shill::kTechnologyFamilyGsm); | 482 bool gsm = (device->technology_family() == shill::kTechnologyFamilyGsm); |
| 439 int index = 0; | 483 int index = 0; |
| (...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1325 static_ip_dict.release(), | 1369 static_ip_dict.release(), |
| 1326 property_ui_data, | 1370 property_ui_data, |
| 1327 dictionary.get()); | 1371 dictionary.get()); |
| 1328 | 1372 |
| 1329 dictionary->SetString(kTagNameServerType, name_server_type); | 1373 dictionary->SetString(kTagNameServerType, name_server_type); |
| 1330 dictionary->SetString(kTagNameServersGoogle, kGoogleNameServers); | 1374 dictionary->SetString(kTagNameServersGoogle, kGoogleNameServers); |
| 1331 | 1375 |
| 1332 int priority = 0; | 1376 int priority = 0; |
| 1333 shill_properties.GetIntegerWithoutPathExpansion( | 1377 shill_properties.GetIntegerWithoutPathExpansion( |
| 1334 shill::kPriorityProperty, &priority); | 1378 shill::kPriorityProperty, &priority); |
| 1335 bool preferred = priority > 0; | 1379 SetManagedValueDictionary(network->guid(), |
| 1336 SetValueDictionary(kTagPreferred, | 1380 ::onc::network_config::kPriority, |
| 1337 new base::FundamentalValue(preferred), | 1381 new base::FundamentalValue(priority), |
|
pneubeck (no reviews)
2014/08/19 19:26:38
this will leak the FundamentalValue.
Please, pleas
stevenjb
2014/08/19 23:20:17
Fixed.
| |
| 1338 property_ui_data, | 1382 ::onc::network_config::kPriority, |
| 1339 dictionary.get()); | 1383 dictionary.get()); |
| 1340 | 1384 |
| 1341 std::string onc_path_to_auto_connect; | 1385 std::string onc_path_to_auto_connect; |
| 1342 if (network->Matches(NetworkTypePattern::WiFi())) { | 1386 if (network->Matches(NetworkTypePattern::WiFi())) { |
| 1343 content::RecordAction( | 1387 content::RecordAction( |
| 1344 base::UserMetricsAction("Options_NetworkShowDetailsWifi")); | 1388 base::UserMetricsAction("Options_NetworkShowDetailsWifi")); |
| 1345 if (network->IsConnectedState()) { | 1389 if (network->IsConnectedState()) { |
| 1346 content::RecordAction( | 1390 content::RecordAction( |
| 1347 base::UserMetricsAction("Options_NetworkShowDetailsWifiConnected")); | 1391 base::UserMetricsAction("Options_NetworkShowDetailsWifiConnected")); |
| 1348 } | 1392 } |
| 1349 onc_path_to_auto_connect = | 1393 onc_path_to_auto_connect = |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1393 network->IsPrivate())) { | 1437 network->IsPrivate())) { |
| 1394 auto_connect_recommended = false; | 1438 auto_connect_recommended = false; |
| 1395 auto_connect_onc_source = network->IsPrivate() | 1439 auto_connect_onc_source = network->IsPrivate() |
| 1396 ? ::onc::ONC_SOURCE_USER_POLICY | 1440 ? ::onc::ONC_SOURCE_USER_POLICY |
| 1397 : ::onc::ONC_SOURCE_DEVICE_POLICY; | 1441 : ::onc::ONC_SOURCE_DEVICE_POLICY; |
| 1398 if (auto_connect) { | 1442 if (auto_connect) { |
| 1399 LOG(WARNING) << "Policy prevents autoconnect, but value is True."; | 1443 LOG(WARNING) << "Policy prevents autoconnect, but value is True."; |
| 1400 auto_connect_value.reset(new base::FundamentalValue(false)); | 1444 auto_connect_value.reset(new base::FundamentalValue(false)); |
| 1401 } | 1445 } |
| 1402 } | 1446 } |
| 1403 SetManagedValueDictionary(shill::kAutoConnectProperty, | 1447 SetManagedValueDictionaryEx(shill::kAutoConnectProperty, |
| 1404 auto_connect_value.get(), | 1448 auto_connect_value.get(), |
| 1405 auto_connect_onc_source, | 1449 auto_connect_onc_source, |
| 1406 auto_connect_recommended, | 1450 auto_connect_recommended, |
| 1407 auto_connect_default_value, | 1451 auto_connect_default_value, |
| 1408 dictionary.get()); | 1452 dictionary.get()); |
| 1409 } | 1453 } |
| 1410 | 1454 |
| 1411 // Show details dialog | 1455 // Show details dialog |
| 1412 web_ui()->CallJavascriptFunction(kShowDetailedInfoFunction, *dictionary); | 1456 web_ui()->CallJavascriptFunction(kShowDetailedInfoFunction, *dictionary); |
| 1413 } | 1457 } |
| 1414 | 1458 |
| 1415 gfx::NativeWindow InternetOptionsHandler::GetNativeWindow() const { | 1459 gfx::NativeWindow InternetOptionsHandler::GetNativeWindow() const { |
| 1416 return web_ui()->GetWebContents()->GetTopLevelNativeWindow(); | 1460 return web_ui()->GetWebContents()->GetTopLevelNativeWindow(); |
| 1417 } | 1461 } |
| 1418 | 1462 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1600 dictionary->SetBoolean( | 1644 dictionary->SetBoolean( |
| 1601 kTagWimaxAvailable, | 1645 kTagWimaxAvailable, |
| 1602 handler->IsTechnologyAvailable(NetworkTypePattern::Wimax())); | 1646 handler->IsTechnologyAvailable(NetworkTypePattern::Wimax())); |
| 1603 dictionary->SetBoolean( | 1647 dictionary->SetBoolean( |
| 1604 kTagWimaxEnabled, | 1648 kTagWimaxEnabled, |
| 1605 handler->IsTechnologyEnabled(NetworkTypePattern::Wimax())); | 1649 handler->IsTechnologyEnabled(NetworkTypePattern::Wimax())); |
| 1606 } | 1650 } |
| 1607 | 1651 |
| 1608 } // namespace options | 1652 } // namespace options |
| 1609 } // namespace chromeos | 1653 } // namespace chromeos |
| OLD | NEW |