Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: chrome/browser/autofill/autofill_ie_toolbar_import_win.cc

Issue 11360055: [Autofill] Rename GetInfo and SetInfo to GetRawInfo and SetRawInfo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase harder Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/autofill/autofill_ie_toolbar_import_win.h" 5 #include "chrome/browser/autofill/autofill_ie_toolbar_import_win.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 if (it == reg_to_field.end()) 143 if (it == reg_to_field.end())
144 continue; // This field is not imported. 144 continue; // This field is not imported.
145 string16 field_value = ReadAndDecryptValue(key, value_name.c_str()); 145 string16 field_value = ReadAndDecryptValue(key, value_name.c_str());
146 if (!field_value.empty()) { 146 if (!field_value.empty()) {
147 has_non_empty_fields = true; 147 has_non_empty_fields = true;
148 if (it->second == CREDIT_CARD_NUMBER) 148 if (it->second == CREDIT_CARD_NUMBER)
149 field_value = DecryptCCNumber(field_value); 149 field_value = DecryptCCNumber(field_value);
150 150
151 // We need to store phone data in |phone| before building the whole number 151 // We need to store phone data in |phone| before building the whole number
152 // at the end. The rest of the fields are set "as is". 152 // at the end. The rest of the fields are set "as is".
153 // TODO(isherman): Call SetCanonicalizedInfo(), rather than SetRawInfo().
153 if (!phone.SetInfo(it->second, field_value)) 154 if (!phone.SetInfo(it->second, field_value))
154 profile->SetInfo(it->second, field_value); 155 profile->SetRawInfo(it->second, field_value);
155 } 156 }
156 } 157 }
157 // Now re-construct the phones if needed. 158 // Now re-construct the phones if needed.
158 string16 constructed_number; 159 string16 constructed_number;
159 if (!phone.IsEmpty() && 160 if (!phone.IsEmpty() &&
160 phone.ParseNumber(std::string("US"), &constructed_number)) { 161 phone.ParseNumber(std::string("US"), &constructed_number)) {
161 profile->SetCanonicalizedInfo(PHONE_HOME_WHOLE_NUMBER, constructed_number); 162 profile->SetCanonicalizedInfo(PHONE_HOME_WHOLE_NUMBER, constructed_number);
162 } 163 }
163 164
164 return has_non_empty_fields; 165 return has_non_empty_fields;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 if (password_hash.empty() && IsEmptySalt(salt)) { 249 if (password_hash.empty() && IsEmptySalt(salt)) {
249 base::win::RegistryKeyIterator iterator_cc(HKEY_CURRENT_USER, 250 base::win::RegistryKeyIterator iterator_cc(HKEY_CURRENT_USER,
250 kCreditCardKey); 251 kCreditCardKey);
251 for (; iterator_cc.Valid(); ++iterator_cc) { 252 for (; iterator_cc.Valid(); ++iterator_cc) {
252 std::wstring key_name(kCreditCardKey); 253 std::wstring key_name(kCreditCardKey);
253 key_name.append(L"\\"); 254 key_name.append(L"\\");
254 key_name.append(iterator_cc.Name()); 255 key_name.append(iterator_cc.Name());
255 RegKey key(HKEY_CURRENT_USER, key_name.c_str(), KEY_READ); 256 RegKey key(HKEY_CURRENT_USER, key_name.c_str(), KEY_READ);
256 CreditCard credit_card; 257 CreditCard credit_card;
257 if (ImportSingleProfile(&credit_card, &key, reg_to_field)) { 258 if (ImportSingleProfile(&credit_card, &key, reg_to_field)) {
258 string16 cc_number = credit_card.GetInfo(CREDIT_CARD_NUMBER); 259 // TODO(isherman): Call into GetCanonicalizedInfo() below, rather than
260 // GetRawInfo().
261 string16 cc_number = credit_card.GetRawInfo(CREDIT_CARD_NUMBER);
259 if (!cc_number.empty()) 262 if (!cc_number.empty())
260 credit_cards->push_back(credit_card); 263 credit_cards->push_back(credit_card);
261 } 264 }
262 } 265 }
263 } 266 }
264 return (profiles->size() + credit_cards->size()) > 0; 267 return (profiles->size() + credit_cards->size()) > 0;
265 } 268 }
266 269
267 bool ImportAutofillDataWin(PersonalDataManager* pdm) { 270 bool ImportAutofillDataWin(PersonalDataManager* pdm) {
268 // In incognito mode we do not have PDM - and we should not import anything. 271 // In incognito mode we do not have PDM - and we should not import anything.
269 if (!pdm) 272 if (!pdm)
270 return false; 273 return false;
271 AutofillImporter *importer = new AutofillImporter(pdm); 274 AutofillImporter *importer = new AutofillImporter(pdm);
272 // importer will self delete. 275 // importer will self delete.
273 return importer->ImportProfiles(); 276 return importer->ImportProfiles();
274 } 277 }
275
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_common_test.cc ('k') | chrome/browser/autofill/autofill_ie_toolbar_import_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698