Chromium Code Reviews| 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_ui_handler.h" | 5 #include "chrome/browser/ui/webui/omnibox/omnibox_ui_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 148 return_val = input->GetInteger(1, &cursor_position_int); | 148 return_val = input->GetInteger(1, &cursor_position_int); |
| 149 DCHECK(return_val); | 149 DCHECK(return_val); |
| 150 size_t cursor_position = cursor_position_int; | 150 size_t cursor_position = cursor_position_int; |
| 151 bool prevent_inline_autocomplete; | 151 bool prevent_inline_autocomplete; |
| 152 return_val = input->GetBoolean(2, &prevent_inline_autocomplete); | 152 return_val = input->GetBoolean(2, &prevent_inline_autocomplete); |
| 153 DCHECK(return_val); | 153 DCHECK(return_val); |
| 154 bool prefer_keyword; | 154 bool prefer_keyword; |
| 155 return_val = input->GetBoolean(3, &prefer_keyword); | 155 return_val = input->GetBoolean(3, &prefer_keyword); |
| 156 DCHECK(return_val); | 156 DCHECK(return_val); |
| 157 string16 empty_string; | 157 string16 empty_string; |
| 158 GURL empty_url; | |
|
Peter Kasting
2013/03/22 20:20:06
Nit: Let's nuke |empty_string| and |empty_url| and
beaudoin
2013/03/22 23:10:43
Done.
| |
| 158 // Reset the controller. If we don't do this, then the | 159 // Reset the controller. If we don't do this, then the |
| 159 // AutocompleteController might inappropriately set its |minimal_changes| | 160 // AutocompleteController might inappropriately set its |minimal_changes| |
| 160 // variable (or something else) and some providers will short-circuit | 161 // variable (or something else) and some providers will short-circuit |
| 161 // important logic and return stale results. In short, we want the | 162 // important logic and return stale results. In short, we want the |
| 162 // actual results to not depend on the state of the previous request. | 163 // actual results to not depend on the state of the previous request. |
| 163 ResetController(); | 164 ResetController(); |
| 164 time_omnibox_started_ = base::Time::Now(); | 165 time_omnibox_started_ = base::Time::Now(); |
| 165 controller_->Start(AutocompleteInput( | 166 controller_->Start(AutocompleteInput( |
| 166 input_string, | 167 input_string, |
| 167 cursor_position, | 168 cursor_position, |
| 168 empty_string, // user's desired tld (top-level domain) | 169 empty_string, // user's desired tld (top-level domain) |
| 170 empty_url, | |
| 169 prevent_inline_autocomplete, | 171 prevent_inline_autocomplete, |
| 170 prefer_keyword, | 172 prefer_keyword, |
| 171 true, // allow exact keyword matches | 173 true, // allow exact keyword matches |
| 172 AutocompleteInput::ALL_MATCHES)); // want all matches | 174 AutocompleteInput::ALL_MATCHES)); // want all matches |
| 173 } | 175 } |
| 174 | 176 |
| 175 void OmniboxUIHandler::ResetController() { | 177 void OmniboxUIHandler::ResetController() { |
| 176 controller_.reset(new AutocompleteController(profile_, this, | 178 controller_.reset(new AutocompleteController(profile_, this, |
| 177 chrome::search::IsInstantExtendedAPIEnabled() ? | 179 chrome::search::IsInstantExtendedAPIEnabled() ? |
| 178 AutocompleteClassifier::kInstantExtendedOmniboxProviders : | 180 AutocompleteClassifier::kInstantExtendedOmniboxProviders : |
| 179 AutocompleteClassifier::kDefaultOmniboxProviders)); | 181 AutocompleteClassifier::kDefaultOmniboxProviders)); |
| 180 } | 182 } |
| OLD | NEW |