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

Side by Side Diff: chrome/browser/autocomplete/history_quick_provider.cc

Issue 1132333004: [Omnibox] Remove unused histograms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing #include Created 5 years, 7 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 | 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 "chrome/browser/autocomplete/history_quick_provider.h" 5 #include "chrome/browser/autocomplete/history_quick_provider.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/debug/crash_logging.h" 11 #include "base/debug/crash_logging.h"
12 #include "base/i18n/break_iterator.h" 12 #include "base/i18n/break_iterator.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/metrics/field_trial.h" 14 #include "base/metrics/field_trial.h"
15 #include "base/metrics/histogram.h"
16 #include "base/prefs/pref_service.h" 15 #include "base/prefs/pref_service.h"
17 #include "base/strings/string_number_conversions.h" 16 #include "base/strings/string_number_conversions.h"
18 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
19 #include "base/strings/utf_string_conversions.h" 18 #include "base/strings/utf_string_conversions.h"
20 #include "base/time/time.h"
21 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" 19 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h"
22 #include "chrome/browser/autocomplete/history_url_provider.h" 20 #include "chrome/browser/autocomplete/history_url_provider.h"
23 #include "chrome/browser/autocomplete/in_memory_url_index.h" 21 #include "chrome/browser/autocomplete/in_memory_url_index.h"
24 #include "chrome/browser/autocomplete/in_memory_url_index_types.h" 22 #include "chrome/browser/autocomplete/in_memory_url_index_types.h"
25 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 23 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
26 #include "chrome/browser/history/history_service_factory.h" 24 #include "chrome/browser/history/history_service_factory.h"
27 #include "chrome/browser/profiles/profile.h" 25 #include "chrome/browser/profiles/profile.h"
28 #include "chrome/browser/search_engines/template_url_service_factory.h" 26 #include "chrome/browser/search_engines/template_url_service_factory.h"
29 #include "chrome/common/chrome_switches.h" 27 #include "chrome/common/chrome_switches.h"
30 #include "chrome/common/crash_keys.h" 28 #include "chrome/common/crash_keys.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 if ((input.type() == metrics::OmniboxInputType::INVALID) || 66 if ((input.type() == metrics::OmniboxInputType::INVALID) ||
69 (input.type() == metrics::OmniboxInputType::FORCED_QUERY)) 67 (input.type() == metrics::OmniboxInputType::FORCED_QUERY))
70 return; 68 return;
71 69
72 autocomplete_input_ = input; 70 autocomplete_input_ = input;
73 71
74 // TODO(pkasting): We should just block here until this loads. Any time 72 // TODO(pkasting): We should just block here until this loads. Any time
75 // someone unloads the history backend, we'll get inconsistent inline 73 // someone unloads the history backend, we'll get inconsistent inline
76 // autocomplete behavior here. 74 // autocomplete behavior here.
77 if (in_memory_url_index_) { 75 if (in_memory_url_index_) {
78 base::TimeTicks start_time = base::TimeTicks::Now();
79 DoAutocomplete(); 76 DoAutocomplete();
80 if (input.text().length() < 6) {
81 base::TimeTicks end_time = base::TimeTicks::Now();
82 std::string name = "HistoryQuickProvider.QueryIndexTime." +
83 base::IntToString(input.text().length());
84 base::HistogramBase* counter = base::Histogram::FactoryGet(
85 name, 1, 1000, 50, base::Histogram::kUmaTargetedHistogramFlag);
86 counter->Add(static_cast<int>((end_time - start_time).InMilliseconds()));
87 }
88 } 77 }
89 } 78 }
90 79
91 HistoryQuickProvider::~HistoryQuickProvider() { 80 HistoryQuickProvider::~HistoryQuickProvider() {
92 } 81 }
93 82
94 void HistoryQuickProvider::DoAutocomplete() { 83 void HistoryQuickProvider::DoAutocomplete() {
95 // Get the matching URLs from the DB. 84 // Get the matching URLs from the DB.
96 ScoredHistoryMatches matches = in_memory_url_index_->HistoryItemsForTerms( 85 ScoredHistoryMatches matches = in_memory_url_index_->HistoryItemsForTerms(
97 autocomplete_input_.text(), autocomplete_input_.cursor_position(), 86 autocomplete_input_.text(), autocomplete_input_.cursor_position(),
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 match.description = info.title(); 277 match.description = info.title();
289 match.description_class = SpansFromTermMatch( 278 match.description_class = SpansFromTermMatch(
290 history_match.title_matches, match.description.length(), false); 279 history_match.title_matches, match.description.length(), false);
291 280
292 match.RecordAdditionalInfo("typed count", info.typed_count()); 281 match.RecordAdditionalInfo("typed count", info.typed_count());
293 match.RecordAdditionalInfo("visit count", info.visit_count()); 282 match.RecordAdditionalInfo("visit count", info.visit_count());
294 match.RecordAdditionalInfo("last visit", info.last_visit()); 283 match.RecordAdditionalInfo("last visit", info.last_visit());
295 284
296 return match; 285 return match;
297 } 286 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698