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