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/scored_history_match.h" | 5 #include "chrome/browser/autocomplete/scored_history_match.h" |
6 | 6 |
7 namespace history { | |
8 | |
9 // static | 7 // static |
10 const size_t ScoredHistoryMatch::kMaxVisitsToScore = 10; | 8 const size_t ScoredHistoryMatch::kMaxVisitsToScore = 10; |
11 | 9 |
12 ScoredHistoryMatch::ScoredHistoryMatch() : raw_score(0), can_inline(false) { | 10 ScoredHistoryMatch::ScoredHistoryMatch() : raw_score(0), can_inline(false) { |
13 } | 11 } |
14 | 12 |
15 ScoredHistoryMatch::ScoredHistoryMatch(const URLRow& url_info, | 13 ScoredHistoryMatch::ScoredHistoryMatch(const history::URLRow& url_info, |
16 size_t input_location, | 14 size_t input_location, |
17 bool match_in_scheme, | 15 bool match_in_scheme, |
18 bool innermost_match, | 16 bool innermost_match, |
19 int raw_score, | 17 int raw_score, |
20 const TermMatches& url_matches, | 18 const TermMatches& url_matches, |
21 const TermMatches& title_matches, | 19 const TermMatches& title_matches, |
22 bool can_inline) | 20 bool can_inline) |
23 : HistoryMatch(url_info, input_location, match_in_scheme, innermost_match), | 21 : HistoryMatch(url_info, input_location, match_in_scheme, innermost_match), |
24 raw_score(raw_score), | 22 raw_score(raw_score), |
25 url_matches(url_matches), | 23 url_matches(url_matches), |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 return m1.IsHostOnly(); | 59 return m1.IsHostOnly(); |
62 } | 60 } |
63 | 61 |
64 // URLs that have been visited more often are better. | 62 // URLs that have been visited more often are better. |
65 if (m1.url_info.visit_count() != m2.url_info.visit_count()) | 63 if (m1.url_info.visit_count() != m2.url_info.visit_count()) |
66 return m1.url_info.visit_count() > m2.url_info.visit_count(); | 64 return m1.url_info.visit_count() > m2.url_info.visit_count(); |
67 | 65 |
68 // URLs that have been visited more recently are better. | 66 // URLs that have been visited more recently are better. |
69 return m1.url_info.last_visit() > m2.url_info.last_visit(); | 67 return m1.url_info.last_visit() > m2.url_info.last_visit(); |
70 } | 68 } |
71 | |
72 } // namespace history | |
OLD | NEW |