OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_contents_provider.h" | 5 #include "chrome/browser/autocomplete/history_contents_provider.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // get marked up for this new input. In synchronous_only mode, cancel the | 106 // get marked up for this new input. In synchronous_only mode, cancel the |
107 // history query. | 107 // history query. |
108 if (input.synchronous_only()) { | 108 if (input.synchronous_only()) { |
109 done_ = true; | 109 done_ = true; |
110 request_consumer_.CancelAllRequests(); | 110 request_consumer_.CancelAllRequests(); |
111 } | 111 } |
112 ConvertResults(); | 112 ConvertResults(); |
113 return; | 113 return; |
114 } | 114 } |
115 | 115 |
116 if (results_.size() != 0) { | 116 if (!results_.empty()) { |
117 // Clear the results. We swap in an empty one as the easy way to clear it. | 117 // Clear the results. We swap in an empty one as the easy way to clear it. |
118 history::QueryResults empty_results; | 118 history::QueryResults empty_results; |
119 results_.Swap(&empty_results); | 119 results_.Swap(&empty_results); |
120 } | 120 } |
121 | 121 |
122 // Querying bookmarks is synchronous, so we always do it. | 122 // Querying bookmarks is synchronous, so we always do it. |
123 QueryBookmarks(input); | 123 QueryBookmarks(input); |
124 | 124 |
125 // Convert the bookmark results. | 125 // Convert the bookmark results. |
126 ConvertResults(); | 126 ConvertResults(); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 UMA_HISTOGRAM_TIMES("Omnibox.QueryBookmarksTime", | 272 UMA_HISTOGRAM_TIMES("Omnibox.QueryBookmarksTime", |
273 TimeTicks::Now() - start_time); | 273 TimeTicks::Now() - start_time); |
274 } | 274 } |
275 | 275 |
276 void HistoryContentsProvider::AddBookmarkTitleMatchToResults( | 276 void HistoryContentsProvider::AddBookmarkTitleMatchToResults( |
277 const bookmark_utils::TitleMatch& match) { | 277 const bookmark_utils::TitleMatch& match) { |
278 history::URLResult url_result(match.node->GetURL(), match.match_positions); | 278 history::URLResult url_result(match.node->GetURL(), match.match_positions); |
279 url_result.set_title(match.node->GetTitle()); | 279 url_result.set_title(match.node->GetTitle()); |
280 results_.AppendURLBySwapping(&url_result); | 280 results_.AppendURLBySwapping(&url_result); |
281 } | 281 } |
OLD | NEW |