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

Side by Side Diff: chrome/browser/autocomplete/search_provider.cc

Issue 11414303: Make Google Search autocomplete provider cursor aware. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 8 years 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 #include "chrome/browser/autocomplete/search_provider.h" 5 #include "chrome/browser/autocomplete/search_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 } 611 }
612 612
613 net::URLFetcher* SearchProvider::CreateSuggestFetcher( 613 net::URLFetcher* SearchProvider::CreateSuggestFetcher(
614 int id, 614 int id,
615 const TemplateURL* template_url, 615 const TemplateURL* template_url,
616 const string16& text) { 616 const string16& text) {
617 if (!template_url || template_url->suggestions_url().empty()) 617 if (!template_url || template_url->suggestions_url().empty())
618 return NULL; 618 return NULL;
619 619
620 // Bail if the suggestion URL is invalid with the given replacements. 620 // Bail if the suggestion URL is invalid with the given replacements.
621 TemplateURLRef::SearchTermsArgs search_term_args(text);
622 search_term_args.cursor_position = input_.cursor_position();
621 GURL suggest_url(template_url->suggestions_url_ref().ReplaceSearchTerms( 623 GURL suggest_url(template_url->suggestions_url_ref().ReplaceSearchTerms(
622 TemplateURLRef::SearchTermsArgs(text))); 624 search_term_args));
623 if (!suggest_url.is_valid()) 625 if (!suggest_url.is_valid())
624 return NULL; 626 return NULL;
625 627
626 suggest_results_pending_++; 628 suggest_results_pending_++;
627 LogOmniboxSuggestRequest(REQUEST_SENT); 629 LogOmniboxSuggestRequest(REQUEST_SENT);
628 630
629 net::URLFetcher* fetcher = 631 net::URLFetcher* fetcher =
630 net::URLFetcher::Create(id, suggest_url, net::URLFetcher::GET, this); 632 net::URLFetcher::Create(id, suggest_url, net::URLFetcher::GET, this);
631 fetcher->SetRequestContext(profile_->GetRequestContext()); 633 fetcher->SetRequestContext(profile_->GetRequestContext());
632 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES); 634 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES);
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
1221 } 1223 }
1222 1224
1223 void SearchProvider::UpdateDone() { 1225 void SearchProvider::UpdateDone() {
1224 // We're done when the timer isn't running, there are no suggest queries 1226 // We're done when the timer isn't running, there are no suggest queries
1225 // pending, and we're not waiting on instant. 1227 // pending, and we're not waiting on instant.
1226 done_ = (!timer_.IsRunning() && (suggest_results_pending_ == 0) && 1228 done_ = (!timer_.IsRunning() && (suggest_results_pending_ == 0) &&
1227 (instant_finalized_ || 1229 (instant_finalized_ ||
1228 (!chrome::BrowserInstantController::IsInstantEnabled(profile_) && 1230 (!chrome::BrowserInstantController::IsInstantEnabled(profile_) &&
1229 !chrome::search::IsInstantExtendedAPIEnabled(profile_)))); 1231 !chrome::search::IsInstantExtendedAPIEnabled(profile_))));
1230 } 1232 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698