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

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

Issue 353223002: Omnibox: Fix URL-What-You-Typed Allowed-To-Be-Default-Match Issues (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove extra << Created 6 years, 5 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 | 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 virtual ~ShortcutsProvider(); 43 virtual ~ShortcutsProvider();
44 44
45 // ShortcutsBackendObserver: 45 // ShortcutsBackendObserver:
46 virtual void OnShortcutsLoaded() OVERRIDE; 46 virtual void OnShortcutsLoaded() OVERRIDE;
47 47
48 // Performs the autocomplete matching and scoring. 48 // Performs the autocomplete matching and scoring.
49 void GetMatches(const AutocompleteInput& input); 49 void GetMatches(const AutocompleteInput& input);
50 50
51 // Returns an AutocompleteMatch corresponding to |shortcut|. Assigns it 51 // Returns an AutocompleteMatch corresponding to |shortcut|. Assigns it
52 // |relevance| score in the process, and highlights the description and 52 // |relevance| score in the process, and highlights the description and
53 // contents against |input|, which should be the lower-cased version 53 // contents against |input|, which should be the lower-cased version of
54 // of the user's input. |input|, |fixed_up_input_text|, and 54 // the user's input. |input| and |fixed_up_input_text| are used to decide
55 // |input_as_gurl| are used to decide what can be inlined. 55 // what can be inlined.
56 AutocompleteMatch ShortcutToACMatch( 56 AutocompleteMatch ShortcutToACMatch(
57 const history::ShortcutsDatabase::Shortcut& shortcut, 57 const history::ShortcutsDatabase::Shortcut& shortcut,
58 int relevance, 58 int relevance,
59 const AutocompleteInput& input, 59 const AutocompleteInput& input,
60 const base::string16& fixed_up_input_text, 60 const base::string16& fixed_up_input_text);
61 const GURL& input_as_gurl);
62 61
63 // Returns a map mapping characters to groups of words from |text| that start 62 // Returns a map mapping characters to groups of words from |text| that start
64 // with those characters, ordered lexicographically descending so that longer 63 // with those characters, ordered lexicographically descending so that longer
65 // words appear before their prefixes (if any) within a particular 64 // words appear before their prefixes (if any) within a particular
66 // equal_range(). 65 // equal_range().
67 static WordMap CreateWordMapForString(const base::string16& text); 66 static WordMap CreateWordMapForString(const base::string16& text);
68 67
69 // Given |text| and a corresponding base set of classifications 68 // Given |text| and a corresponding base set of classifications
70 // |original_class|, adds ACMatchClassification::MATCH markers for all 69 // |original_class|, adds ACMatchClassification::MATCH markers for all
71 // instances of the words from |find_words| within |text| and returns the 70 // instances of the words from |find_words| within |text| and returns the
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 int max_relevance); 102 int max_relevance);
104 103
105 // The default max relevance unless overridden by a field trial. 104 // The default max relevance unless overridden by a field trial.
106 static const int kShortcutsProviderDefaultMaxRelevance; 105 static const int kShortcutsProviderDefaultMaxRelevance;
107 106
108 std::string languages_; 107 std::string languages_;
109 bool initialized_; 108 bool initialized_;
110 }; 109 };
111 110
112 #endif // CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_PROVIDER_H_ 111 #endif // CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698