OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_AUTOFILL_CORE_COMMON_AUTOFILL_UTIL_H_ |
| 6 #define COMPONENTS_AUTOFILL_CORE_COMMON_AUTOFILL_UTIL_H_ |
| 7 |
| 8 #include "base/strings/string16.h" |
| 9 |
| 10 namespace autofill { |
| 11 |
| 12 // Returns true when command line switch |kEnableSuggestionsWithSubstringMatch| |
| 13 // is on. |
| 14 bool IsFeatureSubstringMatchEnabled(); |
| 15 |
| 16 // A token is a sequences of contiguous characters separated by any of the |
| 17 // characters that are part of delimiter set {' ', '.', ',', '-', '_', '@'}. |
| 18 |
| 19 // Returns true if the |field_contents| is a substring of the |suggestion| |
| 20 // starting at token boundaries. |field_contents| can span multiple |suggestion| |
| 21 // tokens. |
| 22 bool FieldIsSuggestionSubstringStartingOnTokenBoundary( |
| 23 const base::string16& suggestion, |
| 24 const base::string16& field_contents, |
| 25 bool case_sensitive); |
| 26 |
| 27 // Finds the first occurrence of a searched substring |field_contents| within |
| 28 // the string |suggestion| starting at token boundaries and returns the index to |
| 29 // the end of the located substring, or base::string16::npos if the substring is |
| 30 // not found. "preview-on-hover" feature is one such use case where the |
| 31 // substring |field_contents| may not be found within the string |suggestion|. |
| 32 size_t GetTextSelectionStart(const base::string16& suggestion, |
| 33 const base::string16& field_contents, |
| 34 bool case_sensitive); |
| 35 |
| 36 } // namespace autofill |
| 37 |
| 38 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_AUTOFILL_UTIL_H_ |
OLD | NEW |