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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 FieldIsSuggestionSubstringStartingOnTokenBoundary( |
| 55 const base::string16& suggestion, | 55 const base::string16& suggestion, |
| 56 const base::string16& field_contents, | 56 const base::string16& field_contents, |
| 57 bool case_sensitive); | 57 bool case_sensitive); |
| 58 | 58 |
| 59 // Currently, a token for the purposes of this method is defined as {'@'}. | |
|
vabr (Chromium)
2017/06/19 12:54:15
nit: Please update the comment not to mention any
| |
| 60 // Returns true if the |full_string| has a |prefix| as a prefix and the prefix | |
| 61 // ends on a token. | |
| 62 bool IsPrefixOfEmailEndingAtSign(const base::string16& full_string, | |
|
vabr (Chromium)
2017/06/19 12:54:15
nit: EndingAtSign -> EndingWithAtSign
(The curren
melandory
2017/06/21 12:00:42
Done.
| |
| 63 const base::string16& prefix); | |
| 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 |
| 68 // Returns true if running on a desktop platform. Any platform that is not | 74 // Returns true if running on a desktop platform. Any platform that is not |
| (...skipping 10 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 |