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

Side by Side Diff: components/omnibox/browser/autocomplete_controller.cc

Issue 1815653002: Revert of Add traces for main omnibox providers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | components/omnibox/browser/bookmark_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
11 11
12 #include "base/format_macros.h" 12 #include "base/format_macros.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
15 #include "base/strings/string_number_conversions.h" 15 #include "base/strings/string_number_conversions.h"
16 #include "base/strings/stringprintf.h" 16 #include "base/strings/stringprintf.h"
17 #include "base/strings/utf_string_conversions.h"
18 #include "base/time/time.h" 17 #include "base/time/time.h"
19 #include "base/trace_event/trace_event.h"
20 #include "build/build_config.h" 18 #include "build/build_config.h"
21 #include "components/omnibox/browser/autocomplete_controller_delegate.h" 19 #include "components/omnibox/browser/autocomplete_controller_delegate.h"
22 #include "components/omnibox/browser/bookmark_provider.h" 20 #include "components/omnibox/browser/bookmark_provider.h"
23 #include "components/omnibox/browser/builtin_provider.h" 21 #include "components/omnibox/browser/builtin_provider.h"
24 #include "components/omnibox/browser/clipboard_url_provider.h" 22 #include "components/omnibox/browser/clipboard_url_provider.h"
25 #include "components/omnibox/browser/history_quick_provider.h" 23 #include "components/omnibox/browser/history_quick_provider.h"
26 #include "components/omnibox/browser/history_url_provider.h" 24 #include "components/omnibox/browser/history_url_provider.h"
27 #include "components/omnibox/browser/keyword_provider.h" 25 #include "components/omnibox/browser/keyword_provider.h"
28 #include "components/omnibox/browser/omnibox_field_trial.h" 26 #include "components/omnibox/browser/omnibox_field_trial.h"
29 #include "components/omnibox/browser/search_provider.h" 27 #include "components/omnibox/browser/search_provider.h"
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 // to ensure they won't call us back if they outlive us. (Practically, 224 // to ensure they won't call us back if they outlive us. (Practically,
227 // calling Stop() should also cancel those tasks and make it so that we hold 225 // calling Stop() should also cancel those tasks and make it so that we hold
228 // the only refs.) We also don't want to bother notifying anyone of our 226 // the only refs.) We also don't want to bother notifying anyone of our
229 // result changes here, because the notification observer is in the midst of 227 // result changes here, because the notification observer is in the midst of
230 // shutdown too, so we don't ask Stop() to clear |result_| (and notify). 228 // shutdown too, so we don't ask Stop() to clear |result_| (and notify).
231 result_.Reset(); // Not really necessary. 229 result_.Reset(); // Not really necessary.
232 Stop(false); 230 Stop(false);
233 } 231 }
234 232
235 void AutocompleteController::Start(const AutocompleteInput& input) { 233 void AutocompleteController::Start(const AutocompleteInput& input) {
236 TRACE_EVENT1("omnibox", "AutocompleteController::Start",
237 "text", base::UTF16ToUTF8(input.text()));
238 const base::string16 old_input_text(input_.text()); 234 const base::string16 old_input_text(input_.text());
239 const bool old_want_asynchronous_matches = input_.want_asynchronous_matches(); 235 const bool old_want_asynchronous_matches = input_.want_asynchronous_matches();
240 const bool old_from_omnibox_focus = input_.from_omnibox_focus(); 236 const bool old_from_omnibox_focus = input_.from_omnibox_focus();
241 input_ = input; 237 input_ = input;
242 238
243 // See if we can avoid rerunning autocomplete when the query hasn't changed 239 // See if we can avoid rerunning autocomplete when the query hasn't changed
244 // much. When the user presses or releases the ctrl key, the desired_tld 240 // much. When the user presses or releases the ctrl key, the desired_tld
245 // changes, and when the user finishes an IME composition, inline autocomplete 241 // changes, and when the user finishes an IME composition, inline autocomplete
246 // may no longer be prevented. In both these cases the text itself hasn't 242 // may no longer be prevented. In both these cases the text itself hasn't
247 // changed since the last query, and some providers can do much less work (and 243 // changed since the last query, and some providers can do much less work (and
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 if (!template_url) 388 if (!template_url)
393 return; 389 return;
394 390
395 match->destination_url = GURL(template_url->url_ref().ReplaceSearchTerms( 391 match->destination_url = GURL(template_url->url_ref().ReplaceSearchTerms(
396 search_terms_args, template_url_service_->search_terms_data())); 392 search_terms_args, template_url_service_->search_terms_data()));
397 } 393 }
398 394
399 void AutocompleteController::UpdateResult( 395 void AutocompleteController::UpdateResult(
400 bool regenerate_result, 396 bool regenerate_result,
401 bool force_notify_default_match_changed) { 397 bool force_notify_default_match_changed) {
402 TRACE_EVENT0("omnibox", "AutocompleteController::UpdateResult");
403 const bool last_default_was_valid = result_.default_match() != result_.end(); 398 const bool last_default_was_valid = result_.default_match() != result_.end();
404 // The following three variables are only set and used if 399 // The following three variables are only set and used if
405 // |last_default_was_valid|. 400 // |last_default_was_valid|.
406 base::string16 last_default_fill_into_edit, last_default_keyword, 401 base::string16 last_default_fill_into_edit, last_default_keyword,
407 last_default_associated_keyword; 402 last_default_associated_keyword;
408 if (last_default_was_valid) { 403 if (last_default_was_valid) {
409 last_default_fill_into_edit = result_.default_match()->fill_into_edit; 404 last_default_fill_into_edit = result_.default_match()->fill_into_edit;
410 last_default_keyword = result_.default_match()->keyword; 405 last_default_keyword = result_.default_match()->keyword;
411 if (result_.default_match()->associated_keyword != NULL) 406 if (result_.default_match()->associated_keyword != NULL)
412 last_default_associated_keyword = 407 last_default_associated_keyword =
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 expire_timer_.Stop(); 652 expire_timer_.Stop();
658 stop_timer_.Stop(); 653 stop_timer_.Stop();
659 done_ = true; 654 done_ = true;
660 if (clear_result && !result_.empty()) { 655 if (clear_result && !result_.empty()) {
661 result_.Reset(); 656 result_.Reset();
662 // NOTE: We pass in false since we're trying to only clear the popup, not 657 // NOTE: We pass in false since we're trying to only clear the popup, not
663 // touch the edit... this is all a mess and should be cleaned up :( 658 // touch the edit... this is all a mess and should be cleaned up :(
664 NotifyChanged(false); 659 NotifyChanged(false);
665 } 660 }
666 } 661 }
OLDNEW
« no previous file with comments | « no previous file | components/omnibox/browser/bookmark_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698