Index: components/autofill/core/browser/autofill_profile.cc |
diff --git a/components/autofill/core/browser/autofill_profile.cc b/components/autofill/core/browser/autofill_profile.cc |
index 196910c39f2d00193239af11532e63258f3f84bc..ab4024a8e38a1d2bdcde1bf118f7850d231ad42f 100644 |
--- a/components/autofill/core/browser/autofill_profile.cc |
+++ b/components/autofill/core/browser/autofill_profile.cc |
@@ -15,6 +15,7 @@ |
#include "base/i18n/case_conversion.h" |
#include "base/i18n/char_iterator.h" |
#include "base/logging.h" |
+#include "base/sha1.h" |
#include "base/strings/string_util.h" |
#include "base/strings/utf_string_conversion_utils.h" |
#include "base/strings/utf_string_conversions.h" |
@@ -267,7 +268,8 @@ AutofillProfile::AutofillProfile(RecordType type, const std::string& server_id) |
record_type_(type), |
name_(1), |
email_(1), |
- phone_number_(1, PhoneNumber(this)) { |
+ phone_number_(1, PhoneNumber(this)), |
+ server_id_(server_id) { |
DCHECK(type == SERVER_PROFILE); |
} |
@@ -311,6 +313,8 @@ AutofillProfile& AutofillProfile::operator=(const AutofillProfile& profile) { |
address_ = profile.address_; |
set_language_code(profile.language_code()); |
+ server_id_ = profile.server_id(); |
+ |
return *this; |
} |
@@ -824,6 +828,26 @@ void AutofillProfile::CreateInferredLabels( |
} |
} |
+void AutofillProfile::GenerateServerProfileIdentifier() { |
+ DCHECK_EQ(SERVER_PROFILE, record_type()); |
+ std::string contents = |
brettw
2015/04/07 18:04:06
I would write this with different lines of content
Evan Stade
2015/04/07 19:23:32
Done.
|
+ UTF16ToUTF8(MultiString(*this, NAME_FIRST)) |
+ + UTF16ToUTF8(MultiString(*this, NAME_MIDDLE)) |
+ + UTF16ToUTF8(MultiString(*this, NAME_LAST)) |
+ + UTF16ToUTF8(MultiString(*this, EMAIL_ADDRESS)) |
+ + UTF16ToUTF8(GetRawInfo(COMPANY_NAME)) |
+ + UTF16ToUTF8(GetRawInfo(ADDRESS_HOME_STREET_ADDRESS)) |
+ + UTF16ToUTF8(GetRawInfo(ADDRESS_HOME_DEPENDENT_LOCALITY)) |
+ + UTF16ToUTF8(GetRawInfo(ADDRESS_HOME_CITY)) |
+ + UTF16ToUTF8(GetRawInfo(ADDRESS_HOME_STATE)) |
+ + UTF16ToUTF8(GetRawInfo(ADDRESS_HOME_ZIP)) |
+ + UTF16ToUTF8(GetRawInfo(ADDRESS_HOME_SORTING_CODE)) |
+ + UTF16ToUTF8(GetRawInfo(ADDRESS_HOME_COUNTRY)) |
+ + UTF16ToUTF8(MultiString(*this, PHONE_HOME_WHOLE_NUMBER)) |
+ + language_code(); |
+ server_id_ = base::SHA1HashString(contents); |
+} |
+ |
// static |
base::string16 AutofillProfile::CanonicalizeProfileString( |
const base::string16& str) { |