Chromium Code Reviews| 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> |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 // Returns true if we show a hint in the keyboard accessory suggestions to call | 44 // Returns true if we show a hint in the keyboard accessory suggestions to call |
| 45 // attention to the availability of autofill suggestions. | 45 // attention to the availability of autofill suggestions. |
| 46 bool IsHintEnabledInKeyboardAccessory(); | 46 bool IsHintEnabledInKeyboardAccessory(); |
| 47 | 47 |
| 48 // 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 |
| 49 // characters that are part of delimiter set {' ', '.', ',', '-', '_', '@'}. | 49 // characters that are part of delimiter set {' ', '.', ',', '-', '_', '@'}. |
| 50 | 50 |
| 51 // 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| |
| 52 // starting at token boundaries. |field_contents| can span multiple |suggestion| | 52 // starting at token boundaries. |field_contents| can span multiple |suggestion| |
| 53 // tokens. | 53 // tokens. |
| 54 bool FieldIsSuggestionSubstringStartingOnTokenBoundary( | 54 bool IsSubstringStartingOnTokenBoundary(const base::string16& suggestion, |
|
vabr (Chromium)
2017/06/12 18:56:58
nit: I'm not sure what is the advantage of droppin
melandory
2017/06/19 10:53:48
I brought old name back
| |
| 55 const base::string16& suggestion, | 55 const base::string16& field_contents, |
| 56 const base::string16& field_contents, | 56 bool case_sensitive); |
| 57 bool case_sensitive); | 57 |
| 58 // Currently, a token for the purposes of this method is defined as {'@'}. | |
|
vabr (Chromium)
2017/06/12 18:56:59
nit: Redefining "token" for this method and keepin
melandory
2017/06/19 10:53:48
Done.
| |
| 59 // Returns true if the |full_string| has a |prefix| as a prefix and the prefix | |
| 60 // ends on a token. | |
| 61 bool IsPrefixEndingOnTokenBoundary(const base::string16& full_string, | |
| 62 const base::string16& prefix); | |
| 58 | 63 |
| 59 // Finds the first occurrence of a searched substring |field_contents| within | 64 // Finds the first occurrence of a searched substring |field_contents| within |
| 60 // the string |suggestion| starting at token boundaries and returns the index to | 65 // the string |suggestion| starting at token boundaries and returns the index to |
| 61 // the end of the located substring, or base::string16::npos if the substring is | 66 // the end of the located substring, or base::string16::npos if the substring is |
| 62 // not found. "preview-on-hover" feature is one such use case where the | 67 // not found. "preview-on-hover" feature is one such use case where the |
| 63 // substring |field_contents| may not be found within the string |suggestion|. | 68 // substring |field_contents| may not be found within the string |suggestion|. |
| 64 size_t GetTextSelectionStart(const base::string16& suggestion, | 69 size_t GetTextSelectionStart(const base::string16& suggestion, |
| 65 const base::string16& field_contents, | 70 const base::string16& field_contents, |
| 66 bool case_sensitive); | 71 bool case_sensitive); |
| 67 | 72 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 79 | 84 |
| 80 // Lowercases and tokenizes a given |attribute| string. | 85 // Lowercases and tokenizes a given |attribute| string. |
| 81 // Considers any ASCII whitespace character as a possible separator. | 86 // Considers any ASCII whitespace character as a possible separator. |
| 82 // Also ignores empty tokens, resulting in a collapsing of whitespace. | 87 // Also ignores empty tokens, resulting in a collapsing of whitespace. |
| 83 std::vector<std::string> LowercaseAndTokenizeAttributeString( | 88 std::vector<std::string> LowercaseAndTokenizeAttributeString( |
| 84 const std::string& attribute); | 89 const std::string& attribute); |
| 85 | 90 |
| 86 } // namespace autofill | 91 } // namespace autofill |
| 87 | 92 |
| 88 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_AUTOFILL_UTIL_H_ | 93 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_AUTOFILL_UTIL_H_ |
| OLD | NEW |