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 "components/omnibox/browser/autocomplete_controller.h" | 5 #include "components/omnibox/browser/autocomplete_controller.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 // to ensure they won't call us back if they outlive us. (Practically, | 234 // to ensure they won't call us back if they outlive us. (Practically, |
235 // calling Stop() should also cancel those tasks and make it so that we hold | 235 // calling Stop() should also cancel those tasks and make it so that we hold |
236 // the only refs.) We also don't want to bother notifying anyone of our | 236 // the only refs.) We also don't want to bother notifying anyone of our |
237 // result changes here, because the notification observer is in the midst of | 237 // result changes here, because the notification observer is in the midst of |
238 // shutdown too, so we don't ask Stop() to clear |result_| (and notify). | 238 // shutdown too, so we don't ask Stop() to clear |result_| (and notify). |
239 result_.Reset(); // Not really necessary. | 239 result_.Reset(); // Not really necessary. |
240 Stop(false); | 240 Stop(false); |
241 } | 241 } |
242 | 242 |
243 void AutocompleteController::Start(const AutocompleteInput& input) { | 243 void AutocompleteController::Start(const AutocompleteInput& input) { |
| 244 SCOPED_UMA_HISTOGRAM_TIMER("Omnibox.StartSearchToFirstResultsTime"); |
244 TRACE_EVENT1("omnibox", "AutocompleteController::Start", | 245 TRACE_EVENT1("omnibox", "AutocompleteController::Start", |
245 "text", base::UTF16ToUTF8(input.text())); | 246 "text", base::UTF16ToUTF8(input.text())); |
246 const base::string16 old_input_text(input_.text()); | 247 const base::string16 old_input_text(input_.text()); |
247 const bool old_allow_exact_keyword_match = input_.allow_exact_keyword_match(); | 248 const bool old_allow_exact_keyword_match = input_.allow_exact_keyword_match(); |
248 const bool old_want_asynchronous_matches = input_.want_asynchronous_matches(); | 249 const bool old_want_asynchronous_matches = input_.want_asynchronous_matches(); |
249 const bool old_from_omnibox_focus = input_.from_omnibox_focus(); | 250 const bool old_from_omnibox_focus = input_.from_omnibox_focus(); |
250 input_ = input; | 251 input_ = input; |
251 | 252 |
252 // See if we can avoid rerunning autocomplete when the query hasn't changed | 253 // See if we can avoid rerunning autocomplete when the query hasn't changed |
253 // much. When the user presses or releases the ctrl key, the desired_tld | 254 // much. When the user presses or releases the ctrl key, the desired_tld |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 expire_timer_.Stop(); | 667 expire_timer_.Stop(); |
667 stop_timer_.Stop(); | 668 stop_timer_.Stop(); |
668 done_ = true; | 669 done_ = true; |
669 if (clear_result && !result_.empty()) { | 670 if (clear_result && !result_.empty()) { |
670 result_.Reset(); | 671 result_.Reset(); |
671 // NOTE: We pass in false since we're trying to only clear the popup, not | 672 // NOTE: We pass in false since we're trying to only clear the popup, not |
672 // touch the edit... this is all a mess and should be cleaned up :( | 673 // touch the edit... this is all a mess and should be cleaned up :( |
673 NotifyChanged(false); | 674 NotifyChanged(false); |
674 } | 675 } |
675 } | 676 } |
OLD | NEW |