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

Unified Diff: chrome/browser/autocomplete/search_provider.cc

Issue 17022004: Replace --google-base-suggest-url and --instant-url with --google-base-url. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 6 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/search_provider.cc
===================================================================
--- chrome/browser/autocomplete/search_provider.cc (revision 208590)
+++ chrome/browser/autocomplete/search_provider.cc (working copy)
@@ -259,24 +259,22 @@
// static
AutocompleteMatch SearchProvider::CreateSearchSuggestion(
- Profile* profile,
AutocompleteProvider* autocomplete_provider,
- const AutocompleteInput& input,
+ int relevance,
+ AutocompleteMatch::Type type,
+ const TemplateURL* template_url,
const string16& query_string,
const string16& input_text,
- int relevance,
- AutocompleteMatch::Type type,
+ const AutocompleteInput& input,
+ bool is_keyword,
int accepted_suggestion,
- bool is_keyword,
- const string16& keyword,
- int omnibox_start_margin) {
+ int omnibox_start_margin,
+ bool append_extra_query_params) {
AutocompleteMatch match(autocomplete_provider, relevance, false, type);
- // Bail out now if we don't actually have a valid provider.
- match.keyword = keyword;
- const TemplateURL* provider_url = match.GetTemplateURL(profile, false);
- if (provider_url == NULL)
+ if (!template_url)
return match;
+ match.keyword = template_url->keyword();
match.contents.assign(query_string);
// We do intra-string highlighting for suggestions - the suggested segment
@@ -332,13 +330,15 @@
}
match.fill_into_edit.append(query_string);
- const TemplateURLRef& search_url = provider_url->url_ref();
+ const TemplateURLRef& search_url = template_url->url_ref();
DCHECK(search_url.SupportsReplacement());
match.search_terms_args.reset(
new TemplateURLRef::SearchTermsArgs(query_string));
match.search_terms_args->original_query = input_text;
match.search_terms_args->accepted_suggestion = accepted_suggestion;
match.search_terms_args->omnibox_start_margin = omnibox_start_margin;
+ match.search_terms_args->append_extra_query_params =
+ append_extra_query_params;
// This is the destination URL sans assisted query stats. This must be set
// so the AutocompleteController can properly de-dupe; the controller will
// eventually overwrite it before it reaches the user.
@@ -1537,11 +1537,12 @@
int accepted_suggestion,
bool is_keyword,
MatchMap* map) {
- const string16& keyword = is_keyword ?
- providers_.keyword_provider() : providers_.default_provider();
- AutocompleteMatch match = CreateSearchSuggestion(profile_, this, input_,
- query_string, input_text, relevance, type, accepted_suggestion,
- is_keyword, keyword, omnibox_start_margin_);
+ const TemplateURL* template_url = is_keyword ?
+ providers_.GetKeywordProviderURL() : providers_.GetDefaultProviderURL();
+ AutocompleteMatch match = CreateSearchSuggestion(this, relevance, type,
+ template_url, query_string, input_text, input_, is_keyword,
+ accepted_suggestion, omnibox_start_margin_,
+ !is_keyword || providers_.default_provider().empty());
if (!match.destination_url.is_valid())
return;
match.RecordAdditionalInfo(kRelevanceFromServerKey,
« no previous file with comments | « chrome/browser/autocomplete/search_provider.h ('k') | chrome/browser/autocomplete/search_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698