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/chromeos/cros/network_library_impl_base.h" | 5 #include "chrome/browser/chromeos/cros/network_library_impl_base.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
11 #include "chrome/browser/chromeos/cros/native_network_parser.h" | 11 #include "chrome/browser/chromeos/cros/native_network_parser.h" |
12 #include "chrome/browser/chromeos/cros/onc_constants.h" | |
13 #include "chrome/browser/chromeos/cros/onc_network_parser.h" | 12 #include "chrome/browser/chromeos/cros/onc_network_parser.h" |
14 #include "chrome/browser/chromeos/network_login_observer.h" | 13 #include "chrome/browser/chromeos/network_login_observer.h" |
15 #include "chrome/browser/chromeos/network_settings/onc_certificate_importer.h" | 14 #include "chromeos/network/onc/onc_certificate_importer.h" |
16 #include "chrome/browser/chromeos/network_settings/onc_signature.h" | 15 #include "chromeos/network/onc/onc_constants.h" |
17 #include "chrome/browser/chromeos/network_settings/onc_utils.h" | 16 #include "chromeos/network/onc/onc_signature.h" |
18 #include "chrome/browser/chromeos/network_settings/onc_validator.h" | 17 #include "chromeos/network/onc/onc_utils.h" |
| 18 #include "chromeos/network/onc/onc_validator.h" |
19 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
20 #include "crypto/nss_util.h" // crypto::GetTPMTokenInfo() for 802.1X and VPN. | 20 #include "crypto/nss_util.h" // crypto::GetTPMTokenInfo() for 802.1X and VPN. |
21 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
22 #include "third_party/cros_system_api/dbus/service_constants.h" | 22 #include "third_party/cros_system_api/dbus/service_constants.h" |
23 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
24 | 24 |
25 using content::BrowserThread; | 25 using content::BrowserThread; |
26 | 26 |
27 namespace chromeos { | 27 namespace chromeos { |
28 | 28 |
29 namespace { | 29 namespace { |
30 | 30 |
31 // Only send network change notifications to observers once every 50ms. | 31 // Only send network change notifications to observers once every 50ms. |
32 const int kNetworkNotifyDelayMs = 50; | 32 const int kNetworkNotifyDelayMs = 50; |
33 | 33 |
34 // How long we should remember that cellular plan payment was received. | 34 // How long we should remember that cellular plan payment was received. |
35 const int kRecentPlanPaymentHours = 6; | 35 const int kRecentPlanPaymentHours = 6; |
36 | 36 |
37 NetworkProfileType GetProfileTypeForSource(NetworkUIData::ONCSource source) { | 37 NetworkProfileType GetProfileTypeForSource(onc::ONCSource source) { |
38 switch (source) { | 38 switch (source) { |
39 case NetworkUIData::ONC_SOURCE_DEVICE_POLICY: | 39 case onc::ONC_SOURCE_DEVICE_POLICY: |
40 return PROFILE_SHARED; | 40 return PROFILE_SHARED; |
41 case NetworkUIData::ONC_SOURCE_USER_POLICY: | 41 case onc::ONC_SOURCE_USER_POLICY: |
42 return PROFILE_USER; | 42 return PROFILE_USER; |
43 case NetworkUIData::ONC_SOURCE_NONE: | 43 case onc::ONC_SOURCE_NONE: |
44 case NetworkUIData::ONC_SOURCE_USER_IMPORT: | 44 case onc::ONC_SOURCE_USER_IMPORT: |
45 return PROFILE_NONE; | 45 return PROFILE_NONE; |
46 } | 46 } |
47 NOTREACHED() << "Unknown ONC source " << source; | 47 NOTREACHED() << "Unknown ONC source " << source; |
48 return PROFILE_NONE; | 48 return PROFILE_NONE; |
49 } | 49 } |
50 | 50 |
51 } // namespace | 51 } // namespace |
52 | 52 |
53 NetworkLibraryImplBase::NetworkLibraryImplBase() | 53 NetworkLibraryImplBase::NetworkLibraryImplBase() |
54 : ethernet_(NULL), | 54 : ethernet_(NULL), |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 result = ethernet_; | 357 result = ethernet_; |
358 if (active_wifi_ && active_wifi_->connected()) | 358 if (active_wifi_ && active_wifi_->connected()) |
359 result = highest_priority(result, active_wifi_); | 359 result = highest_priority(result, active_wifi_); |
360 if (active_cellular_ && active_cellular_->connected()) | 360 if (active_cellular_ && active_cellular_->connected()) |
361 result = highest_priority(result, active_cellular_); | 361 result = highest_priority(result, active_cellular_); |
362 if (active_wimax_ && active_wimax_->connected()) | 362 if (active_wimax_ && active_wimax_->connected()) |
363 result = highest_priority(result, active_wimax_); | 363 result = highest_priority(result, active_wimax_); |
364 return result; | 364 return result; |
365 } | 365 } |
366 | 366 |
367 // Connecting order in logical prefernce. | 367 // Connecting order in logical preference. |
368 const Network* NetworkLibraryImplBase::connecting_network() const { | 368 const Network* NetworkLibraryImplBase::connecting_network() const { |
369 if (ethernet_connecting()) | 369 if (ethernet_connecting()) |
370 return ethernet_network(); | 370 return ethernet_network(); |
371 else if (wifi_connecting()) | 371 else if (wifi_connecting()) |
372 return wifi_network(); | 372 return wifi_network(); |
373 else if (cellular_connecting()) | 373 else if (cellular_connecting()) |
374 return cellular_network(); | 374 return cellular_network(); |
375 else if (wimax_connecting()) | 375 else if (wimax_connecting()) |
376 return wimax_network(); | 376 return wimax_network(); |
377 return NULL; | 377 return NULL; |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1016 break; | 1016 break; |
1017 if (wifi->auto_connect()) { | 1017 if (wifi->auto_connect()) { |
1018 ConnectToWifiNetwork(wifi); | 1018 ConnectToWifiNetwork(wifi); |
1019 break; | 1019 break; |
1020 } | 1020 } |
1021 } | 1021 } |
1022 } | 1022 } |
1023 | 1023 |
1024 bool NetworkLibraryImplBase::LoadOncNetworks(const std::string& onc_blob, | 1024 bool NetworkLibraryImplBase::LoadOncNetworks(const std::string& onc_blob, |
1025 const std::string& passphrase, | 1025 const std::string& passphrase, |
1026 NetworkUIData::ONCSource source, | 1026 onc::ONCSource source, |
1027 bool allow_web_trust_from_policy, | 1027 bool allow_web_trust_from_policy) { |
1028 std::string* error) { | |
1029 NetworkProfile* profile = NULL; | 1028 NetworkProfile* profile = NULL; |
1030 bool from_policy = (source == NetworkUIData::ONC_SOURCE_USER_POLICY || | 1029 bool from_policy = (source == onc::ONC_SOURCE_USER_POLICY || |
1031 source == NetworkUIData::ONC_SOURCE_DEVICE_POLICY); | 1030 source == onc::ONC_SOURCE_DEVICE_POLICY); |
1032 | 1031 |
1033 // Policies are applied to a specific Shill profile. User ONC import however | 1032 // Policies are applied to a specific Shill profile. User ONC import however |
1034 // is applied to whatever profile Shill chooses. This should be the profile | 1033 // is applied to whatever profile Shill chooses. This should be the profile |
1035 // that is already associated with a network and if no profile is associated | 1034 // that is already associated with a network and if no profile is associated |
1036 // yet, it should be the user profile. | 1035 // yet, it should be the user profile. |
1037 if (from_policy) { | 1036 if (from_policy) { |
1038 profile = GetProfileForType(GetProfileTypeForSource(source)); | 1037 profile = GetProfileForType(GetProfileTypeForSource(source)); |
1039 if (profile == NULL) { | 1038 if (profile == NULL) { |
1040 DLOG(WARNING) << "Profile for ONC source " << source << " doesn't exist."; | 1039 DLOG(WARNING) << "Profile for ONC source " |
| 1040 << onc::GetSourceAsString(source) |
| 1041 << " doesn't exist."; |
1041 return false; | 1042 return false; |
1042 } | 1043 } |
1043 } | 1044 } |
1044 | 1045 |
1045 VLOG(2) << __func__ << ": called on " << onc_blob; | 1046 VLOG(2) << __func__ << ": called on " << onc_blob; |
1046 std::string json_error; | |
1047 scoped_ptr<base::DictionaryValue> root_dict = | 1047 scoped_ptr<base::DictionaryValue> root_dict = |
1048 onc::ReadDictionaryFromJson(onc_blob, &json_error); | 1048 onc::ReadDictionaryFromJson(onc_blob); |
1049 if (root_dict.get() == NULL) { | 1049 if (root_dict.get() == NULL) { |
1050 if (error != NULL) | 1050 LOG(WARNING) << "ONC loaded from " << onc::GetSourceAsString(source) |
1051 *error = json_error; | 1051 << " is not a valid JSON dictionary."; |
1052 LOG(WARNING) << "ONC loaded from ONC source " << source | |
1053 << " is not a valid json dictionary: " << json_error; | |
1054 return false; | 1052 return false; |
1055 } | 1053 } |
1056 | 1054 |
1057 // Check and see if this is an encrypted ONC file. If so, decrypt it. | 1055 // Check and see if this is an encrypted ONC file. If so, decrypt it. |
1058 std::string onc_type; | 1056 std::string onc_type; |
1059 root_dict->GetStringWithoutPathExpansion(onc::kType, &onc_type); | 1057 root_dict->GetStringWithoutPathExpansion(onc::kType, &onc_type); |
1060 if (onc_type == onc::kEncryptedConfiguration) { | 1058 if (onc_type == onc::kEncryptedConfiguration) { |
1061 std::string decrypt_error; | 1059 root_dict = onc::Decrypt(passphrase, *root_dict); |
1062 root_dict = onc::Decrypt(passphrase, *root_dict, &decrypt_error); | |
1063 if (root_dict.get() == NULL) { | 1060 if (root_dict.get() == NULL) { |
1064 if (error != NULL) | 1061 LOG(WARNING) << "Couldn't decrypt the ONC from " |
1065 *error = decrypt_error; | 1062 << onc::GetSourceAsString(source); |
1066 LOG(WARNING) << "Couldn't decrypt the ONC from source " << source | |
1067 << " with error: " << decrypt_error; | |
1068 return false; | 1063 return false; |
1069 } | 1064 } |
1070 } | 1065 } |
1071 | 1066 |
1072 // Validate the ONC dictionary. We are liberal and ignore unknown field | 1067 // Validate the ONC dictionary. We are liberal and ignore unknown field |
1073 // names and ignore invalid field names in kRecommended arrays. | 1068 // names and ignore invalid field names in kRecommended arrays. |
1074 onc::Validator validator(false, // Ignore unknown fields. | 1069 onc::Validator validator(false, // Ignore unknown fields. |
1075 false, // Ignore invalid recommended field names. | 1070 false, // Ignore invalid recommended field names. |
1076 true, // Fail on missing fields. | 1071 true, // Fail on missing fields. |
1077 from_policy); | 1072 from_policy); |
(...skipping 20 matching lines...) Expand all Loading... |
1098 | 1093 |
1099 // At least one of NetworkConfigurations or Certificates is required. | 1094 // At least one of NetworkConfigurations or Certificates is required. |
1100 LOG_IF(WARNING, (!has_network_configurations && !has_certificates)) | 1095 LOG_IF(WARNING, (!has_network_configurations && !has_certificates)) |
1101 << "ONC from source " << source | 1096 << "ONC from source " << source |
1102 << " has neither NetworkConfigurations nor Certificates."; | 1097 << " has neither NetworkConfigurations nor Certificates."; |
1103 | 1098 |
1104 if (has_certificates) { | 1099 if (has_certificates) { |
1105 VLOG(2) << "ONC file has " << certificates->GetSize() << " certificates"; | 1100 VLOG(2) << "ONC file has " << certificates->GetSize() << " certificates"; |
1106 | 1101 |
1107 onc::CertificateImporter cert_importer(source, allow_web_trust_from_policy); | 1102 onc::CertificateImporter cert_importer(source, allow_web_trust_from_policy); |
1108 std::string cert_error; | 1103 if (cert_importer.ParseAndStoreCertificates(*certificates) != |
1109 if (!cert_importer.ParseAndStoreCertificates(*certificates, &cert_error)) { | 1104 onc::CertificateImporter::IMPORT_OK) { |
1110 if (error != NULL) | |
1111 *error = cert_error; | |
1112 LOG(WARNING) << "Cannot parse some of the certificates in the ONC from " | 1105 LOG(WARNING) << "Cannot parse some of the certificates in the ONC from " |
1113 << "source " << source << " with error: " << cert_error; | 1106 << onc::GetSourceAsString(source); |
1114 return false; | 1107 return false; |
1115 } | 1108 } |
1116 } | 1109 } |
1117 | 1110 |
1118 std::set<std::string> removal_ids; | 1111 std::set<std::string> removal_ids; |
1119 std::set<std::string>& network_ids(network_source_map_[source]); | 1112 std::set<std::string>& network_ids(network_source_map_[source]); |
1120 network_ids.clear(); | 1113 network_ids.clear(); |
1121 if (has_network_configurations) { | 1114 if (has_network_configurations) { |
1122 VLOG(2) << "ONC file has " << network_configs->GetSize() << " networks"; | 1115 VLOG(2) << "ONC file has " << network_configs->GetSize() << " networks"; |
1123 OncNetworkParser parser(*network_configs, source); | 1116 OncNetworkParser parser(*network_configs, source); |
1124 | 1117 |
1125 // Parse all networks. Bail out if that fails. | 1118 // Parse all networks. Bail out if that fails. |
1126 NetworkOncMap added_onc_map; | 1119 NetworkOncMap added_onc_map; |
1127 ScopedVector<Network> networks; | 1120 ScopedVector<Network> networks; |
1128 for (int i = 0; i < parser.GetNetworkConfigsSize(); i++) { | 1121 for (int i = 0; i < parser.GetNetworkConfigsSize(); i++) { |
1129 // Parse Open Network Configuration blob into a temporary Network object. | 1122 // Parse Open Network Configuration blob into a temporary Network object. |
1130 bool marked_for_removal = false; | 1123 bool marked_for_removal = false; |
1131 Network* network = parser.ParseNetwork(i, &marked_for_removal); | 1124 Network* network = parser.ParseNetwork(i, &marked_for_removal); |
1132 if (!network) { | 1125 if (!network) { |
1133 if (error != NULL) | |
1134 *error = parser.parse_error(); | |
1135 LOG(WARNING) << "Error during parsing network at index " << i | 1126 LOG(WARNING) << "Error during parsing network at index " << i |
1136 << " from ONC source " << source | 1127 << " from ONC source " << onc::GetSourceAsString(source); |
1137 << ": " << parser.parse_error(); | |
1138 return false; | 1128 return false; |
1139 } | 1129 } |
1140 | 1130 |
1141 // Disallow anything but WiFi and Ethernet for device-level policy (which | 1131 // Disallow anything but WiFi and Ethernet for device-level policy (which |
1142 // corresponds to shared networks). See also http://crosbug.com/28741. | 1132 // corresponds to shared networks). See also http://crosbug.com/28741. |
1143 if (source == NetworkUIData::ONC_SOURCE_DEVICE_POLICY && | 1133 if (source == onc::ONC_SOURCE_DEVICE_POLICY && |
1144 network->type() != TYPE_WIFI && | 1134 network->type() != TYPE_WIFI && |
1145 network->type() != TYPE_ETHERNET) { | 1135 network->type() != TYPE_ETHERNET) { |
1146 LOG(WARNING) << "Ignoring device-level policy-pushed network of type " | 1136 LOG(WARNING) << "Ignoring device-level policy-pushed network of type " |
1147 << network->type(); | 1137 << network->type(); |
1148 delete network; | 1138 delete network; |
1149 continue; | 1139 continue; |
1150 } | 1140 } |
1151 | 1141 |
1152 networks.push_back(network); | 1142 networks.push_back(network); |
1153 if (!(source == NetworkUIData::ONC_SOURCE_USER_IMPORT && | 1143 if (!(source == onc::ONC_SOURCE_USER_IMPORT && |
1154 marked_for_removal)) { | 1144 marked_for_removal)) { |
1155 added_onc_map[network->unique_id()] = parser.GetNetworkConfig(i); | 1145 added_onc_map[network->unique_id()] = parser.GetNetworkConfig(i); |
1156 } | 1146 } |
1157 | 1147 |
1158 if (marked_for_removal) | 1148 if (marked_for_removal) |
1159 removal_ids.insert(network->unique_id()); | 1149 removal_ids.insert(network->unique_id()); |
1160 } | 1150 } |
1161 | 1151 |
1162 // Update the ONC map. | 1152 // Update the ONC map. |
1163 for (NetworkOncMap::iterator iter(added_onc_map.begin()); | 1153 for (NetworkOncMap::iterator iter(added_onc_map.begin()); |
1164 iter != added_onc_map.end(); ++iter) { | 1154 iter != added_onc_map.end(); ++iter) { |
1165 const base::DictionaryValue*& entry = network_onc_map_[iter->first]; | 1155 const base::DictionaryValue*& entry = network_onc_map_[iter->first]; |
1166 delete entry; | 1156 delete entry; |
1167 entry = iter->second->DeepCopy(); | 1157 entry = iter->second->DeepCopy(); |
1168 } | 1158 } |
1169 | 1159 |
1170 // Configure the networks. While doing so, collect unique identifiers of the | 1160 // Configure the networks. While doing so, collect unique identifiers of the |
1171 // networks that are defined in the ONC blob in |network_ids|. They're later | 1161 // networks that are defined in the ONC blob in |network_ids|. They're later |
1172 // used to clean out any previously-existing networks that had been | 1162 // used to clean out any previously-existing networks that had been |
1173 // configured through policy but are no longer specified in the updated ONC | 1163 // configured through policy but are no longer specified in the updated ONC |
1174 // blob. | 1164 // blob. |
1175 for (std::vector<Network*>::iterator iter(networks.begin()); | 1165 for (std::vector<Network*>::iterator iter(networks.begin()); |
1176 iter != networks.end(); ++iter) { | 1166 iter != networks.end(); ++iter) { |
1177 Network* network = *iter; | 1167 Network* network = *iter; |
1178 | 1168 |
1179 // Don't configure a network that is supposed to be removed. For | 1169 // Don't configure a network that is supposed to be removed. For |
1180 // policy-managed networks, the "remove" functionality of ONC is ignored. | 1170 // policy-managed networks, the "remove" functionality of ONC is ignored. |
1181 if (source == NetworkUIData::ONC_SOURCE_USER_IMPORT && | 1171 if (source == onc::ONC_SOURCE_USER_IMPORT && |
1182 removal_ids.find(network->unique_id()) != removal_ids.end()) { | 1172 removal_ids.find(network->unique_id()) != removal_ids.end()) { |
1183 continue; | 1173 continue; |
1184 } | 1174 } |
1185 | 1175 |
1186 DictionaryValue dict; | 1176 DictionaryValue dict; |
1187 for (Network::PropertyMap::const_iterator props = | 1177 for (Network::PropertyMap::const_iterator props = |
1188 network->property_map_.begin(); | 1178 network->property_map_.begin(); |
1189 props != network->property_map_.end(); ++props) { | 1179 props != network->property_map_.end(); ++props) { |
1190 std::string key = | 1180 std::string key = |
1191 NativeNetworkParser::property_mapper()->GetKey(props->first); | 1181 NativeNetworkParser::property_mapper()->GetKey(props->first); |
(...skipping 23 matching lines...) Expand all Loading... |
1215 network_ids.insert(network->unique_id()); | 1205 network_ids.insert(network->unique_id()); |
1216 } | 1206 } |
1217 } | 1207 } |
1218 | 1208 |
1219 if (from_policy) { | 1209 if (from_policy) { |
1220 // For policy-managed networks, go through the list of existing remembered | 1210 // For policy-managed networks, go through the list of existing remembered |
1221 // networks and clean out the ones that no longer have a definition in the | 1211 // networks and clean out the ones that no longer have a definition in the |
1222 // ONC blob. We first collect the networks and do the actual deletion later | 1212 // ONC blob. We first collect the networks and do the actual deletion later |
1223 // because ForgetNetwork() changes the remembered network vectors. | 1213 // because ForgetNetwork() changes the remembered network vectors. |
1224 ForgetNetworksById(source, network_ids, false); | 1214 ForgetNetworksById(source, network_ids, false); |
1225 } else if (source == NetworkUIData::ONC_SOURCE_USER_IMPORT) { | 1215 } else if (source == onc::ONC_SOURCE_USER_IMPORT) { |
1226 if (removal_ids.empty()) | 1216 if (removal_ids.empty()) |
1227 return true; | 1217 return true; |
1228 | 1218 |
1229 ForgetNetworksById(source, removal_ids, true); | 1219 ForgetNetworksById(source, removal_ids, true); |
1230 } | 1220 } |
1231 | 1221 |
1232 return true; | 1222 return true; |
1233 } | 1223 } |
1234 | 1224 |
1235 //////////////////////////////////////////////////////////////////////////// | 1225 //////////////////////////////////////////////////////////////////////////// |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1361 // Do not set the active network here. Wait until we parse the network. | 1351 // Do not set the active network here. Wait until we parse the network. |
1362 } | 1352 } |
1363 | 1353 |
1364 // Deletes a network. It must already be removed from any lists. | 1354 // Deletes a network. It must already be removed from any lists. |
1365 void NetworkLibraryImplBase::DeleteNetwork(Network* network) { | 1355 void NetworkLibraryImplBase::DeleteNetwork(Network* network) { |
1366 CHECK(network_map_.find(network->service_path()) == network_map_.end()); | 1356 CHECK(network_map_.find(network->service_path()) == network_map_.end()); |
1367 delete network; | 1357 delete network; |
1368 } | 1358 } |
1369 | 1359 |
1370 void NetworkLibraryImplBase::ForgetNetworksById( | 1360 void NetworkLibraryImplBase::ForgetNetworksById( |
1371 NetworkUIData::ONCSource source, | 1361 onc::ONCSource source, |
1372 std::set<std::string> ids, | 1362 std::set<std::string> ids, |
1373 bool if_found) { | 1363 bool if_found) { |
1374 std::vector<std::string> to_be_forgotten; | 1364 std::vector<std::string> to_be_forgotten; |
1375 for (WifiNetworkVector::iterator i = remembered_wifi_networks_.begin(); | 1365 for (WifiNetworkVector::iterator i = remembered_wifi_networks_.begin(); |
1376 i != remembered_wifi_networks_.end(); ++i) { | 1366 i != remembered_wifi_networks_.end(); ++i) { |
1377 WifiNetwork* wifi_network = *i; | 1367 WifiNetwork* wifi_network = *i; |
1378 if (wifi_network->ui_data().onc_source() == source && | 1368 if (wifi_network->ui_data().onc_source() == source && |
1379 if_found == (ids.find(wifi_network->unique_id()) != ids.end())) | 1369 if_found == (ids.find(wifi_network->unique_id()) != ids.end())) |
1380 to_be_forgotten.push_back(wifi_network->service_path()); | 1370 to_be_forgotten.push_back(wifi_network->service_path()); |
1381 } | 1371 } |
(...skipping 16 matching lines...) Expand all Loading... |
1398 std::pair<NetworkMap::iterator, bool> result = | 1388 std::pair<NetworkMap::iterator, bool> result = |
1399 remembered_network_map_.insert( | 1389 remembered_network_map_.insert( |
1400 std::make_pair(network->service_path(), network)); | 1390 std::make_pair(network->service_path(), network)); |
1401 DCHECK(result.second); // Should only get called with new network. | 1391 DCHECK(result.second); // Should only get called with new network. |
1402 | 1392 |
1403 // See if this is a policy-configured network that has meanwhile been removed. | 1393 // See if this is a policy-configured network that has meanwhile been removed. |
1404 // This situation may arise when the full list of remembered networks is not | 1394 // This situation may arise when the full list of remembered networks is not |
1405 // available to LoadOncNetworks(), which can happen due to the asynchronous | 1395 // available to LoadOncNetworks(), which can happen due to the asynchronous |
1406 // communication between shill and NetworkLibrary. Just tell shill to | 1396 // communication between shill and NetworkLibrary. Just tell shill to |
1407 // delete the network now. | 1397 // delete the network now. |
1408 const NetworkUIData::ONCSource source = network->ui_data().onc_source(); | 1398 const onc::ONCSource source = network->ui_data().onc_source(); |
1409 if (source == NetworkUIData::ONC_SOURCE_USER_POLICY || | 1399 if (source == onc::ONC_SOURCE_USER_POLICY || |
1410 source == NetworkUIData::ONC_SOURCE_DEVICE_POLICY) { | 1400 source == onc::ONC_SOURCE_DEVICE_POLICY) { |
1411 NetworkSourceMap::const_iterator network_id_set( | 1401 NetworkSourceMap::const_iterator network_id_set( |
1412 network_source_map_.find(source)); | 1402 network_source_map_.find(source)); |
1413 if (network_id_set != network_source_map_.end() && | 1403 if (network_id_set != network_source_map_.end() && |
1414 network_id_set->second.find(network->unique_id()) == | 1404 network_id_set->second.find(network->unique_id()) == |
1415 network_id_set->second.end()) { | 1405 network_id_set->second.end()) { |
1416 DeleteRememberedNetwork(network->service_path()); | 1406 DeleteRememberedNetwork(network->service_path()); |
1417 return false; | 1407 return false; |
1418 } | 1408 } |
1419 } | 1409 } |
1420 | 1410 |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1746 GetTpmInfo(); | 1736 GetTpmInfo(); |
1747 return tpm_slot_; | 1737 return tpm_slot_; |
1748 } | 1738 } |
1749 | 1739 |
1750 const std::string& NetworkLibraryImplBase::GetTpmPin() { | 1740 const std::string& NetworkLibraryImplBase::GetTpmPin() { |
1751 GetTpmInfo(); | 1741 GetTpmInfo(); |
1752 return tpm_pin_; | 1742 return tpm_pin_; |
1753 } | 1743 } |
1754 | 1744 |
1755 } // namespace chromeos | 1745 } // namespace chromeos |
OLD | NEW |