OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_OMNIBOX_BROWSER_SHORTCUTS_PROVIDER_H_ | 5 #ifndef COMPONENTS_OMNIBOX_BROWSER_SHORTCUTS_PROVIDER_H_ |
6 #define COMPONENTS_OMNIBOX_BROWSER_SHORTCUTS_PROVIDER_H_ | 6 #define COMPONENTS_OMNIBOX_BROWSER_SHORTCUTS_PROVIDER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 // Returns an AutocompleteMatch corresponding to |shortcut|. Assigns it | 50 // Returns an AutocompleteMatch corresponding to |shortcut|. Assigns it |
51 // |relevance| score in the process, and highlights the description and | 51 // |relevance| score in the process, and highlights the description and |
52 // contents against |input|, which should be the lower-cased version of | 52 // contents against |input|, which should be the lower-cased version of |
53 // the user's input. |input| and |fixed_up_input_text| are used to decide | 53 // the user's input. |input| and |fixed_up_input_text| are used to decide |
54 // what can be inlined. | 54 // what can be inlined. |
55 AutocompleteMatch ShortcutToACMatch( | 55 AutocompleteMatch ShortcutToACMatch( |
56 const ShortcutsDatabase::Shortcut& shortcut, | 56 const ShortcutsDatabase::Shortcut& shortcut, |
57 int relevance, | 57 int relevance, |
58 const AutocompleteInput& input, | 58 const AutocompleteInput& input, |
59 const base::string16& fixed_up_input_text); | 59 const base::string16& fixed_up_input_text, |
| 60 const base::string16 term_string, |
| 61 const WordMap& terms_map); |
60 | 62 |
61 // Returns a map mapping characters to groups of words from |text| that start | 63 // Returns a map mapping characters to groups of words from |text| that start |
62 // with those characters, ordered lexicographically descending so that longer | 64 // with those characters, ordered lexicographically descending so that longer |
63 // words appear before their prefixes (if any) within a particular | 65 // words appear before their prefixes (if any) within a particular |
64 // equal_range(). | 66 // equal_range(). |
65 static WordMap CreateWordMapForString(const base::string16& text); | 67 static WordMap CreateWordMapForString(const base::string16& text); |
66 | 68 |
67 // Given |text| and a corresponding base set of classifications | 69 // Given |text| and a corresponding base set of classifications |
68 // |original_class|, adds ACMatchClassification::MATCH markers for all | 70 // |original_class|, adds ACMatchClassification::MATCH markers for all |
69 // instances of the words from |find_words| within |text| and returns the | 71 // instances of the words from |find_words| within |text| and returns the |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 int max_relevance); | 103 int max_relevance); |
102 | 104 |
103 // The default max relevance unless overridden by a field trial. | 105 // The default max relevance unless overridden by a field trial. |
104 static const int kShortcutsProviderDefaultMaxRelevance; | 106 static const int kShortcutsProviderDefaultMaxRelevance; |
105 | 107 |
106 AutocompleteProviderClient* client_; | 108 AutocompleteProviderClient* client_; |
107 bool initialized_; | 109 bool initialized_; |
108 }; | 110 }; |
109 | 111 |
110 #endif // COMPONENTS_OMNIBOX_BROWSER_SHORTCUTS_PROVIDER_H_ | 112 #endif // COMPONENTS_OMNIBOX_BROWSER_SHORTCUTS_PROVIDER_H_ |
OLD | NEW |