| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/histogram.h" | 7 #include "base/histogram.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "chrome/browser/bookmarks/bookmark_model.h" | 9 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 10 #include "chrome/browser/history/query_parser.h" | 10 #include "chrome/browser/history/query_parser.h" |
| 11 #include "chrome/browser/profile.h" | 11 #include "chrome/browser/profile.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 ConvertResults(); | 111 ConvertResults(); |
| 112 | 112 |
| 113 if (!input.synchronous_only()) { | 113 if (!input.synchronous_only()) { |
| 114 HistoryService* history = | 114 HistoryService* history = |
| 115 profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); | 115 profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); |
| 116 if (history) { | 116 if (history) { |
| 117 done_ = false; | 117 done_ = false; |
| 118 | 118 |
| 119 history::QueryOptions options; | 119 history::QueryOptions options; |
| 120 options.SetRecentDayRange(kDaysToSearch); | 120 options.SetRecentDayRange(kDaysToSearch); |
| 121 options.most_recent_visit_only = true; | |
| 122 options.max_count = kMaxMatchCount; | 121 options.max_count = kMaxMatchCount; |
| 123 history->QueryHistory(input.text(), options, &request_consumer_, | 122 history->QueryHistory(input.text(), options, &request_consumer_, |
| 124 NewCallback(this, &HistoryContentsProvider::QueryComplete)); | 123 NewCallback(this, &HistoryContentsProvider::QueryComplete)); |
| 125 } | 124 } |
| 126 } | 125 } |
| 127 } | 126 } |
| 128 | 127 |
| 129 void HistoryContentsProvider::Stop() { | 128 void HistoryContentsProvider::Stop() { |
| 130 done_ = true; | 129 done_ = true; |
| 131 request_consumer_.CancelAllRequests(); | 130 request_consumer_.CancelAllRequests(); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 UMA_HISTOGRAM_TIMES("Omnibox.QueryBookmarksTime", | 272 UMA_HISTOGRAM_TIMES("Omnibox.QueryBookmarksTime", |
| 274 TimeTicks::Now() - start_time); | 273 TimeTicks::Now() - start_time); |
| 275 } | 274 } |
| 276 | 275 |
| 277 void HistoryContentsProvider::AddBookmarkTitleMatchToResults( | 276 void HistoryContentsProvider::AddBookmarkTitleMatchToResults( |
| 278 const bookmark_utils::TitleMatch& match) { | 277 const bookmark_utils::TitleMatch& match) { |
| 279 history::URLResult url_result(match.node->GetURL(), match.match_positions); | 278 history::URLResult url_result(match.node->GetURL(), match.match_positions); |
| 280 url_result.set_title(match.node->GetTitle()); | 279 url_result.set_title(match.node->GetTitle()); |
| 281 results_.AppendURLBySwapping(&url_result); | 280 results_.AppendURLBySwapping(&url_result); |
| 282 } | 281 } |
| OLD | NEW |