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

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

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/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..15be6ae210731ee4e60f16a692341d4c72af268b
--- /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 <string>
+
+#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);
+
+// 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