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

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

Issue 1805363002: Add traces for main omnibox providers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added TBR=oysteine@chromium.org 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 | « components/omnibox/browser/shortcuts_provider.cc ('k') | no next file » | 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/zero_suggest_provider.h" 5 #include "components/omnibox/browser/zero_suggest_provider.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/i18n/case_conversion.h" 10 #include "base/i18n/case_conversion.h"
11 #include "base/json/json_string_value_serializer.h" 11 #include "base/json/json_string_value_serializer.h"
12 #include "base/metrics/histogram.h" 12 #include "base/metrics/histogram.h"
13 #include "base/metrics/user_metrics.h" 13 #include "base/metrics/user_metrics.h"
14 #include "base/strings/string16.h" 14 #include "base/strings/string16.h"
15 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
16 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 #include "base/trace_event/trace_event.h"
18 #include "components/data_use_measurement/core/data_use_user_data.h" 19 #include "components/data_use_measurement/core/data_use_user_data.h"
19 #include "components/history/core/browser/history_types.h" 20 #include "components/history/core/browser/history_types.h"
20 #include "components/history/core/browser/top_sites.h" 21 #include "components/history/core/browser/top_sites.h"
21 #include "components/metrics/proto/omnibox_input_type.pb.h" 22 #include "components/metrics/proto/omnibox_input_type.pb.h"
22 #include "components/omnibox/browser/autocomplete_classifier.h" 23 #include "components/omnibox/browser/autocomplete_classifier.h"
23 #include "components/omnibox/browser/autocomplete_input.h" 24 #include "components/omnibox/browser/autocomplete_input.h"
24 #include "components/omnibox/browser/autocomplete_match.h" 25 #include "components/omnibox/browser/autocomplete_match.h"
25 #include "components/omnibox/browser/autocomplete_provider_listener.h" 26 #include "components/omnibox/browser/autocomplete_provider_listener.h"
26 #include "components/omnibox/browser/history_url_provider.h" 27 #include "components/omnibox/browser/history_url_provider.h"
27 #include "components/omnibox/browser/omnibox_field_trial.h" 28 #include "components/omnibox/browser/omnibox_field_trial.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 79
79 // static 80 // static
80 void ZeroSuggestProvider::RegisterProfilePrefs( 81 void ZeroSuggestProvider::RegisterProfilePrefs(
81 user_prefs::PrefRegistrySyncable* registry) { 82 user_prefs::PrefRegistrySyncable* registry) {
82 registry->RegisterStringPref(omnibox::kZeroSuggestCachedResults, 83 registry->RegisterStringPref(omnibox::kZeroSuggestCachedResults,
83 std::string()); 84 std::string());
84 } 85 }
85 86
86 void ZeroSuggestProvider::Start(const AutocompleteInput& input, 87 void ZeroSuggestProvider::Start(const AutocompleteInput& input,
87 bool minimal_changes) { 88 bool minimal_changes) {
89 TRACE_EVENT0("omnibox", "ZeroSuggestProvider::Start");
88 matches_.clear(); 90 matches_.clear();
89 if (!input.from_omnibox_focus() || 91 if (!input.from_omnibox_focus() ||
90 input.type() == metrics::OmniboxInputType::INVALID) 92 input.type() == metrics::OmniboxInputType::INVALID)
91 return; 93 return;
92 94
93 Stop(true, false); 95 Stop(true, false);
94 set_field_trial_triggered(false); 96 set_field_trial_triggered(false);
95 set_field_trial_triggered_in_session(false); 97 set_field_trial_triggered_in_session(false);
96 results_from_cache_ = false; 98 results_from_cache_ = false;
97 permanent_text_ = input.text(); 99 permanent_text_ = input.text();
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 if (!json_data.empty()) { 467 if (!json_data.empty()) {
466 scoped_ptr<base::Value> data( 468 scoped_ptr<base::Value> data(
467 SearchSuggestionParser::DeserializeJsonData(json_data)); 469 SearchSuggestionParser::DeserializeJsonData(json_data));
468 if (data && ParseSuggestResults( 470 if (data && ParseSuggestResults(
469 *data, kDefaultZeroSuggestRelevance, false, &results_)) { 471 *data, kDefaultZeroSuggestRelevance, false, &results_)) {
470 ConvertResultsToAutocompleteMatches(); 472 ConvertResultsToAutocompleteMatches();
471 results_from_cache_ = !matches_.empty(); 473 results_from_cache_ = !matches_.empty();
472 } 474 }
473 } 475 }
474 } 476 }
OLDNEW
« no previous file with comments | « components/omnibox/browser/shortcuts_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698