OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/i18n/break_iterator.h" | 8 #include "base/i18n/break_iterator.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // TODO(pkasting): We should just block here until this loads. Any time | 64 // TODO(pkasting): We should just block here until this loads. Any time |
65 // someone unloads the history backend, we'll get inconsistent inline | 65 // someone unloads the history backend, we'll get inconsistent inline |
66 // autocomplete behavior here. | 66 // autocomplete behavior here. |
67 if (GetIndex()) { | 67 if (GetIndex()) { |
68 base::TimeTicks start_time = base::TimeTicks::Now(); | 68 base::TimeTicks start_time = base::TimeTicks::Now(); |
69 DoAutocomplete(); | 69 DoAutocomplete(); |
70 if (input.text().size() < 6) { | 70 if (input.text().size() < 6) { |
71 base::TimeTicks end_time = base::TimeTicks::Now(); | 71 base::TimeTicks end_time = base::TimeTicks::Now(); |
72 std::string name = "HistoryQuickProvider.QueryIndexTime." + | 72 std::string name = "HistoryQuickProvider.QueryIndexTime." + |
73 base::IntToString(input.text().size()); | 73 base::IntToString(input.text().size()); |
74 scoped_refptr<base::Histogram> counter = base::Histogram::FactoryGet( | 74 base::Histogram* counter = base::Histogram::FactoryGet( |
75 name, 1, 1000, 50, base::Histogram::kUmaTargetedHistogramFlag); | 75 name, 1, 1000, 50, base::Histogram::kUmaTargetedHistogramFlag); |
76 counter->Add(static_cast<int>((end_time - start_time).InMilliseconds())); | 76 counter->Add(static_cast<int>((end_time - start_time).InMilliseconds())); |
77 } | 77 } |
78 UpdateStarredStateOfMatches(); | 78 UpdateStarredStateOfMatches(); |
79 } | 79 } |
80 } | 80 } |
81 | 81 |
82 // HistoryQuickProvider matches are currently not deletable. | 82 // HistoryQuickProvider matches are currently not deletable. |
83 // TODO(mrossetti): Determine when a match should be deletable. | 83 // TODO(mrossetti): Determine when a match should be deletable. |
84 void HistoryQuickProvider::DeleteMatch(const AutocompleteMatch& match) {} | 84 void HistoryQuickProvider::DeleteMatch(const AutocompleteMatch& match) {} |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 ++i; | 210 ++i; |
211 } while ((i < match_count) && (offset == matches[i].offset)); | 211 } while ((i < match_count) && (offset == matches[i].offset)); |
212 if (offset < text_length) { | 212 if (offset < text_length) { |
213 spans.push_back(ACMatchClassification(offset, | 213 spans.push_back(ACMatchClassification(offset, |
214 ACMatchClassification::NONE)); | 214 ACMatchClassification::NONE)); |
215 } | 215 } |
216 } | 216 } |
217 | 217 |
218 return spans; | 218 return spans; |
219 } | 219 } |
OLD | NEW |