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

Side by Side Diff: chrome/browser/autocomplete/shortcuts_provider.h

Issue 108643003: Omnibox: Bug Fixes for Shortcuts Inlining (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup comments; spacing Created 7 years 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 | Annotate | Revision Log
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 CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_PROVIDER_H_ 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_PROVIDER_H_
6 #define CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_PROVIDER_H_ 6 #define CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_PROVIDER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 typedef std::multimap<char16, base::string16> WordMap; 43 typedef std::multimap<char16, base::string16> WordMap;
44 44
45 virtual ~ShortcutsProvider(); 45 virtual ~ShortcutsProvider();
46 46
47 // ShortcutsBackendObserver: 47 // ShortcutsBackendObserver:
48 virtual void OnShortcutsLoaded() OVERRIDE; 48 virtual void OnShortcutsLoaded() OVERRIDE;
49 49
50 // Performs the autocomplete matching and scoring. 50 // Performs the autocomplete matching and scoring.
51 void GetMatches(const AutocompleteInput& input); 51 void GetMatches(const AutocompleteInput& input);
52 52
53 // Returns an AutocompleteMatch corresponding to |shortcut|. Assigns it 53 // Returns an AutocompleteMatch corresponding to |shortcut|. Assigns it
54 // |relevance| score in the process, and highlights the description 54 // |relevance| score in the process, and highlights the description and
55 // and contents against |term_string|, which should be the lower-cased 55 // contents against |term_string|, which should be the lower-cased version
56 // version of the user's input. If |prevent_inline_autocomplete|, no 56 // of the user's input. |term_string| and |fixed_up_term_string| are used
57 // to decide what can be inlined. If |prevent_inline_autocomplete|, no
57 // matches with inline completions will be allowed to be the default match. 58 // matches with inline completions will be allowed to be the default match.
58 AutocompleteMatch ShortcutToACMatch( 59 AutocompleteMatch ShortcutToACMatch(
59 const history::ShortcutsBackend::Shortcut& shortcut, 60 const history::ShortcutsBackend::Shortcut& shortcut,
60 int relevance, 61 int relevance,
61 const base::string16& term_string, 62 const base::string16& term_string,
62 bool prevent_inline_autocomplete); 63 const base::string16& fixed_up_term_string,
64 const bool prevent_inline_autocomplete);
63 65
64 // Returns a map mapping characters to groups of words from |text| that start 66 // Returns a map mapping characters to groups of words from |text| that start
65 // with those characters, ordered lexicographically descending so that longer 67 // with those characters, ordered lexicographically descending so that longer
66 // words appear before their prefixes (if any) within a particular 68 // words appear before their prefixes (if any) within a particular
67 // equal_range(). 69 // equal_range().
68 static WordMap CreateWordMapForString(const base::string16& text); 70 static WordMap CreateWordMapForString(const base::string16& text);
69 71
70 // Given |text| and a corresponding base set of classifications 72 // Given |text| and a corresponding base set of classifications
71 // |original_class|, adds ACMatchClassification::MATCH markers for all 73 // |original_class|, adds ACMatchClassification::MATCH markers for all
72 // instances of the words from |find_words| within |text| and returns the 74 // instances of the words from |find_words| within |text| and returns the
(...skipping 29 matching lines...) Expand all
102 int CalculateScore( 104 int CalculateScore(
103 const base::string16& terms, 105 const base::string16& terms,
104 const history::ShortcutsBackend::Shortcut& shortcut, 106 const history::ShortcutsBackend::Shortcut& shortcut,
105 int max_relevance); 107 int max_relevance);
106 108
107 std::string languages_; 109 std::string languages_;
108 bool initialized_; 110 bool initialized_;
109 }; 111 };
110 112
111 #endif // CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_PROVIDER_H_ 113 #endif // CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698