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

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

Issue 10537154: A working implementation of AQS (Assisted Query Stats). (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Addressed comments and added more docs. Created 8 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
diff --git a/chrome/browser/autocomplete/search_provider.cc b/chrome/browser/autocomplete/search_provider.cc
index 6b25b1e4214f62925eab057444327ef88e31cf7d..5c314dfc2ed0575c9ec9f5bab8bd4983d9b68631 100644
--- a/chrome/browser/autocomplete/search_provider.cc
+++ b/chrome/browser/autocomplete/search_provider.cc
@@ -593,8 +593,8 @@ net::URLFetcher* SearchProvider::CreateSuggestFetcher(
const string16& text) {
DCHECK(suggestions_url.SupportsReplacement());
net::URLFetcher* fetcher = net::URLFetcher::Create(id,
- GURL(suggestions_url.ReplaceSearchTerms(text,
- TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16())),
+ GURL(suggestions_url.ReplaceSearchTerms(
+ TemplateURLRef::SearchTermsArgs(text))),
net::URLFetcher::GET, this);
fetcher->SetRequestContext(profile_->GetRequestContext());
fetcher->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES);
@@ -1091,8 +1091,15 @@ void SearchProvider::AddMatchToMap(const string16& query_string,
const TemplateURLRef& search_url = provider_url->url_ref();
DCHECK(search_url.SupportsReplacement());
- match.destination_url = GURL(search_url.ReplaceSearchTerms(query_string,
- accepted_suggestion, input_text));
+ 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;
+ // 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.
+ match.destination_url =
+ GURL(search_url.ReplaceSearchTerms(*match.search_terms_args.get()));
// Search results don't look like URLs.
match.transition = is_keyword ?
« no previous file with comments | « chrome/browser/autocomplete/keyword_provider.cc ('k') | chrome/browser/autocomplete/search_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698