OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/autofill/core/browser/autofill_ie_toolbar_import_win.h" | 5 #include "components/autofill/core/browser/autofill_ie_toolbar_import_win.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 // password protected. Returns true if data is successfully retrieved. False if | 239 // password protected. Returns true if data is successfully retrieved. False if |
240 // there is no data, data is password protected or error occurred. | 240 // there is no data, data is password protected or error occurred. |
241 bool ImportCurrentUserProfiles(const std::string& app_locale, | 241 bool ImportCurrentUserProfiles(const std::string& app_locale, |
242 std::vector<AutofillProfile>* profiles, | 242 std::vector<AutofillProfile>* profiles, |
243 std::vector<CreditCard>* credit_cards) { | 243 std::vector<CreditCard>* credit_cards) { |
244 DCHECK(profiles); | 244 DCHECK(profiles); |
245 DCHECK(credit_cards); | 245 DCHECK(credit_cards); |
246 | 246 |
247 // Create a map of possible fields for a quick access. | 247 // Create a map of possible fields for a quick access. |
248 RegToFieldMap reg_to_field; | 248 RegToFieldMap reg_to_field; |
249 for (size_t i = 0; i < arraysize(profile_reg_values); ++i) { | 249 for (const auto& profile_reg_value : profile_reg_values) { |
250 reg_to_field[std::wstring(profile_reg_values[i].reg_value_name)] = | 250 reg_to_field[std::wstring(profile_reg_value.reg_value_name)] = |
251 profile_reg_values[i].field_type; | 251 profile_reg_value.field_type; |
252 } | 252 } |
253 | 253 |
254 base::win::RegistryKeyIterator iterator_profiles(HKEY_CURRENT_USER, | 254 base::win::RegistryKeyIterator iterator_profiles(HKEY_CURRENT_USER, |
255 kProfileKey); | 255 kProfileKey); |
256 for (; iterator_profiles.Valid(); ++iterator_profiles) { | 256 for (; iterator_profiles.Valid(); ++iterator_profiles) { |
257 std::wstring key_name(kProfileKey); | 257 std::wstring key_name(kProfileKey); |
258 key_name.append(L"\\"); | 258 key_name.append(L"\\"); |
259 key_name.append(iterator_profiles.Name()); | 259 key_name.append(iterator_profiles.Name()); |
260 RegKey key(HKEY_CURRENT_USER, key_name.c_str(), KEY_READ); | 260 RegKey key(HKEY_CURRENT_USER, key_name.c_str(), KEY_READ); |
261 AutofillProfile profile; | 261 AutofillProfile profile; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 bool ImportAutofillDataWin(PersonalDataManager* pdm) { | 298 bool ImportAutofillDataWin(PersonalDataManager* pdm) { |
299 // In incognito mode we do not have PDM - and we should not import anything. | 299 // In incognito mode we do not have PDM - and we should not import anything. |
300 if (!pdm) | 300 if (!pdm) |
301 return false; | 301 return false; |
302 AutofillImporter* importer = new AutofillImporter(pdm); | 302 AutofillImporter* importer = new AutofillImporter(pdm); |
303 // importer will self delete. | 303 // importer will self delete. |
304 return importer->ImportProfiles(); | 304 return importer->ImportProfiles(); |
305 } | 305 } |
306 | 306 |
307 } // namespace autofill | 307 } // namespace autofill |
OLD | NEW |