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

Side by Side Diff: components/autofill/browser/autofill_profile.cc

Issue 16034018: [Autofill] Support "importing" verified profiles and credit cards. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Improve variable name Created 7 years, 6 months 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
« no previous file with comments | « no previous file | components/autofill/browser/autofill_profile_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "components/autofill/browser/autofill_profile.h" 5 #include "components/autofill/browser/autofill_profile.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <map> 9 #include <map>
10 #include <ostream> 10 #include <ostream>
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 StringToLowerASCII(profile.GetRawInfo(*iter))) { 498 StringToLowerASCII(profile.GetRawInfo(*iter))) {
499 return false; 499 return false;
500 } 500 }
501 } 501 }
502 502
503 return true; 503 return true;
504 } 504 }
505 505
506 void AutofillProfile::OverwriteWithOrAddTo(const AutofillProfile& profile, 506 void AutofillProfile::OverwriteWithOrAddTo(const AutofillProfile& profile,
507 const std::string& app_locale) { 507 const std::string& app_locale) {
508 // Verified profiles should never be overwritten with unverified data.
509 DCHECK(!IsVerified() || profile.IsVerified());
510 set_origin(profile.origin());
511
508 FieldTypeSet field_types; 512 FieldTypeSet field_types;
509 profile.GetNonEmptyTypes(app_locale, &field_types); 513 profile.GetNonEmptyTypes(app_locale, &field_types);
510 514
511 // Only transfer "full" types (e.g. full name) and not fragments (e.g. 515 // Only transfer "full" types (e.g. full name) and not fragments (e.g.
512 // first name, last name). 516 // first name, last name).
513 CollapseCompoundFieldTypes(&field_types); 517 CollapseCompoundFieldTypes(&field_types);
514 518
515 for (FieldTypeSet::const_iterator iter = field_types.begin(); 519 for (FieldTypeSet::const_iterator iter = field_types.begin();
516 iter != field_types.end(); ++iter) { 520 iter != field_types.end(); ++iter) {
517 if (AutofillProfile::SupportsMultiValue(*iter)) { 521 if (AutofillProfile::SupportsMultiValue(*iter)) {
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_STATE)) 864 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_STATE))
861 << " " 865 << " "
862 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_ZIP)) 866 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_ZIP))
863 << " " 867 << " "
864 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)) 868 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY))
865 << " " 869 << " "
866 << UTF16ToUTF8(MultiString(profile, PHONE_HOME_WHOLE_NUMBER)); 870 << UTF16ToUTF8(MultiString(profile, PHONE_HOME_WHOLE_NUMBER));
867 } 871 }
868 872
869 } // namespace autofill 873 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | components/autofill/browser/autofill_profile_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698