OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/native_network_parser.h" | 5 #include "chrome/browser/chromeos/cros/native_network_parser.h" |
6 | 6 |
7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
8 #include "chrome/browser/chromeos/cros/native_network_constants.h" | 8 #include "chrome/browser/chromeos/cros/native_network_constants.h" |
9 #include "chrome/browser/chromeos/cros/network_library.h" | 9 #include "chrome/browser/chromeos/cros/network_library.h" |
10 #include "chrome/browser/chromeos/login/user_manager.h" | 10 #include "chrome/browser/chromeos/login/user_manager.h" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 return true; | 187 return true; |
188 } | 188 } |
189 case PROPERTY_INDEX_CELLULAR_ALLOW_ROAMING: { | 189 case PROPERTY_INDEX_CELLULAR_ALLOW_ROAMING: { |
190 bool data_roaming_allowed; | 190 bool data_roaming_allowed; |
191 if (!value.GetAsBoolean(&data_roaming_allowed)) | 191 if (!value.GetAsBoolean(&data_roaming_allowed)) |
192 return false; | 192 return false; |
193 device->set_data_roaming_allowed(data_roaming_allowed); | 193 device->set_data_roaming_allowed(data_roaming_allowed); |
194 return true; | 194 return true; |
195 } | 195 } |
196 case PROPERTY_INDEX_CELLULAR_APN_LIST: | 196 case PROPERTY_INDEX_CELLULAR_APN_LIST: |
197 if (value.IsType(Value::TYPE_LIST)) { | 197 if (ListValue* list = value.AsList()) { |
198 CellularApnList provider_apn_list; | 198 CellularApnList provider_apn_list; |
199 if (!ParseApnList(static_cast<const ListValue&>(value), | 199 if (!ParseApnList(list, &provider_apn_list)) |
200 &provider_apn_list)) | |
201 return false; | 200 return false; |
202 device->set_provider_apn_list(provider_apn_list); | 201 device->set_provider_apn_list(provider_apn_list); |
203 return true; | 202 return true; |
204 } | 203 } |
205 break; | 204 break; |
206 case PROPERTY_INDEX_NETWORKS: | 205 case PROPERTY_INDEX_NETWORKS: |
207 if (value.IsType(Value::TYPE_LIST)) { | 206 if (value.AsList()) { |
208 // Ignored. | 207 // Ignored. |
209 return true; | 208 return true; |
210 } | 209 } |
211 break; | 210 break; |
212 case PROPERTY_INDEX_FOUND_NETWORKS: | 211 case PROPERTY_INDEX_FOUND_NETWORKS: |
213 if (value.IsType(Value::TYPE_LIST)) { | 212 if (ListValue* list = value.AsList()) { |
214 CellularNetworkList found_cellular_networks; | 213 CellularNetworkList found_cellular_networks; |
215 if (!ParseFoundNetworksFromList( | 214 if (!ParseFoundNetworksFromList(list, &found_cellular_networks)) |
216 static_cast<const ListValue&>(value), | |
217 &found_cellular_networks)) | |
218 return false; | 215 return false; |
219 device->set_found_cellular_networks(found_cellular_networks); | 216 device->set_found_cellular_networks(found_cellular_networks); |
220 return true; | 217 return true; |
221 } | 218 } |
222 break; | 219 break; |
223 case PROPERTY_INDEX_HOME_PROVIDER: { | 220 case PROPERTY_INDEX_HOME_PROVIDER: { |
224 if (value.IsType(Value::TYPE_DICTIONARY)) { | 221 if (value.IsType(Value::TYPE_DICTIONARY)) { |
225 const DictionaryValue& dict = | 222 const DictionaryValue& dict = |
226 static_cast<const DictionaryValue&>(value); | 223 static_cast<const DictionaryValue&>(value); |
227 std::string home_provider_code; | 224 std::string home_provider_code; |
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1156 static EnumMapper<ProviderType>::Pair table[] = { | 1153 static EnumMapper<ProviderType>::Pair table[] = { |
1157 { kProviderL2tpIpsec, PROVIDER_TYPE_L2TP_IPSEC_PSK }, | 1154 { kProviderL2tpIpsec, PROVIDER_TYPE_L2TP_IPSEC_PSK }, |
1158 { kProviderOpenVpn, PROVIDER_TYPE_OPEN_VPN }, | 1155 { kProviderOpenVpn, PROVIDER_TYPE_OPEN_VPN }, |
1159 }; | 1156 }; |
1160 static EnumMapper<ProviderType> parser( | 1157 static EnumMapper<ProviderType> parser( |
1161 table, arraysize(table), PROVIDER_TYPE_MAX); | 1158 table, arraysize(table), PROVIDER_TYPE_MAX); |
1162 return parser.Get(type); | 1159 return parser.Get(type); |
1163 } | 1160 } |
1164 | 1161 |
1165 } // namespace chromeos | 1162 } // namespace chromeos |
OLD | NEW |