OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_AUTOFILL_CORE_COMMON_AUTOFILL_UTIL_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_COMMON_AUTOFILL_UTIL_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_COMMON_AUTOFILL_UTIL_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_COMMON_AUTOFILL_UTIL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
14 #include "components/autofill/core/common/form_field_data.h" | 14 #include "components/autofill/core/common/form_field_data.h" |
15 | 15 |
| 16 namespace base { |
| 17 struct Feature; |
| 18 } |
| 19 |
16 namespace autofill { | 20 namespace autofill { |
17 | 21 |
| 22 extern const base::Feature kAutofillKeyboardAccessory; |
| 23 extern const char kAutofillKeyboardAccessoryAnimationDurationKey[]; |
| 24 extern const char kAutofillKeyboardAccessoryLimitLabelWidthKey[]; |
| 25 extern const char kAutofillKeyboardAccessoryHintKey[]; |
| 26 |
18 // Returns true when command line switch |kEnableSuggestionsWithSubstringMatch| | 27 // Returns true when command line switch |kEnableSuggestionsWithSubstringMatch| |
19 // is on. | 28 // is on. |
20 bool IsFeatureSubstringMatchEnabled(); | 29 bool IsFeatureSubstringMatchEnabled(); |
21 | 30 |
22 // Returns true if showing autofill signature as HTML attributes is enabled. | 31 // Returns true if showing autofill signature as HTML attributes is enabled. |
23 bool IsShowAutofillSignaturesEnabled(); | 32 bool IsShowAutofillSignaturesEnabled(); |
24 | 33 |
25 // Returns true when keyboard accessory is enabled. | 34 // Returns true when keyboard accessory is enabled. |
26 bool IsKeyboardAccessoryEnabled(); | 35 bool IsKeyboardAccessoryEnabled(); |
27 | 36 |
| 37 // Returns animation duration for keyboard accessory. If 0, we do not animate. |
| 38 unsigned int GetKeyboardAccessoryAnimationDuration(); |
| 39 |
| 40 // Returns true if we must limit width of keyboard accessory suggestion label to |
| 41 // half of device's pixel width. |
| 42 bool ShouldLimitKeyboardAccessorySuggestionLabelWidth(); |
| 43 |
| 44 // Returns true if we show a hint in the keyboard accessory suggestions to call |
| 45 // attention to the availability of autofill suggestions. |
| 46 bool IsHintEnabledInKeyboardAccessory(); |
| 47 |
28 // A token is a sequences of contiguous characters separated by any of the | 48 // A token is a sequences of contiguous characters separated by any of the |
29 // characters that are part of delimiter set {' ', '.', ',', '-', '_', '@'}. | 49 // characters that are part of delimiter set {' ', '.', ',', '-', '_', '@'}. |
30 | 50 |
31 // Returns true if the |field_contents| is a substring of the |suggestion| | 51 // Returns true if the |field_contents| is a substring of the |suggestion| |
32 // starting at token boundaries. |field_contents| can span multiple |suggestion| | 52 // starting at token boundaries. |field_contents| can span multiple |suggestion| |
33 // tokens. | 53 // tokens. |
34 bool FieldIsSuggestionSubstringStartingOnTokenBoundary( | 54 bool FieldIsSuggestionSubstringStartingOnTokenBoundary( |
35 const base::string16& suggestion, | 55 const base::string16& suggestion, |
36 const base::string16& field_contents, | 56 const base::string16& field_contents, |
37 bool case_sensitive); | 57 bool case_sensitive); |
(...skipping 21 matching lines...) Expand all Loading... |
59 | 79 |
60 // Lowercases and tokenizes a given |attribute| string. | 80 // Lowercases and tokenizes a given |attribute| string. |
61 // Considers any ASCII whitespace character as a possible separator. | 81 // Considers any ASCII whitespace character as a possible separator. |
62 // Also ignores empty tokens, resulting in a collapsing of whitespace. | 82 // Also ignores empty tokens, resulting in a collapsing of whitespace. |
63 std::vector<std::string> LowercaseAndTokenizeAttributeString( | 83 std::vector<std::string> LowercaseAndTokenizeAttributeString( |
64 const std::string& attribute); | 84 const std::string& attribute); |
65 | 85 |
66 } // namespace autofill | 86 } // namespace autofill |
67 | 87 |
68 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_AUTOFILL_UTIL_H_ | 88 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_AUTOFILL_UTIL_H_ |
OLD | NEW |