| OLD | NEW |
| 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_contents_provider.h" | 5 #include "chrome/browser/autocomplete/history_contents_provider.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 const HistoryContentsProvider::MatchReference& rhs) { | 44 const HistoryContentsProvider::MatchReference& rhs) { |
| 45 if (lhs.relevance != rhs.relevance) | 45 if (lhs.relevance != rhs.relevance) |
| 46 return lhs.relevance > rhs.relevance; | 46 return lhs.relevance > rhs.relevance; |
| 47 return lhs.result->last_visit() > rhs.result->last_visit(); | 47 return lhs.result->last_visit() > rhs.result->last_visit(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 HistoryContentsProvider::HistoryContentsProvider( | 50 HistoryContentsProvider::HistoryContentsProvider( |
| 51 AutocompleteProviderListener* listener, | 51 AutocompleteProviderListener* listener, |
| 52 Profile* profile, | 52 Profile* profile, |
| 53 bool body_only) | 53 bool body_only) |
| 54 : HistoryProvider(listener, profile, "HistoryContents"), | 54 : HistoryProvider(listener, |
| 55 profile, |
| 56 AutocompleteProvider::TYPE_HISTORY_CONTENTS), |
| 55 star_title_count_(0), | 57 star_title_count_(0), |
| 56 star_contents_count_(0), | 58 star_contents_count_(0), |
| 57 title_count_(0), | 59 title_count_(0), |
| 58 contents_count_(0), | 60 contents_count_(0), |
| 59 input_type_(AutocompleteInput::INVALID), | 61 input_type_(AutocompleteInput::INVALID), |
| 60 body_only_(body_only), | 62 body_only_(body_only), |
| 61 trim_http_(false), | 63 trim_http_(false), |
| 62 have_results_(false) { | 64 have_results_(false) { |
| 63 } | 65 } |
| 64 | 66 |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 UMA_HISTOGRAM_TIMES("Omnibox.QueryBookmarksTime", | 284 UMA_HISTOGRAM_TIMES("Omnibox.QueryBookmarksTime", |
| 283 TimeTicks::Now() - start_time); | 285 TimeTicks::Now() - start_time); |
| 284 } | 286 } |
| 285 | 287 |
| 286 void HistoryContentsProvider::AddBookmarkTitleMatchToResults( | 288 void HistoryContentsProvider::AddBookmarkTitleMatchToResults( |
| 287 const bookmark_utils::TitleMatch& match) { | 289 const bookmark_utils::TitleMatch& match) { |
| 288 history::URLResult url_result(match.node->url(), match.match_positions); | 290 history::URLResult url_result(match.node->url(), match.match_positions); |
| 289 url_result.set_title(match.node->GetTitle()); | 291 url_result.set_title(match.node->GetTitle()); |
| 290 results_.AppendURLBySwapping(&url_result); | 292 results_.AppendURLBySwapping(&url_result); |
| 291 } | 293 } |
| OLD | NEW |