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

Unified Diff: components/autofill/core/common/signatures_util.h

Issue 2318533002: [Password Generation] Use signatures for form matching (Closed)
Patch Set: Changes addressed to reviewers' comments 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/common/signatures_util.h
diff --git a/components/autofill/core/common/signatures_util.h b/components/autofill/core/common/signatures_util.h
new file mode 100644
index 0000000000000000000000000000000000000000..a5857d1d61d0c28a5006f1b88e904a1c3b1fbf28
--- /dev/null
+++ b/components/autofill/core/common/signatures_util.h
@@ -0,0 +1,43 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_AUTOFILL_CORE_COMMON_SIGNATURES_UTIL_H_
+#define COMPONENTS_AUTOFILL_CORE_COMMON_SIGNATURES_UTIL_H_
+
+#include <stddef.h>
+
+#include <stdint.h>
+#include <vector>
vabr (Chromium) 2016/09/08 09:13:24 You don't seem to need <vector> in the header.
kolos1 2016/09/08 09:41:39 Done.
+
+#include "base/strings/string16.h"
+
+namespace autofill {
+
+struct FormData;
+struct FormFieldData;
+
+using FormSignature = uint64_t;
+using FieldSignature = uint32_t;
+
+// Calculates form signature based on |form_data|.
+FormSignature CalculateFormSignature(const FormData& form_data);
+
+// Calculates field signature based on |field_name| and |field_type|.
+FieldSignature CalculateFieldSignatureByNameAndType(
+ const base::string16& field_name,
+ const std::string& field_type);
+
+// Calculates field signature based on |field_data|. This function is a proxy to
+// |CalculateFieldSignatureByNameAndType|.
+FieldSignature CalculateFieldSignatureForField(const FormFieldData& field_data);
+
+// Returns 64-bit hash of the string.
+uint64_t StrToHash64Bit(const std::string& str);
vabr (Chromium) 2016/09/08 09:13:24 optional: While you are at it, you should #include
kolos1 2016/09/08 09:41:39 Done.
+
+// Returns 32-bit hash of the string.
+uint32_t StrToHash32Bit(const std::string& str);
+
+}
+
+#endif // COMPONENTS_AUTOFILL_CORE_COMMON_SIGNATURES_UTIL_H_
« no previous file with comments | « components/autofill/core/common/password_form_generation_data.h ('k') | components/autofill/core/common/signatures_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698