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/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 961 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) { | 1028 std::string* error) { |
| 1029 NetworkProfile* profile = NULL; | 1029 NetworkProfile* profile = NULL; |
| 1030 bool from_policy = (source == NetworkUIData::ONC_SOURCE_USER_POLICY || | 1030 bool from_policy = (source == onc::ONC_SOURCE_USER_POLICY || |
| 1031 source == NetworkUIData::ONC_SOURCE_DEVICE_POLICY); | 1031 source == onc::ONC_SOURCE_DEVICE_POLICY); |
| 1032 | 1032 |
| 1033 // Policies are applied to a specific Shill profile. User ONC import however | 1033 // 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 | 1034 // 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 | 1035 // that is already associated with a network and if no profile is associated |
| 1036 // yet, it should be the user profile. | 1036 // yet, it should be the user profile. |
| 1037 if (from_policy) { | 1037 if (from_policy) { |
| 1038 profile = GetProfileForType(GetProfileTypeForSource(source)); | 1038 profile = GetProfileForType(GetProfileTypeForSource(source)); |
| 1039 if (profile == NULL) { | 1039 if (profile == NULL) { |
| 1040 DLOG(WARNING) << "Profile for ONC source " << source << " doesn't exist."; | 1040 DLOG(WARNING) << "Profile for ONC source " << source << " doesn't exist."; |
| 1041 return false; | 1041 return false; |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 1055 } | 1055 } |
| 1056 | 1056 |
| 1057 // Check and see if this is an encrypted ONC file. If so, decrypt it. | 1057 // Check and see if this is an encrypted ONC file. If so, decrypt it. |
| 1058 std::string onc_type; | 1058 std::string onc_type; |
| 1059 root_dict->GetStringWithoutPathExpansion(onc::kType, &onc_type); | 1059 root_dict->GetStringWithoutPathExpansion(onc::kType, &onc_type); |
| 1060 if (onc_type == onc::kEncryptedConfiguration) { | 1060 if (onc_type == onc::kEncryptedConfiguration) { |
| 1061 std::string decrypt_error; | 1061 std::string decrypt_error; |
| 1062 root_dict = onc::Decrypt(passphrase, *root_dict, &decrypt_error); | 1062 root_dict = onc::Decrypt(passphrase, *root_dict, &decrypt_error); |
| 1063 if (root_dict.get() == NULL) { | 1063 if (root_dict.get() == NULL) { |
| 1064 if (error != NULL) | 1064 if (error != NULL) |
| 1065 *error = decrypt_error; | 1065 *error = decrypt_error; |
|
pneubeck (no reviews)
2012/12/04 10:43:56
We shouldn't forward constants here. They are/shou
Greg Spencer (Chromium)
2012/12/07 18:12:27
No longer forwarding.
| |
| 1066 LOG(WARNING) << "Couldn't decrypt the ONC from source " << source | 1066 LOG(WARNING) << "Couldn't decrypt the ONC from source " << source |
| 1067 << " with error: " << decrypt_error; | 1067 << " with error: " << decrypt_error; |
|
pneubeck (no reviews)
2012/12/04 10:43:56
No need to log decrypt_error, as it is already log
Greg Spencer (Chromium)
2012/12/07 18:12:27
Done.
| |
| 1068 return false; | 1068 return false; |
| 1069 } | 1069 } |
| 1070 } | 1070 } |
| 1071 | 1071 |
| 1072 // Validate the ONC dictionary. We are liberal and ignore unknown field | 1072 // Validate the ONC dictionary. We are liberal and ignore unknown field |
| 1073 // names and ignore invalid field names in kRecommended arrays. | 1073 // names and ignore invalid field names in kRecommended arrays. |
| 1074 onc::Validator validator(false, // Ignore unknown fields. | 1074 onc::Validator validator(false, // Ignore unknown fields. |
| 1075 false, // Ignore invalid recommended field names. | 1075 false, // Ignore invalid recommended field names. |
| 1076 true, // Fail on missing fields. | 1076 true, // Fail on missing fields. |
| 1077 from_policy); | 1077 from_policy); |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 1098 | 1098 |
| 1099 // At least one of NetworkConfigurations or Certificates is required. | 1099 // At least one of NetworkConfigurations or Certificates is required. |
| 1100 LOG_IF(WARNING, (!has_network_configurations && !has_certificates)) | 1100 LOG_IF(WARNING, (!has_network_configurations && !has_certificates)) |
| 1101 << "ONC from source " << source | 1101 << "ONC from source " << source |
| 1102 << " has neither NetworkConfigurations nor Certificates."; | 1102 << " has neither NetworkConfigurations nor Certificates."; |
| 1103 | 1103 |
| 1104 if (has_certificates) { | 1104 if (has_certificates) { |
| 1105 VLOG(2) << "ONC file has " << certificates->GetSize() << " certificates"; | 1105 VLOG(2) << "ONC file has " << certificates->GetSize() << " certificates"; |
| 1106 | 1106 |
| 1107 onc::CertificateImporter cert_importer(source, allow_web_trust_from_policy); | 1107 onc::CertificateImporter cert_importer(source, allow_web_trust_from_policy); |
| 1108 std::string cert_error; | 1108 if (!cert_importer.ParseAndStoreCertificates(*certificates, error)) { |
|
pneubeck (no reviews)
2012/12/04 10:43:56
same here, we shouldn't forward the error strings.
Greg Spencer (Chromium)
2012/12/07 18:12:27
Done.
| |
| 1109 if (!cert_importer.ParseAndStoreCertificates(*certificates, &cert_error)) { | |
| 1110 if (error != NULL) | |
| 1111 *error = cert_error; | |
| 1112 LOG(WARNING) << "Cannot parse some of the certificates in the ONC from " | 1109 LOG(WARNING) << "Cannot parse some of the certificates in the ONC from " |
| 1113 << "source " << source << " with error: " << cert_error; | 1110 << "source " << source << " with error: " << *error; |
|
pneubeck (no reviews)
2012/12/04 10:43:56
We don't have to log this error as it is logged al
Greg Spencer (Chromium)
2012/12/07 18:12:27
Done.
| |
| 1114 return false; | 1111 return false; |
| 1115 } | 1112 } |
| 1116 } | 1113 } |
| 1117 | 1114 |
| 1118 std::set<std::string> removal_ids; | 1115 std::set<std::string> removal_ids; |
| 1119 std::set<std::string>& network_ids(network_source_map_[source]); | 1116 std::set<std::string>& network_ids(network_source_map_[source]); |
| 1120 network_ids.clear(); | 1117 network_ids.clear(); |
| 1121 if (has_network_configurations) { | 1118 if (has_network_configurations) { |
| 1122 VLOG(2) << "ONC file has " << network_configs->GetSize() << " networks"; | 1119 VLOG(2) << "ONC file has " << network_configs->GetSize() << " networks"; |
| 1123 OncNetworkParser parser(*network_configs, source); | 1120 OncNetworkParser parser(*network_configs, source); |
| 1124 | 1121 |
| 1125 // Parse all networks. Bail out if that fails. | 1122 // Parse all networks. Bail out if that fails. |
| 1126 NetworkOncMap added_onc_map; | 1123 NetworkOncMap added_onc_map; |
| 1127 ScopedVector<Network> networks; | 1124 ScopedVector<Network> networks; |
| 1128 for (int i = 0; i < parser.GetNetworkConfigsSize(); i++) { | 1125 for (int i = 0; i < parser.GetNetworkConfigsSize(); i++) { |
| 1129 // Parse Open Network Configuration blob into a temporary Network object. | 1126 // Parse Open Network Configuration blob into a temporary Network object. |
| 1130 bool marked_for_removal = false; | 1127 bool marked_for_removal = false; |
| 1131 Network* network = parser.ParseNetwork(i, &marked_for_removal); | 1128 Network* network = parser.ParseNetwork(i, &marked_for_removal); |
| 1132 if (!network) { | 1129 if (!network) { |
| 1133 if (error != NULL) | 1130 if (error != NULL) |
| 1134 *error = parser.parse_error(); | 1131 *error = parser.parse_error(); |
| 1135 LOG(WARNING) << "Error during parsing network at index " << i | 1132 LOG(WARNING) << "Error during parsing network at index " << i |
| 1136 << " from ONC source " << source | 1133 << " from ONC source " << source |
| 1137 << ": " << parser.parse_error(); | 1134 << ": " << parser.parse_error(); |
| 1138 return false; | 1135 return false; |
| 1139 } | 1136 } |
| 1140 | 1137 |
| 1141 // Disallow anything but WiFi and Ethernet for device-level policy (which | 1138 // Disallow anything but WiFi and Ethernet for device-level policy (which |
| 1142 // corresponds to shared networks). See also http://crosbug.com/28741. | 1139 // corresponds to shared networks). See also http://crosbug.com/28741. |
| 1143 if (source == NetworkUIData::ONC_SOURCE_DEVICE_POLICY && | 1140 if (source == onc::ONC_SOURCE_DEVICE_POLICY && |
| 1144 network->type() != TYPE_WIFI && | 1141 network->type() != TYPE_WIFI && |
| 1145 network->type() != TYPE_ETHERNET) { | 1142 network->type() != TYPE_ETHERNET) { |
| 1146 LOG(WARNING) << "Ignoring device-level policy-pushed network of type " | 1143 LOG(WARNING) << "Ignoring device-level policy-pushed network of type " |
| 1147 << network->type(); | 1144 << network->type(); |
| 1148 delete network; | 1145 delete network; |
| 1149 continue; | 1146 continue; |
| 1150 } | 1147 } |
| 1151 | 1148 |
| 1152 networks.push_back(network); | 1149 networks.push_back(network); |
| 1153 if (!(source == NetworkUIData::ONC_SOURCE_USER_IMPORT && | 1150 if (!(source == onc::ONC_SOURCE_USER_IMPORT && |
| 1154 marked_for_removal)) { | 1151 marked_for_removal)) { |
| 1155 added_onc_map[network->unique_id()] = parser.GetNetworkConfig(i); | 1152 added_onc_map[network->unique_id()] = parser.GetNetworkConfig(i); |
| 1156 } | 1153 } |
| 1157 | 1154 |
| 1158 if (marked_for_removal) | 1155 if (marked_for_removal) |
| 1159 removal_ids.insert(network->unique_id()); | 1156 removal_ids.insert(network->unique_id()); |
| 1160 } | 1157 } |
| 1161 | 1158 |
| 1162 // Update the ONC map. | 1159 // Update the ONC map. |
| 1163 for (NetworkOncMap::iterator iter(added_onc_map.begin()); | 1160 for (NetworkOncMap::iterator iter(added_onc_map.begin()); |
| 1164 iter != added_onc_map.end(); ++iter) { | 1161 iter != added_onc_map.end(); ++iter) { |
| 1165 const base::DictionaryValue*& entry = network_onc_map_[iter->first]; | 1162 const base::DictionaryValue*& entry = network_onc_map_[iter->first]; |
| 1166 delete entry; | 1163 delete entry; |
| 1167 entry = iter->second->DeepCopy(); | 1164 entry = iter->second->DeepCopy(); |
| 1168 } | 1165 } |
| 1169 | 1166 |
| 1170 // Configure the networks. While doing so, collect unique identifiers of the | 1167 // 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 | 1168 // 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 | 1169 // used to clean out any previously-existing networks that had been |
| 1173 // configured through policy but are no longer specified in the updated ONC | 1170 // configured through policy but are no longer specified in the updated ONC |
| 1174 // blob. | 1171 // blob. |
| 1175 for (std::vector<Network*>::iterator iter(networks.begin()); | 1172 for (std::vector<Network*>::iterator iter(networks.begin()); |
| 1176 iter != networks.end(); ++iter) { | 1173 iter != networks.end(); ++iter) { |
| 1177 Network* network = *iter; | 1174 Network* network = *iter; |
| 1178 | 1175 |
| 1179 // Don't configure a network that is supposed to be removed. For | 1176 // Don't configure a network that is supposed to be removed. For |
| 1180 // policy-managed networks, the "remove" functionality of ONC is ignored. | 1177 // policy-managed networks, the "remove" functionality of ONC is ignored. |
| 1181 if (source == NetworkUIData::ONC_SOURCE_USER_IMPORT && | 1178 if (source == onc::ONC_SOURCE_USER_IMPORT && |
| 1182 removal_ids.find(network->unique_id()) != removal_ids.end()) { | 1179 removal_ids.find(network->unique_id()) != removal_ids.end()) { |
| 1183 continue; | 1180 continue; |
| 1184 } | 1181 } |
| 1185 | 1182 |
| 1186 DictionaryValue dict; | 1183 DictionaryValue dict; |
| 1187 for (Network::PropertyMap::const_iterator props = | 1184 for (Network::PropertyMap::const_iterator props = |
| 1188 network->property_map_.begin(); | 1185 network->property_map_.begin(); |
| 1189 props != network->property_map_.end(); ++props) { | 1186 props != network->property_map_.end(); ++props) { |
| 1190 std::string key = | 1187 std::string key = |
| 1191 NativeNetworkParser::property_mapper()->GetKey(props->first); | 1188 NativeNetworkParser::property_mapper()->GetKey(props->first); |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 1215 network_ids.insert(network->unique_id()); | 1212 network_ids.insert(network->unique_id()); |
| 1216 } | 1213 } |
| 1217 } | 1214 } |
| 1218 | 1215 |
| 1219 if (from_policy) { | 1216 if (from_policy) { |
| 1220 // For policy-managed networks, go through the list of existing remembered | 1217 // 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 | 1218 // 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 | 1219 // ONC blob. We first collect the networks and do the actual deletion later |
| 1223 // because ForgetNetwork() changes the remembered network vectors. | 1220 // because ForgetNetwork() changes the remembered network vectors. |
| 1224 ForgetNetworksById(source, network_ids, false); | 1221 ForgetNetworksById(source, network_ids, false); |
| 1225 } else if (source == NetworkUIData::ONC_SOURCE_USER_IMPORT) { | 1222 } else if (source == onc::ONC_SOURCE_USER_IMPORT) { |
| 1226 if (removal_ids.empty()) | 1223 if (removal_ids.empty()) |
| 1227 return true; | 1224 return true; |
| 1228 | 1225 |
| 1229 ForgetNetworksById(source, removal_ids, true); | 1226 ForgetNetworksById(source, removal_ids, true); |
| 1230 } | 1227 } |
| 1231 | 1228 |
| 1232 return true; | 1229 return true; |
| 1233 } | 1230 } |
| 1234 | 1231 |
| 1235 //////////////////////////////////////////////////////////////////////////// | 1232 //////////////////////////////////////////////////////////////////////////// |
| (...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. | 1358 // Do not set the active network here. Wait until we parse the network. |
| 1362 } | 1359 } |
| 1363 | 1360 |
| 1364 // Deletes a network. It must already be removed from any lists. | 1361 // Deletes a network. It must already be removed from any lists. |
| 1365 void NetworkLibraryImplBase::DeleteNetwork(Network* network) { | 1362 void NetworkLibraryImplBase::DeleteNetwork(Network* network) { |
| 1366 CHECK(network_map_.find(network->service_path()) == network_map_.end()); | 1363 CHECK(network_map_.find(network->service_path()) == network_map_.end()); |
| 1367 delete network; | 1364 delete network; |
| 1368 } | 1365 } |
| 1369 | 1366 |
| 1370 void NetworkLibraryImplBase::ForgetNetworksById( | 1367 void NetworkLibraryImplBase::ForgetNetworksById( |
| 1371 NetworkUIData::ONCSource source, | 1368 onc::ONCSource source, |
| 1372 std::set<std::string> ids, | 1369 std::set<std::string> ids, |
| 1373 bool if_found) { | 1370 bool if_found) { |
| 1374 std::vector<std::string> to_be_forgotten; | 1371 std::vector<std::string> to_be_forgotten; |
| 1375 for (WifiNetworkVector::iterator i = remembered_wifi_networks_.begin(); | 1372 for (WifiNetworkVector::iterator i = remembered_wifi_networks_.begin(); |
| 1376 i != remembered_wifi_networks_.end(); ++i) { | 1373 i != remembered_wifi_networks_.end(); ++i) { |
| 1377 WifiNetwork* wifi_network = *i; | 1374 WifiNetwork* wifi_network = *i; |
| 1378 if (wifi_network->ui_data().onc_source() == source && | 1375 if (wifi_network->ui_data().onc_source() == source && |
| 1379 if_found == (ids.find(wifi_network->unique_id()) != ids.end())) | 1376 if_found == (ids.find(wifi_network->unique_id()) != ids.end())) |
| 1380 to_be_forgotten.push_back(wifi_network->service_path()); | 1377 to_be_forgotten.push_back(wifi_network->service_path()); |
| 1381 } | 1378 } |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 1398 std::pair<NetworkMap::iterator, bool> result = | 1395 std::pair<NetworkMap::iterator, bool> result = |
| 1399 remembered_network_map_.insert( | 1396 remembered_network_map_.insert( |
| 1400 std::make_pair(network->service_path(), network)); | 1397 std::make_pair(network->service_path(), network)); |
| 1401 DCHECK(result.second); // Should only get called with new network. | 1398 DCHECK(result.second); // Should only get called with new network. |
| 1402 | 1399 |
| 1403 // See if this is a policy-configured network that has meanwhile been removed. | 1400 // 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 | 1401 // This situation may arise when the full list of remembered networks is not |
| 1405 // available to LoadOncNetworks(), which can happen due to the asynchronous | 1402 // available to LoadOncNetworks(), which can happen due to the asynchronous |
| 1406 // communication between shill and NetworkLibrary. Just tell shill to | 1403 // communication between shill and NetworkLibrary. Just tell shill to |
| 1407 // delete the network now. | 1404 // delete the network now. |
| 1408 const NetworkUIData::ONCSource source = network->ui_data().onc_source(); | 1405 const onc::ONCSource source = network->ui_data().onc_source(); |
| 1409 if (source == NetworkUIData::ONC_SOURCE_USER_POLICY || | 1406 if (source == onc::ONC_SOURCE_USER_POLICY || |
| 1410 source == NetworkUIData::ONC_SOURCE_DEVICE_POLICY) { | 1407 source == onc::ONC_SOURCE_DEVICE_POLICY) { |
| 1411 NetworkSourceMap::const_iterator network_id_set( | 1408 NetworkSourceMap::const_iterator network_id_set( |
| 1412 network_source_map_.find(source)); | 1409 network_source_map_.find(source)); |
| 1413 if (network_id_set != network_source_map_.end() && | 1410 if (network_id_set != network_source_map_.end() && |
| 1414 network_id_set->second.find(network->unique_id()) == | 1411 network_id_set->second.find(network->unique_id()) == |
| 1415 network_id_set->second.end()) { | 1412 network_id_set->second.end()) { |
| 1416 DeleteRememberedNetwork(network->service_path()); | 1413 DeleteRememberedNetwork(network->service_path()); |
| 1417 return false; | 1414 return false; |
| 1418 } | 1415 } |
| 1419 } | 1416 } |
| 1420 | 1417 |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1746 GetTpmInfo(); | 1743 GetTpmInfo(); |
| 1747 return tpm_slot_; | 1744 return tpm_slot_; |
| 1748 } | 1745 } |
| 1749 | 1746 |
| 1750 const std::string& NetworkLibraryImplBase::GetTpmPin() { | 1747 const std::string& NetworkLibraryImplBase::GetTpmPin() { |
| 1751 GetTpmInfo(); | 1748 GetTpmInfo(); |
| 1752 return tpm_pin_; | 1749 return tpm_pin_; |
| 1753 } | 1750 } |
| 1754 | 1751 |
| 1755 } // namespace chromeos | 1752 } // namespace chromeos |
| OLD | NEW |