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 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_SCORED_HISTORY_MATCH_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_SCORED_HISTORY_MATCH_H_ |
6 #define COMPONENTS_HISTORY_CORE_BROWSER_SCORED_HISTORY_MATCH_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_SCORED_HISTORY_MATCH_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "chrome/browser/autocomplete/in_memory_url_index_types.h" |
13 #include "components/history/core/browser/history_match.h" | 14 #include "components/history/core/browser/history_match.h" |
14 #include "components/history/core/browser/history_types.h" | 15 #include "components/history/core/browser/history_types.h" |
15 #include "components/history/core/browser/in_memory_url_index_types.h" | |
16 | 16 |
17 namespace history { | 17 namespace history { |
18 | 18 |
19 // An HistoryMatch that has a score as well as metrics defining where in the | 19 // An HistoryMatch that has a score as well as metrics defining where in the |
20 // history item's URL and/or page title matches have occurred. | 20 // history item's URL and/or page title matches have occurred. |
21 struct ScoredHistoryMatch : public HistoryMatch { | 21 struct ScoredHistoryMatch : public HistoryMatch { |
22 // The Builder inner class allows the embedder to control how matches are | 22 // The Builder inner class allows the embedder to control how matches are |
23 // scored (we cannot use a base::Callback<> as base::Bind() is limited to 6 | 23 // scored (we cannot use a base::Callback<> as base::Bind() is limited to 6 |
24 // parameters). | 24 // parameters). |
| 25 // TODO(sdefresne): remove this since ScoredHistoryMatch can now depends on |
| 26 // chrome/browser/autocomplete and components/bookmarks |
| 27 // http://crbug.com/462645 |
25 class Builder { | 28 class Builder { |
26 public: | 29 public: |
27 Builder() {} | 30 Builder() {} |
28 virtual ~Builder() {} | 31 virtual ~Builder() {} |
29 | 32 |
30 // Creates a new match with a raw score calculated for the history item | 33 // Creates a new match with a raw score calculated for the history item |
31 // given in |row| with recent visits as indicated in |visits|. First | 34 // given in |row| with recent visits as indicated in |visits|. First |
32 // determines if the row qualifies by seeing if all of the terms in | 35 // determines if the row qualifies by seeing if all of the terms in |
33 // |terms_vector| occur in |row|. If so, calculates a raw score. This raw | 36 // |terms_vector| occur in |row|. If so, calculates a raw score. This raw |
34 // score is in part determined by whether the matches occur at word | 37 // score is in part determined by whether the matches occur at word |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 // Term matches within the page title. | 101 // Term matches within the page title. |
99 TermMatches title_matches; | 102 TermMatches title_matches; |
100 | 103 |
101 // True if this is a candidate for in-line autocompletion. | 104 // True if this is a candidate for in-line autocompletion. |
102 bool can_inline; | 105 bool can_inline; |
103 }; | 106 }; |
104 typedef std::vector<ScoredHistoryMatch> ScoredHistoryMatches; | 107 typedef std::vector<ScoredHistoryMatch> ScoredHistoryMatches; |
105 | 108 |
106 } // namespace history | 109 } // namespace history |
107 | 110 |
108 #endif // COMPONENTS_HISTORY_CORE_BROWSER_SCORED_HISTORY_MATCH_H_ | 111 #endif // CHROME_BROWSER_AUTOCOMPLETE_SCORED_HISTORY_MATCH_H_ |
OLD | NEW |