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

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

Issue 6731036: Enabled pressing TAB to cycle through the Omnibox results. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // This file contains the keyword autocomplete provider. The keyword provider 5 // This file contains the keyword autocomplete provider. The keyword provider
6 // is responsible for remembering/suggesting user "search keyword queries" 6 // is responsible for remembering/suggesting user "search keyword queries"
7 // (e.g. "imdb Godzilla") and then fixing them up into valid URLs. An 7 // (e.g. "imdb Godzilla") and then fixing them up into valid URLs. An
8 // instance of it gets created and managed by the autocomplete controller. 8 // instance of it gets created and managed by the autocomplete controller.
9 // KeywordProvider uses a TemplateURLService to find the set of keywords. 9 // KeywordProvider uses a TemplateURLService to find the set of keywords.
10 // 10 //
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 const string16& input, 64 const string16& input,
65 bool trim_leading_whitespace); 65 bool trim_leading_whitespace);
66 66
67 // Returns the matching substituting keyword for |input|, or NULL if there 67 // Returns the matching substituting keyword for |input|, or NULL if there
68 // is no keyword for the specified input. 68 // is no keyword for the specified input.
69 static const TemplateURL* GetSubstitutingTemplateURLForInput( 69 static const TemplateURL* GetSubstitutingTemplateURLForInput(
70 Profile* profile, 70 Profile* profile,
71 const AutocompleteInput& input, 71 const AutocompleteInput& input,
72 string16* remaining_input); 72 string16* remaining_input);
73 73
74 // If |text| corresponds (in the sense of
75 // TemplateURLModel::CleanUserInputKeyword()) to an enabled, substituting
76 // keyword, returns that keyword; returns the empty string otherwise.
77 string16 GetKeywordForText(const string16& text) const;
78
79 // Creates a fully marked-up AutocompleteMatch for a specific keyword.
80 AutocompleteMatch CreateAutocompleteMatch(
81 const string16& text,
82 const string16& keyword,
83 const AutocompleteInput& input);
84
74 // AutocompleteProvider 85 // AutocompleteProvider
75 virtual void Start(const AutocompleteInput& input, bool minimal_changes); 86 virtual void Start(const AutocompleteInput& input, bool minimal_changes);
76 virtual void Stop(); 87 virtual void Stop();
77 88
78 private: 89 private:
79 class ScopedEndExtensionKeywordMode; 90 class ScopedEndExtensionKeywordMode;
80 friend class ScopedEndExtensionKeywordMode; 91 friend class ScopedEndExtensionKeywordMode;
81 92
82 virtual ~KeywordProvider(); 93 virtual ~KeywordProvider();
83 94
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 int relevance); 142 int relevance);
132 143
133 void EnterExtensionKeywordMode(const std::string& extension_id); 144 void EnterExtensionKeywordMode(const std::string& extension_id);
134 void MaybeEndExtensionKeywordMode(); 145 void MaybeEndExtensionKeywordMode();
135 146
136 // content::NotificationObserver interface. 147 // content::NotificationObserver interface.
137 virtual void Observe(int type, 148 virtual void Observe(int type,
138 const content::NotificationSource& source, 149 const content::NotificationSource& source,
139 const content::NotificationDetails& details); 150 const content::NotificationDetails& details);
140 151
152 TemplateURLService* GetTemplateURLService() const;
153
141 // Model for the keywords. This is only non-null when testing, otherwise the 154 // Model for the keywords. This is only non-null when testing, otherwise the
142 // TemplateURLService from the Profile is used. 155 // TemplateURLService from the Profile is used.
143 TemplateURLService* model_; 156 TemplateURLService* model_;
144 157
145 // Identifies the current input state. This is incremented each time the 158 // Identifies the current input state. This is incremented each time the
146 // autocomplete edit's input changes in any way. It is used to tell whether 159 // autocomplete edit's input changes in any way. It is used to tell whether
147 // suggest results from the extension are current. 160 // suggest results from the extension are current.
148 int current_input_id_; 161 int current_input_id_;
149 162
150 // The input state at the time we last asked the extension for suggest 163 // The input state at the time we last asked the extension for suggest
151 // results. 164 // results.
152 AutocompleteInput extension_suggest_last_input_; 165 AutocompleteInput extension_suggest_last_input_;
153 166
154 // We remember the last suggestions we've received from the extension in case 167 // We remember the last suggestions we've received from the extension in case
155 // we need to reset our matches without asking the extension again. 168 // we need to reset our matches without asking the extension again.
156 std::vector<AutocompleteMatch> extension_suggest_matches_; 169 std::vector<AutocompleteMatch> extension_suggest_matches_;
157 170
158 // If non-empty, holds the ID of the extension whose keyword is currently in 171 // If non-empty, holds the ID of the extension whose keyword is currently in
159 // the URL bar while the autocomplete popup is open. 172 // the URL bar while the autocomplete popup is open.
160 std::string current_keyword_extension_id_; 173 std::string current_keyword_extension_id_;
161 174
162 content::NotificationRegistrar registrar_; 175 content::NotificationRegistrar registrar_;
163 176
164 DISALLOW_COPY_AND_ASSIGN(KeywordProvider); 177 DISALLOW_COPY_AND_ASSIGN(KeywordProvider);
165 }; 178 };
166 179
167 #endif // CHROME_BROWSER_AUTOCOMPLETE_KEYWORD_PROVIDER_H_ 180 #endif // CHROME_BROWSER_AUTOCOMPLETE_KEYWORD_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698