Chromium Code Reviews| 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 | |
| 13 // |kEnableSuggestionsWithSubstringMatch| is on; otherwise |false|. | |
| 14 bool IsFeatureSubstringMatchEnabled(); | |
| 15 | |
| 16 // Returns |true| if a substring token within |field_suggestion| begins with | |
|
vabr (Chromium)
2015/03/24 13:32:28
Not clear what a "substring token" is. What about
Pritam Nikam
2015/03/25 14:25:26
Done.
| |
| 17 // |field_contents|; otherwise |false|. The set of delimiters (the characters | |
| 18 // that separate tokens) are ' ', '.', ',', '-', '_' and '@'. By default it | |
| 19 // performs case insensitive search. Caller can perform case sensitive search by | |
| 20 // explicitly passing |true| as |case_sensitive| parameter to this API. | |
| 21 bool HasTokenStartsWith(const base::string16& field_suggestion, | |
|
vabr (Chromium)
2015/03/24 13:32:28
The name still sounds hard to understand. What abo
Pritam Nikam
2015/03/25 14:25:26
Done.
| |
| 22 const base::string16& field_contents, | |
| 23 bool case_sensitive = false); | |
|
vabr (Chromium)
2015/03/24 13:32:28
optional: By changing the bool to an enum with wel
vabr (Chromium)
2015/03/24 13:32:28
The style guide forbids default arguments in this
Pritam Nikam
2015/03/25 14:25:26
Done.
Added enum instead.
enum CaseSensitivity {
Pritam Nikam
2015/03/25 14:25:26
Done.
| |
| 24 | |
| 25 // Returns |field_contents|'s offset within the |field_suggestion| on successful | |
| 26 // match and compute the selection range's |start| and |end| indices; otherwise | |
| 27 // returns |base::string16::npos|. | |
| 28 base::string16::size_type ComputeRange(const base::string16& field_suggestion, | |
| 29 const base::string16& field_contents, | |
| 30 size_t* start, | |
| 31 size_t* end); | |
| 32 | |
| 33 } // namespace autofill | |
| 34 | |
| 35 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_AUTOFILL_UTIL_H_ | |
| OLD | NEW |