Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(468)

Side by Side Diff: components/omnibox/browser/shortcuts_provider.h

Issue 1877833002: Optimize shortcuts provider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reverted rename of ShortcutMatchToACMatch to ShortcutToACMatch Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 std::string languages_; 109 std::string languages_;
108 bool initialized_; 110 bool initialized_;
109 }; 111 };
110 112
111 #endif // COMPONENTS_OMNIBOX_BROWSER_SHORTCUTS_PROVIDER_H_ 113 #endif // COMPONENTS_OMNIBOX_BROWSER_SHORTCUTS_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698