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, |
| 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 {'@'}. | |
| 59 // Returns true if the |full_string| has a |prefix| as a prefix and the prefix | |
| 60 // end on a token. | |
|
dvadym
2017/06/01 12:15:56
prefix end -> prefix ends
melandory
2017/06/12 14:56:12
Done.
| |
| 61 bool IsPrefixStartingOnTokenBoundary(const base::string16& full_string, | |
|
dvadym
2017/06/01 12:15:56
As far as I understand |prefix| should end at Toke
melandory
2017/06/12 14:56:12
Done.
| |
| 62 const base::string16& prefix, | |
| 63 bool case_sensitive); | |
| 58 | 64 |
| 59 // Finds the first occurrence of a searched substring |field_contents| within | 65 // Finds the first occurrence of a searched substring |field_contents| within |
| 60 // the string |suggestion| starting at token boundaries and returns the index to | 66 // 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 | 67 // 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 | 68 // 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|. | 69 // substring |field_contents| may not be found within the string |suggestion|. |
| 64 size_t GetTextSelectionStart(const base::string16& suggestion, | 70 size_t GetTextSelectionStart(const base::string16& suggestion, |
| 65 const base::string16& field_contents, | 71 const base::string16& field_contents, |
| 66 bool case_sensitive); | 72 bool case_sensitive); |
| 67 | 73 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 79 | 85 |
| 80 // Lowercases and tokenizes a given |attribute| string. | 86 // Lowercases and tokenizes a given |attribute| string. |
| 81 // Considers any ASCII whitespace character as a possible separator. | 87 // Considers any ASCII whitespace character as a possible separator. |
| 82 // Also ignores empty tokens, resulting in a collapsing of whitespace. | 88 // Also ignores empty tokens, resulting in a collapsing of whitespace. |
| 83 std::vector<std::string> LowercaseAndTokenizeAttributeString( | 89 std::vector<std::string> LowercaseAndTokenizeAttributeString( |
| 84 const std::string& attribute); | 90 const std::string& attribute); |
| 85 | 91 |
| 86 } // namespace autofill | 92 } // namespace autofill |
| 87 | 93 |
| 88 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_AUTOFILL_UTIL_H_ | 94 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_AUTOFILL_UTIL_H_ |
| OLD | NEW |