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

Unified Diff: components/autofill/core/browser/autofill_field.cc

Issue 2318533002: [Password Generation] Use signatures for form matching (Closed)
Patch Set: Sent to review Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: components/autofill/core/browser/autofill_field.cc
diff --git a/components/autofill/core/browser/autofill_field.cc b/components/autofill/core/browser/autofill_field.cc
index 403be3659aea8c6111f61545d694d5fff70e6a4f..4dfedc99ad84dcff59ee492fff85fc42f0453a69 100644
--- a/components/autofill/core/browser/autofill_field.cc
+++ b/components/autofill/core/browser/autofill_field.cc
@@ -527,17 +527,6 @@ bool FillExpirationDateInput(const base::string16 &value,
return true;
}
-std::string Hash32Bit(const std::string& str) {
- std::string hash_bin = base::SHA1HashString(str);
- DCHECK_EQ(base::kSHA1Length, hash_bin.length());
-
- uint32_t hash32 = ((hash_bin[0] & 0xFF) << 24) |
- ((hash_bin[1] & 0xFF) << 16) | ((hash_bin[2] & 0xFF) << 8) |
- (hash_bin[3] & 0xFF);
-
- return base::UintToString(hash32);
-}
-
base::string16 RemoveWhitespace(const base::string16& value) {
base::string16 stripped_value;
base::RemoveChars(value, base::kWhitespaceUTF16, &stripped_value);
@@ -643,10 +632,12 @@ bool AutofillField::IsEmpty() const {
return value.empty();
}
-std::string AutofillField::FieldSignature() const {
- std::string field_name = base::UTF16ToUTF8(name);
- std::string field_string = field_name + "&" + form_control_type;
- return Hash32Bit(field_string);
+FieldSignature AutofillField::FieldSignature() const {
+ return CalculateFieldSignatureByNameAndType(name, form_control_type);
+}
+
+std::string AutofillField::FieldSignatureAsStr() const {
+ return base::UintToString(FieldSignature());
}
bool AutofillField::IsFieldFillable() const {

Powered by Google App Engine
This is Rietveld 408576698