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 "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 Loading... |
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 piecemeal. |
| 509 DCHECK(!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 Loading... |
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 |
OLD | NEW |