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

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, 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) 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 //
11 // For more information on the autocomplete system in general, including how 11 // For more information on the autocomplete system in general, including how
12 // the autocomplete controller and autocomplete providers work, see 12 // the autocomplete controller and autocomplete providers work, see
13 // chrome/browser/autocomplete.h. 13 // chrome/browser/autocomplete.h.
14 14
15 #ifndef CHROME_BROWSER_AUTOCOMPLETE_KEYWORD_PROVIDER_H_ 15 #ifndef CHROME_BROWSER_AUTOCOMPLETE_KEYWORD_PROVIDER_H_
16 #define CHROME_BROWSER_AUTOCOMPLETE_KEYWORD_PROVIDER_H_ 16 #define CHROME_BROWSER_AUTOCOMPLETE_KEYWORD_PROVIDER_H_
17 #pragma once 17 #pragma once
18 18
19 #include <string> 19 #include <string>
20 20
21 #include "chrome/browser/autocomplete/autocomplete.h" 21 #include "chrome/browser/autocomplete/autocomplete.h"
22 #include "content/common/notification_observer.h" 22 #include "content/common/notification_observer.h"
23 #include "content/common/notification_registrar.h" 23 #include "content/common/notification_registrar.h"
24 24
25 class Profile; 25 class Profile;
26 class TemplateURL; 26 class TemplateURL;
27 class TemplateURLModel;
27 class TemplateURLService; 28 class TemplateURLService;
28 29
29 // Autocomplete provider for keyword input. 30 // Autocomplete provider for keyword input.
30 // 31 //
31 // After construction, the autocomplete controller repeatedly calls Start() 32 // After construction, the autocomplete controller repeatedly calls Start()
32 // with some user input, each time expecting to receive a small set of the best 33 // with some user input, each time expecting to receive a small set of the best
33 // matches (either synchronously or asynchronously). 34 // matches (either synchronously or asynchronously).
34 // 35 //
35 // To construct these matches, the provider treats user input as a series of 36 // To construct these matches, the provider treats user input as a series of
36 // whitespace-delimited tokens and tries to match the first token as the prefix 37 // whitespace-delimited tokens and tries to match the first token as the prefix
(...skipping 27 matching lines...) Expand all
64 const string16& input, 65 const string16& input,
65 bool trim_leading_whitespace); 66 bool trim_leading_whitespace);
66 67
67 // Returns the matching substituting keyword for |input|, or NULL if there 68 // Returns the matching substituting keyword for |input|, or NULL if there
68 // is no keyword for the specified input. 69 // is no keyword for the specified input.
69 static const TemplateURL* GetSubstitutingTemplateURLForInput( 70 static const TemplateURL* GetSubstitutingTemplateURLForInput(
70 Profile* profile, 71 Profile* profile,
71 const AutocompleteInput& input, 72 const AutocompleteInput& input,
72 string16* remaining_input); 73 string16* remaining_input);
73 74
75 // Creates a fully marked-up AutocompleteMatch for a specific keyword.
76 AutocompleteMatch CreateAutocompleteMatch(
77 TemplateURLService* model,
78 const string16& keyword,
79 const AutocompleteInput& input);
80
74 // AutocompleteProvider 81 // AutocompleteProvider
75 virtual void Start(const AutocompleteInput& input, bool minimal_changes); 82 virtual void Start(const AutocompleteInput& input, bool minimal_changes);
76 virtual void Stop(); 83 virtual void Stop();
77 84
78 private: 85 private:
79 class ScopedEndExtensionKeywordMode; 86 class ScopedEndExtensionKeywordMode;
80 friend class ScopedEndExtensionKeywordMode; 87 friend class ScopedEndExtensionKeywordMode;
81 88
82 virtual ~KeywordProvider(); 89 virtual ~KeywordProvider();
83 90
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 // If non-empty, holds the ID of the extension whose keyword is currently in 164 // If non-empty, holds the ID of the extension whose keyword is currently in
158 // the URL bar while the autocomplete popup is open. 165 // the URL bar while the autocomplete popup is open.
159 std::string current_keyword_extension_id_; 166 std::string current_keyword_extension_id_;
160 167
161 NotificationRegistrar registrar_; 168 NotificationRegistrar registrar_;
162 169
163 DISALLOW_COPY_AND_ASSIGN(KeywordProvider); 170 DISALLOW_COPY_AND_ASSIGN(KeywordProvider);
164 }; 171 };
165 172
166 #endif // CHROME_BROWSER_AUTOCOMPLETE_KEYWORD_PROVIDER_H_ 173 #endif // CHROME_BROWSER_AUTOCOMPLETE_KEYWORD_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698