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

Unified Diff: chrome/browser/autocomplete/keyword_provider.h

Issue 9309099: Enabled pressing TAB to traverse through the Omnibox results, removed moving the caret to the end... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/autocomplete/keyword_provider.h
===================================================================
--- chrome/browser/autocomplete/keyword_provider.h (revision 123410)
+++ chrome/browser/autocomplete/keyword_provider.h (working copy)
@@ -55,22 +55,40 @@
// For testing.
KeywordProvider(ACProviderListener* listener, TemplateURLService* model);
+ // Extracts the next whitespace-delimited token from input and returns it.
+ // Sets |remaining_input| to everything after the first token (skipping over
+ // the first intervening whitespace).
+ // If |trim_leading_whitespace| is true then leading whitespace in
+ // |*remaining_input| will be trimmed.
+ static string16 SplitKeywordFromInput(const string16& input,
+ bool trim_leading_whitespace,
+ string16* remaining_input);
+
// Returns the replacement string from the user input. The replacement
// string is the portion of the input that does not contain the keyword.
// For example, the replacement string for "b blah" is blah.
// If |trim_leading_whitespace| is true then leading whitespace in
// replacement string will be trimmed.
- static string16 SplitReplacementStringFromInput(
- const string16& input,
- bool trim_leading_whitespace);
+ static string16 SplitReplacementStringFromInput(const string16& input,
+ bool trim_leading_whitespace);
// Returns the matching substituting keyword for |input|, or NULL if there
// is no keyword for the specified input.
static const TemplateURL* GetSubstitutingTemplateURLForInput(
- Profile* profile,
- const AutocompleteInput& input,
- string16* remaining_input);
+ Profile* profile,
+ const AutocompleteInput& input,
+ string16* remaining_input);
+ // If |text| corresponds (in the sense of
+ // TemplateURLModel::CleanUserInputKeyword()) to an enabled, substituting
+ // keyword, returns that keyword; returns the empty string otherwise.
+ string16 GetKeywordForText(const string16& text) const;
+
+ // Creates a fully marked-up AutocompleteMatch for a specific keyword.
+ AutocompleteMatch CreateAutocompleteMatch(const string16& text,
+ const string16& keyword,
+ const AutocompleteInput& input);
+
// AutocompleteProvider
virtual void Start(const AutocompleteInput& input,
bool minimal_changes) OVERRIDE;
@@ -93,22 +111,12 @@
string16* keyword,
string16* remaining_input);
- // Extracts the next whitespace-delimited token from input and returns it.
- // Sets |remaining_input| to everything after the first token (skipping over
- // the first intervening whitespace).
- // If |trim_leading_whitespace| is true then leading whitespace in
- // |*remaining_input| will be trimmed.
- static string16 SplitKeywordFromInput(const string16& input,
- bool trim_leading_whitespace,
- string16* remaining_input);
-
// Fills in the "destination_url" and "contents" fields of |match| with the
// provided user input and keyword data.
- static void FillInURLAndContents(
- Profile* profile,
- const string16& remaining_input,
- const TemplateURL* element,
- AutocompleteMatch* match);
+ static void FillInURLAndContents(Profile* profile,
+ const string16& remaining_input,
+ const TemplateURL* element,
+ AutocompleteMatch* match);
// Determines the relevance for some input, given its type, whether the user
// typed the complete keyword, and whether the user is in "prefer keyword
@@ -123,13 +131,12 @@
// Creates a fully marked-up AutocompleteMatch from the user's input.
// If |relevance| is negative, calculate a relevance based on heuristics.
- AutocompleteMatch CreateAutocompleteMatch(
- TemplateURLService* model,
- const string16& keyword,
- const AutocompleteInput& input,
- size_t prefix_length,
- const string16& remaining_input,
- int relevance);
+ AutocompleteMatch CreateAutocompleteMatch(TemplateURLService* model,
+ const string16& keyword,
+ const AutocompleteInput& input,
+ size_t prefix_length,
+ const string16& remaining_input,
+ int relevance);
void EnterExtensionKeywordMode(const std::string& extension_id);
void MaybeEndExtensionKeywordMode();
@@ -139,6 +146,8 @@
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
+ TemplateURLService* GetTemplateURLService() const;
+
// Model for the keywords. This is only non-null when testing, otherwise the
// TemplateURLService from the Profile is used.
TemplateURLService* model_;
« no previous file with comments | « chrome/browser/autocomplete/history_url_provider_unittest.cc ('k') | chrome/browser/autocomplete/keyword_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698