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

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

Issue 12039053: Fix cursor position for default provider searches in keyword mode. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Added missing () to the comment in omnibox_edit_model.cc Created 7 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 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 // 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 // Returns the replacement string from the user input. The replacement 66 // Returns the replacement string from the user input. The replacement
67 // string is the portion of the input that does not contain the keyword. 67 // string is the portion of the input that does not contain the keyword.
68 // For example, the replacement string for "b blah" is blah. 68 // For example, the replacement string for "b blah" is blah.
69 // If |trim_leading_whitespace| is true then leading whitespace in 69 // If |trim_leading_whitespace| is true then leading whitespace in
70 // replacement string will be trimmed. 70 // replacement string will be trimmed.
71 static string16 SplitReplacementStringFromInput(const string16& input, 71 static string16 SplitReplacementStringFromInput(const string16& input,
72 bool trim_leading_whitespace); 72 bool trim_leading_whitespace);
73 73
74 // Returns the matching substituting keyword for |input|, or NULL if there 74 // Returns the matching substituting keyword for |input|, or NULL if there
75 // is no keyword for the specified input. 75 // is no keyword for the specified input. If the matching keyword was found,
76 // updates |input|'s text and cursor position.
76 static const TemplateURL* GetSubstitutingTemplateURLForInput( 77 static const TemplateURL* GetSubstitutingTemplateURLForInput(
77 Profile* profile, 78 TemplateURLService* model,
78 const AutocompleteInput& input, 79 AutocompleteInput* input);
79 string16* remaining_input);
80 80
81 // If |text| corresponds (in the sense of 81 // If |text| corresponds (in the sense of
82 // TemplateURLModel::CleanUserInputKeyword()) to an enabled, substituting 82 // TemplateURLModel::CleanUserInputKeyword()) to an enabled, substituting
83 // keyword, returns that keyword; returns the empty string otherwise. 83 // keyword, returns that keyword; returns the empty string otherwise.
84 string16 GetKeywordForText(const string16& text) const; 84 string16 GetKeywordForText(const string16& text) const;
85 85
86 // Creates a fully marked-up AutocompleteMatch for a specific keyword. 86 // Creates a fully marked-up AutocompleteMatch for a specific keyword.
87 AutocompleteMatch CreateAutocompleteMatch(const string16& text, 87 AutocompleteMatch CreateAutocompleteMatch(const string16& text,
88 const string16& keyword, 88 const string16& keyword,
89 const AutocompleteInput& input); 89 const AutocompleteInput& input);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 // If non-empty, holds the ID of the extension whose keyword is currently in 166 // If non-empty, holds the ID of the extension whose keyword is currently in
167 // the URL bar while the autocomplete popup is open. 167 // the URL bar while the autocomplete popup is open.
168 std::string current_keyword_extension_id_; 168 std::string current_keyword_extension_id_;
169 169
170 content::NotificationRegistrar registrar_; 170 content::NotificationRegistrar registrar_;
171 171
172 DISALLOW_COPY_AND_ASSIGN(KeywordProvider); 172 DISALLOW_COPY_AND_ASSIGN(KeywordProvider);
173 }; 173 };
174 174
175 #endif // CHROME_BROWSER_AUTOCOMPLETE_KEYWORD_PROVIDER_H_ 175 #endif // CHROME_BROWSER_AUTOCOMPLETE_KEYWORD_PROVIDER_H_
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_input.cc ('k') | chrome/browser/autocomplete/keyword_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698