Chromium Code Reviews| 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..6b1099b221524feee5e64ffe0323611a2c0acba1 |
| --- /dev/null |
| +++ b/components/autofill/core/common/signatures_util.h |
| @@ -0,0 +1,42 @@ |
| +// 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> |
| + |
| +#include "base/strings/string16.h" |
| +#include "components/autofill/core/common/form_data.h" |
|
vabr (Chromium)
2016/09/07 16:18:06
This and the following #include seem like they cou
kolos1
2016/09/08 08:34:28
Done. Thanks.
|
| +#include "components/autofill/core/common/form_field_data.h" |
| +#include "url/gurl.h" |
| + |
| +namespace autofill { |
| + |
| +typedef uint64_t FormSignature; |
|
dcheng
2016/09/07 19:56:39
Prefer using FormSignature = uint64_t in new code.
kolos1
2016/09/08 08:34:28
Done.
|
| +typedef uint32_t FieldSignature; |
| + |
| +// 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); |
| + |
| +// 64-bit hash of the string - used in FormSignature and unit-tests. |
| +uint64_t StrToHash64Bit(const std::string& str); |
|
vabr (Chromium)
2016/09/07 16:18:06
optional nit: You defined an alias for this type (
kolos1
2016/09/08 08:34:28
Precisely, we use it not only for form signatures,
|
| + |
| +// 32-bit hash of the string - used in FormSignature and unit-tests. |
| +uint32_t StrToHash32Bit(const std::string& str); |
| +} |
|
vabr (Chromium)
2016/09/07 16:18:06
nit: Please add a blank line above the '}'.
kolos1
2016/09/08 08:34:28
Done.
|
| + |
| +#endif // COMPONENTS_AUTOFILL_CORE_COMMON_SIGNATURES_UTIL_H_ |