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/ui/webui/omnibox/omnibox_page_handler.h" | 5 #include "chrome/browser/ui/webui/omnibox/omnibox_page_handler.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 int32_t page_classification) { | 193 int32_t page_classification) { |
194 // Reset the controller. If we don't do this, then the | 194 // Reset the controller. If we don't do this, then the |
195 // AutocompleteController might inappropriately set its |minimal_changes| | 195 // AutocompleteController might inappropriately set its |minimal_changes| |
196 // variable (or something else) and some providers will short-circuit | 196 // variable (or something else) and some providers will short-circuit |
197 // important logic and return stale results. In short, we want the | 197 // important logic and return stale results. In short, we want the |
198 // actual results to not depend on the state of the previous request. | 198 // actual results to not depend on the state of the previous request. |
199 ResetController(); | 199 ResetController(); |
200 time_omnibox_started_ = base::Time::Now(); | 200 time_omnibox_started_ = base::Time::Now(); |
201 input_ = AutocompleteInput( | 201 input_ = AutocompleteInput( |
202 base::UTF8ToUTF16(input_string), cursor_position, std::string(), GURL(), | 202 base::UTF8ToUTF16(input_string), cursor_position, std::string(), GURL(), |
| 203 base::string16(), |
203 static_cast<metrics::OmniboxEventProto::PageClassification>( | 204 static_cast<metrics::OmniboxEventProto::PageClassification>( |
204 page_classification), | 205 page_classification), |
205 prevent_inline_autocomplete, prefer_keyword, true, true, false, | 206 prevent_inline_autocomplete, prefer_keyword, true, true, false, |
206 ChromeAutocompleteSchemeClassifier(profile_)); | 207 ChromeAutocompleteSchemeClassifier(profile_)); |
207 controller_->Start(input_); | 208 controller_->Start(input_); |
208 } | 209 } |
209 | 210 |
210 void OmniboxPageHandler::ResetController() { | 211 void OmniboxPageHandler::ResetController() { |
211 controller_.reset(new AutocompleteController( | 212 controller_.reset(new AutocompleteController( |
212 base::MakeUnique<ChromeAutocompleteProviderClient>(profile_), this, | 213 base::MakeUnique<ChromeAutocompleteProviderClient>(profile_), this, |
213 AutocompleteClassifier::DefaultOmniboxProviders())); | 214 AutocompleteClassifier::DefaultOmniboxProviders())); |
214 } | 215 } |
OLD | NEW |