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

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

Issue 7812036: Update base/timer.h code to pass through Location from call sites. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 3 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 358
359 // We'll have at least one pending fetch. Set it to 1 now, but the value is 359 // We'll have at least one pending fetch. Set it to 1 now, but the value is
360 // correctly set in Run. As Run isn't invoked immediately we need to set this 360 // correctly set in Run. As Run isn't invoked immediately we need to set this
361 // now, else we won't think we're waiting on results from the server when we 361 // now, else we won't think we're waiting on results from the server when we
362 // really are. 362 // really are.
363 suggest_results_pending_ = 1; 363 suggest_results_pending_ = 1;
364 364
365 // Kick off a timer that will start the URL fetch if it completes before 365 // Kick off a timer that will start the URL fetch if it completes before
366 // the user types another character. 366 // the user types another character.
367 int delay = query_suggest_immediately_ ? 0 : kQueryDelayMs; 367 int delay = query_suggest_immediately_ ? 0 : kQueryDelayMs;
368 timer_.Start(TimeDelta::FromMilliseconds(delay), this, &SearchProvider::Run); 368 timer_.Start(FROM_HERE, TimeDelta::FromMilliseconds(delay), this,
369 &SearchProvider::Run);
369 } 370 }
370 371
371 bool SearchProvider::IsQuerySuitableForSuggest() const { 372 bool SearchProvider::IsQuerySuitableForSuggest() const {
372 // Don't run Suggest in incognito mode, the engine doesn't support it, or 373 // Don't run Suggest in incognito mode, the engine doesn't support it, or
373 // the user has disabled it. 374 // the user has disabled it.
374 if (profile_->IsOffTheRecord() || 375 if (profile_->IsOffTheRecord() ||
375 (!providers_.valid_suggest_for_keyword_provider() && 376 (!providers_.valid_suggest_for_keyword_provider() &&
376 !providers_.valid_suggest_for_default_provider()) || 377 !providers_.valid_suggest_for_default_provider()) ||
377 !profile_->GetPrefs()->GetBoolean(prefs::kSearchSuggestEnabled)) 378 !profile_->GetPrefs()->GetBoolean(prefs::kSearchSuggestEnabled))
378 return false; 379 return false;
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 941
941 return match; 942 return match;
942 } 943 }
943 944
944 void SearchProvider::UpdateDone() { 945 void SearchProvider::UpdateDone() {
945 // We're done when there are no more suggest queries pending (this is set to 1 946 // We're done when there are no more suggest queries pending (this is set to 1
946 // when the timer is started) and we're not waiting on instant. 947 // when the timer is started) and we're not waiting on instant.
947 done_ = ((suggest_results_pending_ == 0) && 948 done_ = ((suggest_results_pending_ == 0) &&
948 (instant_finalized_ || !InstantController::IsEnabled(profile_))); 949 (instant_finalized_ || !InstantController::IsEnabled(profile_)));
949 } 950 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/autocomplete.cc ('k') | chrome/browser/bookmarks/bookmark_drop_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698