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

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

Issue 2318533002: [Password Generation] Use signatures for form matching (Closed)
Patch Set: Rebase 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..bf57caec2f6d3a320ae3196fb11d417e1a7b7267 100644
--- a/components/autofill/core/browser/autofill_field.cc
+++ b/components/autofill/core/browser/autofill_field.cc
@@ -11,7 +11,6 @@
#include "base/i18n/string_search.h"
#include "base/logging.h"
#include "base/metrics/field_trial.h"
-#include "base/sha1.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
@@ -527,17 +526,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 +631,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::GetFieldSignature() const {
+ return CalculateFieldSignatureByNameAndType(name, form_control_type);
+}
+
+std::string AutofillField::FieldSignatureAsStr() const {
+ return base::UintToString(GetFieldSignature());
}
bool AutofillField::IsFieldFillable() const {
« no previous file with comments | « components/autofill/core/browser/autofill_field.h ('k') | components/autofill/core/browser/autofill_field_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698