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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
119 const char kSetPreferNetworkMessage[] = "setPreferNetwork"; | 119 const char kSetPreferNetworkMessage[] = "setPreferNetwork"; |
120 const char kSetServerHostname[] = "setServerHostname"; | 120 const char kSetServerHostname[] = "setServerHostname"; |
121 const char kSetSimCardLockMessage[] = "setSimCardLock"; | 121 const char kSetSimCardLockMessage[] = "setSimCardLock"; |
122 const char kShowMorePlanInfoMessage[] = "showMorePlanInfo"; | 122 const char kShowMorePlanInfoMessage[] = "showMorePlanInfo"; |
123 | 123 |
124 // These are strings used to communicate with JavaScript. | 124 // These are strings used to communicate with JavaScript. |
125 const char kTagActivate[] = "activate"; | 125 const char kTagActivate[] = "activate"; |
126 const char kTagActivationState[] = "activationState"; | 126 const char kTagActivationState[] = "activationState"; |
127 const char kTagAddConnection[] = "add"; | 127 const char kTagAddConnection[] = "add"; |
128 const char kTagApn[] = "apn"; | 128 const char kTagApn[] = "apn"; |
129 const char kTagAutoConnect[] = "autoConnect"; | |
130 const char kTagCarrierSelectFlag[] = "showCarrierSelect"; | 129 const char kTagCarrierSelectFlag[] = "showCarrierSelect"; |
131 const char kTagCarrierUrl[] = "carrierUrl"; | 130 const char kTagCarrierUrl[] = "carrierUrl"; |
132 const char kTagCellularAvailable[] = "cellularAvailable"; | 131 const char kTagCellularAvailable[] = "cellularAvailable"; |
133 const char kTagCellularEnabled[] = "cellularEnabled"; | 132 const char kTagCellularEnabled[] = "cellularEnabled"; |
134 const char kTagCellularSupportsScan[] = "cellularSupportsScan"; | 133 const char kTagCellularSupportsScan[] = "cellularSupportsScan"; |
135 const char kTagConfigure[] = "configure"; | 134 const char kTagConfigure[] = "configure"; |
136 const char kTagConnect[] = "connect"; | 135 const char kTagConnect[] = "connect"; |
137 const char kTagControlledBy[] = "controlledBy"; | 136 const char kTagControlledBy[] = "controlledBy"; |
138 const char kTagDeviceConnected[] = "deviceConnected"; | 137 const char kTagDeviceConnected[] = "deviceConnected"; |
139 const char kTagDisconnect[] = "disconnect"; | 138 const char kTagDisconnect[] = "disconnect"; |
140 const char kTagErrorState[] = "errorState"; | 139 const char kTagErrorMessage[] = "errorMessage"; |
141 const char kTagForget[] = "forget"; | 140 const char kTagForget[] = "forget"; |
142 const char kTagIdentity[] = "identity"; | |
143 const char kTagLanguage[] = "language"; | 141 const char kTagLanguage[] = "language"; |
144 const char kTagLastGoodApn[] = "lastGoodApn"; | 142 const char kTagLastGoodApn[] = "lastGoodApn"; |
145 const char kTagLocalizedName[] = "localizedName"; | 143 const char kTagLocalizedName[] = "localizedName"; |
146 const char kTagName[] = "name"; | 144 const char kTagName[] = "name"; |
147 const char kTagNameServersGoogle[] = "nameServersGoogle"; | 145 const char kTagNameServersGoogle[] = "nameServersGoogle"; |
148 const char kTagNameServerType[] = "nameServerType"; | 146 const char kTagNameServerType[] = "nameServerType"; |
149 const char kTagNetworkId[] = "networkId"; | 147 const char kTagNetworkId[] = "networkId"; |
150 const char kTagOptions[] = "options"; | 148 const char kTagOptions[] = "options"; |
151 const char kTagPassword[] = "password"; | 149 const char kTagPassword[] = "password"; |
152 const char kTagPolicy[] = "policy"; | 150 const char kTagPolicy[] = "policy"; |
153 const char kTagPreferred[] = "preferred"; | 151 const char kTagPreferred[] = "preferred"; |
154 const char kTagProviderType[] = "providerType"; | 152 const char kTagProviderType[] = "providerType"; |
155 const char kTagProviderApnList[] = "providerApnList"; | 153 const char kTagProviderApnList[] = "providerApnList"; |
156 const char kTagRecommended[] = "recommended"; | 154 const char kTagRecommended[] = "recommended"; |
157 const char kTagRecommendedValue[] = "recommendedValue"; | 155 const char kTagRecommendedValue[] = "recommendedValue"; |
158 const char kTagRemembered[] = "remembered"; | 156 const char kTagRemembered[] = "remembered"; |
159 const char kTagRememberedList[] = "rememberedList"; | 157 const char kTagRememberedList[] = "rememberedList"; |
160 const char kTagRestrictedPool[] = "restrictedPool"; | 158 const char kTagRestrictedPool[] = "restrictedPool"; |
161 const char kTagRoamingState[] = "roamingState"; | 159 const char kTagRoamingState[] = "roamingState"; |
162 const char kTagServerHostname[] = "serverHostname"; | 160 const char kTagServerHostname[] = "serverHostname"; |
163 const char kTagCarriers[] = "carriers"; | 161 const char kTagCarriers[] = "carriers"; |
164 const char kTagCurrentCarrierIndex[] = "currentCarrierIndex"; | 162 const char kTagCurrentCarrierIndex[] = "currentCarrierIndex"; |
165 const char kTagShared[] = "shared"; | 163 const char kTagShared[] = "shared"; |
166 const char kTagShowActivateButton[] = "showActivateButton"; | 164 const char kTagShowActivateButton[] = "showActivateButton"; |
167 const char kTagShowStaticIPConfig[] = "showStaticIPConfig"; | |
168 const char kTagShowViewAccountButton[] = "showViewAccountButton"; | 165 const char kTagShowViewAccountButton[] = "showViewAccountButton"; |
169 const char kTagSimCardLockEnabled[] = "simCardLockEnabled"; | 166 const char kTagSimCardLockEnabled[] = "simCardLockEnabled"; |
170 const char kTagSupportUrl[] = "supportUrl"; | 167 const char kTagSupportUrl[] = "supportUrl"; |
171 const char kTagTrue[] = "true"; | 168 const char kTagTrue[] = "true"; |
172 const char kTagUsername[] = "username"; | 169 const char kTagUsername[] = "username"; |
173 const char kTagValue[] = "value"; | 170 const char kTagValue[] = "value"; |
174 const char kTagVpnList[] = "vpnList"; | 171 const char kTagVpnList[] = "vpnList"; |
175 const char kTagWifiAvailable[] = "wifiAvailable"; | 172 const char kTagWifiAvailable[] = "wifiAvailable"; |
176 const char kTagWifiEnabled[] = "wifiEnabled"; | 173 const char kTagWifiEnabled[] = "wifiEnabled"; |
177 const char kTagWimaxAvailable[] = "wimaxAvailable"; | 174 const char kTagWimaxAvailable[] = "wimaxAvailable"; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
288 std::string name_servers; | 285 std::string name_servers; |
289 if (shill_properties.GetStringWithoutPathExpansion( | 286 if (shill_properties.GetStringWithoutPathExpansion( |
290 name_servers_key, &name_servers)) { | 287 name_servers_key, &name_servers)) { |
291 ip_info_dict->SetString(kIpConfigNameServers, name_servers); | 288 ip_info_dict->SetString(kIpConfigNameServers, name_servers); |
292 VLOG(2) << "Found " << name_servers_key << ": " << name_servers; | 289 VLOG(2) << "Found " << name_servers_key << ": " << name_servers; |
293 } | 290 } |
294 | 291 |
295 return ip_info_dict.release(); | 292 return ip_info_dict.release(); |
296 } | 293 } |
297 | 294 |
298 // Decorate dictionary |value_dict| with policy information from |ui_data|. | |
299 void DecorateValueDictionary(const NetworkPropertyUIData& ui_data, | |
300 const base::Value& value, | |
301 base::DictionaryValue* value_dict) { | |
302 const base::Value* recommended_value = ui_data.default_value(); | |
303 if (ui_data.IsManaged()) | |
304 value_dict->SetString(kTagControlledBy, kTagPolicy); | |
305 else if (recommended_value && recommended_value->Equals(&value)) | |
306 value_dict->SetString(kTagControlledBy, kTagRecommended); | |
307 | |
308 if (recommended_value) | |
309 value_dict->Set(kTagRecommendedValue, recommended_value->DeepCopy()); | |
310 } | |
311 | |
312 // Decorate pref value as CoreOptionsHandler::CreateValueForPref() does and | 295 // Decorate pref value as CoreOptionsHandler::CreateValueForPref() does and |
313 // store it under |key| in |settings|. Takes ownership of |value|. | 296 // store it under |key| in |settings|. Takes ownership of |value|. |
314 void SetValueDictionary(base::DictionaryValue* settings, | 297 void SetValueDictionary(base::DictionaryValue* settings, |
315 const char* key, | 298 const char* key, |
316 base::Value* value, | 299 base::Value* value, |
317 const NetworkPropertyUIData& ui_data) { | 300 const NetworkPropertyUIData& ui_data) { |
318 base::DictionaryValue* dict = new base::DictionaryValue(); | 301 base::DictionaryValue* dict = new base::DictionaryValue(); |
319 // DictionaryValue::Set() takes ownership of |value|. | 302 // DictionaryValue::Set() takes ownership of |value|. |
320 dict->Set(kTagValue, value); | 303 dict->Set(kTagValue, value); |
321 settings->Set(key, dict); | 304 settings->Set(key, dict); |
322 DecorateValueDictionary(ui_data, *value, dict); | 305 |
306 const base::Value* recommended_value = ui_data.default_value(); | |
307 if (ui_data.IsManaged()) | |
308 dict->SetString(kTagControlledBy, kTagPolicy); | |
309 else if (recommended_value && recommended_value->Equals(value)) | |
310 dict->SetString(kTagControlledBy, kTagRecommended); | |
311 | |
312 if (recommended_value) | |
313 dict->Set(kTagRecommendedValue, recommended_value->DeepCopy()); | |
323 } | 314 } |
324 | 315 |
325 // Creates a decorated dictionary like SetValueDictionary does, but extended for | 316 // Creates a ManagedState style dictionary. Note(stevenjb): This is bridge code |
pneubeck (no reviews)
2014/07/30 20:12:46
here and in the commit message:
ManagedState -> Ma
stevenjb
2014/07/30 21:57:48
Done.
| |
326 // the Autoconnect property, which respects additionally global network policy. | 317 // until we use GetManagedProperties to retrieve all Shill properties. |
327 void SetAutoconnectValueDictionary(bool network_is_private, | 318 void SetManagedValueDictionary(base::DictionaryValue* settings, |
pneubeck (no reviews)
2014/07/30 20:12:46
nit: should be the last argument
stevenjb
2014/07/30 21:57:48
Fixed here and for SetValueDictionary.
| |
328 ::onc::ONCSource onc_source, | 319 const char* key, |
pneubeck (no reviews)
2014/07/30 20:12:46
const std::string&
stevenjb
2014/07/30 21:57:48
Why?
pneubeck (no reviews)
2014/07/31 20:29:36
This CL has more important changes, that I will sp
| |
329 bool current_autoconnect, | 320 base::Value* value, |
pneubeck (no reviews)
2014/07/30 20:12:46
scoped_ptr (it's actually called with .release() )
stevenjb
2014/07/30 21:57:48
I'm leaving this consistent with SetValueDictionar
pneubeck (no reviews)
2014/07/31 20:29:36
it's documenting ownership.
Otherwise this should
stevenjb
2014/08/01 00:53:41
Commented.
| |
330 const NetworkPropertyUIData& ui_data, | 321 const NetworkPropertyUIData& ui_data) { |
331 base::DictionaryValue* settings) { | |
332 base::DictionaryValue* dict = new base::DictionaryValue(); | 322 base::DictionaryValue* dict = new base::DictionaryValue(); |
333 base::Value* value = new base::FundamentalValue(current_autoconnect); | 323 settings->Set(key, dict); |
334 // DictionaryValue::Set() takes ownership of |value|. | 324 |
335 dict->Set(kTagValue, value); | 325 dict->Set(::onc::kAugmentationActiveSetting, value); // owns |value| |
336 settings->Set(kTagAutoConnect, dict); | 326 if (ui_data.default_value()) { |
337 if (onc_source != ::onc::ONC_SOURCE_USER_POLICY && | 327 std::string effective; |
338 onc_source != ::onc::ONC_SOURCE_DEVICE_POLICY) { | 328 if (ui_data.onc_source() == ::onc::ONC_SOURCE_DEVICE_POLICY) |
pneubeck (no reviews)
2014/07/30 20:12:46
I fear that this is not fully right.
Looking at Ne
stevenjb
2014/07/30 21:57:48
So, this is an intermediate helper function, and e
pneubeck (no reviews)
2014/07/31 20:29:36
In SetValueDictionary, UserSetting / SharedSetting
stevenjb
2014/08/01 00:53:41
I think, now that I have written it all out in the
| |
339 // Autoconnect can be controlled by the GlobalNetworkConfiguration of the | 329 effective = ::onc::kAugmentationDevicePolicy; |
340 // ONC policy. | 330 else if (ui_data.onc_source() == ::onc::ONC_SOURCE_USER_POLICY) |
341 bool only_policy_autoconnect = | 331 effective = ::onc::kAugmentationUserPolicy; |
342 onc::PolicyAllowsOnlyPolicyNetworksToAutoconnect(network_is_private); | 332 else |
343 if (only_policy_autoconnect) { | 333 effective = ::onc::kAugmentationUnmanaged; |
pneubeck (no reviews)
2014/07/30 20:12:46
could potentially also be kAugmentationUserSetting
stevenjb
2014/07/30 21:57:48
Acknowledged.
| |
344 dict->SetString(kTagControlledBy, kTagPolicy); | 334 dict->SetString(::onc::kAugmentationEffectiveSetting, effective); |
345 return; | 335 dict->Set(effective, ui_data.default_value()->DeepCopy()); |
346 } | |
347 } | 336 } |
348 DecorateValueDictionary(ui_data, *value, dict); | |
349 } | 337 } |
350 | 338 |
351 std::string CopyStringFromDictionary(const base::DictionaryValue& source, | 339 std::string CopyStringFromDictionary(const base::DictionaryValue& source, |
352 const std::string& src_key, | 340 const std::string& src_key, |
353 const std::string& dest_key, | 341 const std::string& dest_key, |
354 base::DictionaryValue* dest) { | 342 base::DictionaryValue* dest) { |
355 std::string string_value; | 343 std::string string_value; |
356 if (source.GetStringWithoutPathExpansion(src_key, &string_value)) | 344 if (source.GetStringWithoutPathExpansion(src_key, &string_value)) |
357 dest->SetStringWithoutPathExpansion(dest_key, string_value); | 345 dest->SetStringWithoutPathExpansion(dest_key, string_value); |
358 return string_value; | 346 return string_value; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
423 // the Generic UMTS carrier option if present. | 411 // the Generic UMTS carrier option if present. |
424 if (gsm && (value == shill::kCarrierGenericUMTS)) | 412 if (gsm && (value == shill::kCarrierGenericUMTS)) |
425 return index; | 413 return index; |
426 // For other carriers, the service name will match the carrier name. | 414 // For other carriers, the service name will match the carrier name. |
427 if (value == device->carrier()) | 415 if (value == device->carrier()) |
428 return index; | 416 return index; |
429 } | 417 } |
430 return -1; | 418 return -1; |
431 } | 419 } |
432 | 420 |
433 void PopulateWimaxDetails(const NetworkState* wimax, | |
434 const base::DictionaryValue& shill_properties, | |
435 base::DictionaryValue* dictionary) { | |
436 CopyStringFromDictionary( | |
437 shill_properties, shill::kEapIdentityProperty, kTagIdentity, dictionary); | |
438 } | |
439 | |
440 void CreateDictionaryFromCellularApn(const base::DictionaryValue* apn, | 421 void CreateDictionaryFromCellularApn(const base::DictionaryValue* apn, |
441 base::DictionaryValue* dictionary) { | 422 base::DictionaryValue* dictionary) { |
442 CopyStringFromDictionary(*apn, shill::kApnProperty, kTagApn, dictionary); | 423 CopyStringFromDictionary(*apn, shill::kApnProperty, kTagApn, dictionary); |
443 CopyStringFromDictionary( | 424 CopyStringFromDictionary( |
444 *apn, shill::kApnNetworkIdProperty, kTagNetworkId, dictionary); | 425 *apn, shill::kApnNetworkIdProperty, kTagNetworkId, dictionary); |
445 CopyStringFromDictionary( | 426 CopyStringFromDictionary( |
446 *apn, shill::kApnUsernameProperty, kTagUsername, dictionary); | 427 *apn, shill::kApnUsernameProperty, kTagUsername, dictionary); |
447 CopyStringFromDictionary( | 428 CopyStringFromDictionary( |
448 *apn, shill::kApnPasswordProperty, kTagPassword, dictionary); | 429 *apn, shill::kApnPasswordProperty, kTagPassword, dictionary); |
449 CopyStringFromDictionary(*apn, shill::kApnNameProperty, kTagName, dictionary); | 430 CopyStringFromDictionary(*apn, shill::kApnNameProperty, kTagName, dictionary); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
614 // TODO(stevenjb): Once we eliminate all references to Shill properties, | 595 // TODO(stevenjb): Once we eliminate all references to Shill properties, |
615 // we can switch to using managed_network_configuration_handler which | 596 // we can switch to using managed_network_configuration_handler which |
616 // includes Device properties for Cellular (and skip the call to | 597 // includes Device properties for Cellular (and skip the call to |
617 // onc::TranslateShillServiceToONCPart). For now we copy them over here. | 598 // onc::TranslateShillServiceToONCPart). For now we copy them over here. |
618 scoped_ptr<base::DictionaryValue> shill_properties_with_device( | 599 scoped_ptr<base::DictionaryValue> shill_properties_with_device( |
619 shill_properties.DeepCopy()); | 600 shill_properties.DeepCopy()); |
620 const DeviceState* device = | 601 const DeviceState* device = |
621 NetworkHandler::Get()->network_state_handler()->GetDeviceState( | 602 NetworkHandler::Get()->network_state_handler()->GetDeviceState( |
622 network->device_path()); | 603 network->device_path()); |
623 if (device) { | 604 if (device) { |
624 shill_properties_with_device->Set(shill::kDeviceProperty, | 605 shill_properties_with_device->SetWithoutPathExpansion( |
625 device->properties().DeepCopy()); | 606 shill::kDeviceProperty, device->properties().DeepCopy()); |
607 // Get the hardware MAC address from the DeviceState. | |
608 // (Note: this is done in ManagedNetworkConfigurationHandler but not | |
609 // in NetworkConfigurationHandler). | |
610 if (!device->mac_address().empty()) { | |
611 shill_properties_with_device->SetStringWithoutPathExpansion( | |
612 shill::kAddressProperty, device->mac_address()); | |
613 } | |
626 } | 614 } |
627 scoped_ptr<base::DictionaryValue> dictionary = | 615 scoped_ptr<base::DictionaryValue> dictionary = |
628 onc::TranslateShillServiceToONCPart( | 616 onc::TranslateShillServiceToONCPart( |
629 *shill_properties_with_device, &onc::kNetworkWithStateSignature); | 617 *shill_properties_with_device, &onc::kNetworkWithStateSignature); |
630 | 618 |
631 dictionary->SetString(kNetworkInfoKeyServicePath, network->path()); | 619 dictionary->SetString(kNetworkInfoKeyServicePath, network->path()); |
632 dictionary->SetString( | 620 dictionary->SetString( |
633 kTagErrorState, | 621 kTagErrorMessage, |
634 ash::network_connect::ErrorString(network->error(), network->path())); | 622 ash::network_connect::ErrorString(network->error(), network->path())); |
635 | 623 |
636 dictionary->SetBoolean(kTagRemembered, !network->profile_path().empty()); | 624 dictionary->SetBoolean(kTagRemembered, !network->profile_path().empty()); |
637 bool shared = !network->IsPrivate(); | 625 bool shared = !network->IsPrivate(); |
638 dictionary->SetBoolean(kTagShared, shared); | 626 dictionary->SetBoolean(kTagShared, shared); |
639 | 627 |
640 const std::string& type = network->type(); | 628 const std::string& type = network->type(); |
641 | 629 |
642 const NetworkState* connected_network = | 630 const NetworkState* connected_network = |
643 NetworkHandler::Get()->network_state_handler()->ConnectedNetworkByType( | 631 NetworkHandler::Get()->network_state_handler()->ConnectedNetworkByType( |
644 NetworkTypePattern::Primitive(type)); | 632 NetworkTypePattern::Primitive(type)); |
645 dictionary->SetBoolean(kTagDeviceConnected, connected_network != NULL); | 633 dictionary->SetBoolean(kTagDeviceConnected, connected_network != NULL); |
646 | 634 |
647 if (type == shill::kTypeWimax) | 635 if (type == shill::kTypeCellular) |
648 PopulateWimaxDetails(network, shill_properties, dictionary.get()); | |
649 else if (type == shill::kTypeCellular) | |
650 PopulateCellularDetails(network, shill_properties, dictionary.get()); | 636 PopulateCellularDetails(network, shill_properties, dictionary.get()); |
651 else if (type == shill::kTypeVPN) | 637 else if (type == shill::kTypeVPN) |
652 PopulateVPNDetails(network, shill_properties, dictionary.get()); | 638 PopulateVPNDetails(network, shill_properties, dictionary.get()); |
653 | 639 |
654 return dictionary.Pass(); | 640 return dictionary.Pass(); |
655 } | 641 } |
656 | 642 |
657 // Helper methods for SetIPConfigProperties | 643 // Helper methods for SetIPConfigProperties |
658 bool AppendPropertyKeyIfPresent(const std::string& key, | 644 bool AppendPropertyKeyIfPresent(const std::string& key, |
659 const base::DictionaryValue& old_properties, | 645 const base::DictionaryValue& old_properties, |
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1301 name_server_type = kNameServerTypeGoogle; | 1287 name_server_type = kNameServerTypeGoogle; |
1302 } | 1288 } |
1303 SetValueDictionary(dictionary.get(), | 1289 SetValueDictionary(dictionary.get(), |
1304 kDictionaryStaticIp, | 1290 kDictionaryStaticIp, |
1305 static_ip_dict.release(), | 1291 static_ip_dict.release(), |
1306 property_ui_data); | 1292 property_ui_data); |
1307 | 1293 |
1308 dictionary->SetString(kTagNameServerType, name_server_type); | 1294 dictionary->SetString(kTagNameServerType, name_server_type); |
1309 dictionary->SetString(kTagNameServersGoogle, kGoogleNameServers); | 1295 dictionary->SetString(kTagNameServersGoogle, kGoogleNameServers); |
1310 | 1296 |
1311 // Enable static ip config for Ethernet or WiFi. | |
1312 bool staticIPConfig = network->Matches(NetworkTypePattern::Ethernet()) || | |
1313 network->Matches(NetworkTypePattern::WiFi()); | |
1314 dictionary->SetBoolean(kTagShowStaticIPConfig, staticIPConfig); | |
1315 | |
1316 int priority = 0; | 1297 int priority = 0; |
1317 shill_properties.GetIntegerWithoutPathExpansion( | 1298 shill_properties.GetIntegerWithoutPathExpansion( |
1318 shill::kPriorityProperty, &priority); | 1299 shill::kPriorityProperty, &priority); |
1319 bool preferred = priority > 0; | 1300 bool preferred = priority > 0; |
1320 SetValueDictionary(dictionary.get(), kTagPreferred, | 1301 SetValueDictionary(dictionary.get(), kTagPreferred, |
1321 new base::FundamentalValue(preferred), | 1302 new base::FundamentalValue(preferred), |
1322 property_ui_data); | 1303 property_ui_data); |
1323 | 1304 |
1324 NetworkPropertyUIData auto_connect_ui_data(onc_source); | 1305 NetworkPropertyUIData auto_connect_ui_data(onc_source); |
1325 std::string onc_path_to_auto_connect; | 1306 std::string onc_path_to_auto_connect; |
(...skipping 23 matching lines...) Expand all Loading... | |
1349 "Options_NetworkShowDetailsCellularConnected")); | 1330 "Options_NetworkShowDetailsCellularConnected")); |
1350 } | 1331 } |
1351 } | 1332 } |
1352 if (!onc_path_to_auto_connect.empty()) { | 1333 if (!onc_path_to_auto_connect.empty()) { |
1353 auto_connect_ui_data.ParseOncProperty( | 1334 auto_connect_ui_data.ParseOncProperty( |
1354 onc_source, onc, onc_path_to_auto_connect); | 1335 onc_source, onc, onc_path_to_auto_connect); |
1355 } | 1336 } |
1356 bool auto_connect = false; | 1337 bool auto_connect = false; |
1357 shill_properties.GetBooleanWithoutPathExpansion( | 1338 shill_properties.GetBooleanWithoutPathExpansion( |
1358 shill::kAutoConnectProperty, &auto_connect); | 1339 shill::kAutoConnectProperty, &auto_connect); |
1359 SetAutoconnectValueDictionary(network->IsPrivate(), | 1340 |
1360 onc_source, | 1341 // Autoconnect can be controlled by the GlobalNetworkConfiguration of the |
1361 auto_connect, | 1342 // ONC policy. |
1362 auto_connect_ui_data, | 1343 scoped_ptr<base::Value> auto_connect_value( |
1363 dictionary.get()); | 1344 new base::FundamentalValue(auto_connect)); |
1345 if (!auto_connect_ui_data.IsManaged() && | |
pneubeck (no reviews)
2014/07/30 20:12:46
don't use this IsManaged, as it's referring to the
stevenjb
2014/07/30 21:57:48
Done.
pneubeck (no reviews)
2014/07/31 20:29:36
I meant the onc_source variable in this functions
stevenjb
2014/08/01 00:53:41
GGAHHHHHHH! I get it, I think, but.... I have to t
pneubeck (no reviews)
2014/08/01 16:09:07
Maybe you guessed it already but this behavior of
| |
1346 onc::PolicyAllowsOnlyPolicyNetworksToAutoconnect(network->IsPrivate())) { | |
1347 ::onc::ONCSource source = network->IsPrivate() | |
pneubeck (no reviews)
2014/07/30 20:12:46
Please add a comment (which I should have done in
stevenjb
2014/07/30 21:57:48
Done.
| |
1348 ? ::onc::ONC_SOURCE_USER_POLICY : ::onc::ONC_SOURCE_DEVICE_POLICY; | |
1349 auto_connect_ui_data.SetOncSourceAndValue(source, auto_connect_value.get()); | |
pneubeck (no reviews)
2014/07/30 20:12:46
set the value to 'false' (although it should be th
stevenjb
2014/07/30 21:57:48
Done.
| |
1350 } | |
1351 SetManagedValueDictionary(dictionary.get(), | |
1352 shill::kAutoConnectProperty, | |
1353 auto_connect_value.release(), | |
1354 auto_connect_ui_data); | |
1364 | 1355 |
1365 // Show details dialog | 1356 // Show details dialog |
1366 web_ui()->CallJavascriptFunction(kShowDetailedInfoFunction, *dictionary); | 1357 web_ui()->CallJavascriptFunction(kShowDetailedInfoFunction, *dictionary); |
1367 } | 1358 } |
1368 | 1359 |
1369 gfx::NativeWindow InternetOptionsHandler::GetNativeWindow() const { | 1360 gfx::NativeWindow InternetOptionsHandler::GetNativeWindow() const { |
1370 return web_ui()->GetWebContents()->GetTopLevelNativeWindow(); | 1361 return web_ui()->GetWebContents()->GetTopLevelNativeWindow(); |
1371 } | 1362 } |
1372 | 1363 |
1373 float InternetOptionsHandler::GetScaleFactor() const { | 1364 float InternetOptionsHandler::GetScaleFactor() const { |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1554 dictionary->SetBoolean( | 1545 dictionary->SetBoolean( |
1555 kTagWimaxAvailable, | 1546 kTagWimaxAvailable, |
1556 handler->IsTechnologyAvailable(NetworkTypePattern::Wimax())); | 1547 handler->IsTechnologyAvailable(NetworkTypePattern::Wimax())); |
1557 dictionary->SetBoolean( | 1548 dictionary->SetBoolean( |
1558 kTagWimaxEnabled, | 1549 kTagWimaxEnabled, |
1559 handler->IsTechnologyEnabled(NetworkTypePattern::Wimax())); | 1550 handler->IsTechnologyEnabled(NetworkTypePattern::Wimax())); |
1560 } | 1551 } |
1561 | 1552 |
1562 } // namespace options | 1553 } // namespace options |
1563 } // namespace chromeos | 1554 } // namespace chromeos |
OLD | NEW |