| OLD | NEW |
| 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 #include "chrome/browser/autocomplete/autocomplete_controller.h" | 5 #include "chrome/browser/autocomplete/autocomplete_controller.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 if (clear_result && !result_.empty()) { | 298 if (clear_result && !result_.empty()) { |
| 299 result_.Reset(); | 299 result_.Reset(); |
| 300 // NOTE: We pass in false since we're trying to only clear the popup, not | 300 // NOTE: We pass in false since we're trying to only clear the popup, not |
| 301 // touch the edit... this is all a mess and should be cleaned up :( | 301 // touch the edit... this is all a mess and should be cleaned up :( |
| 302 NotifyChanged(false); | 302 NotifyChanged(false); |
| 303 } | 303 } |
| 304 } | 304 } |
| 305 | 305 |
| 306 void AutocompleteController::StartZeroSuggest( | 306 void AutocompleteController::StartZeroSuggest( |
| 307 const GURL& url, | 307 const GURL& url, |
| 308 AutocompleteInput::PageClassification page_classification, | 308 AutocompleteInput::OmniboxContext omnibox_context, |
| 309 const string16& permanent_text) { | 309 const string16& permanent_text) { |
| 310 if (zero_suggest_provider_ != NULL) { | 310 if (zero_suggest_provider_ != NULL) { |
| 311 DCHECK(!in_start_); // We should not be already running a query. | 311 DCHECK(!in_start_); // We should not be already running a query. |
| 312 in_zero_suggest_ = true; | 312 in_zero_suggest_ = true; |
| 313 zero_suggest_provider_->StartZeroSuggest( | 313 zero_suggest_provider_->StartZeroSuggest( |
| 314 url, page_classification, permanent_text); | 314 url, omnibox_context, permanent_text); |
| 315 } | 315 } |
| 316 } | 316 } |
| 317 | 317 |
| 318 void AutocompleteController::StopZeroSuggest() { | 318 void AutocompleteController::StopZeroSuggest() { |
| 319 if (zero_suggest_provider_ != NULL) { | 319 if (zero_suggest_provider_ != NULL) { |
| 320 DCHECK(!in_start_); // We should not be already running a query. | 320 DCHECK(!in_start_); // We should not be already running a query. |
| 321 zero_suggest_provider_->Stop(false); | 321 zero_suggest_provider_->Stop(false); |
| 322 } | 322 } |
| 323 } | 323 } |
| 324 | 324 |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 // the disruptive effect of belated omnibox updates, updates that | 631 // the disruptive effect of belated omnibox updates, updates that |
| 632 // come after the user has had to time to read the whole dropdown | 632 // come after the user has had to time to read the whole dropdown |
| 633 // and doesn't expect it to change. | 633 // and doesn't expect it to change. |
| 634 const int kStopTimeMS = 1500; | 634 const int kStopTimeMS = 1500; |
| 635 stop_timer_.Start(FROM_HERE, | 635 stop_timer_.Start(FROM_HERE, |
| 636 base::TimeDelta::FromMilliseconds(kStopTimeMS), | 636 base::TimeDelta::FromMilliseconds(kStopTimeMS), |
| 637 base::Bind(&AutocompleteController::Stop, | 637 base::Bind(&AutocompleteController::Stop, |
| 638 base::Unretained(this), | 638 base::Unretained(this), |
| 639 false)); | 639 false)); |
| 640 } | 640 } |
| OLD | NEW |