Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Side by Side Diff: chrome/browser/autocomplete/url_index_private_data.h

Issue 976423002: Remove ScoreHistoryMatch::Builder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cpplint
Patch Set: Rebase Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 CHROME_BROWSER_AUTOCOMPLETE_URL_INDEX_PRIVATE_DATA_H_ 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_URL_INDEX_PRIVATE_DATA_H_
6 #define CHROME_BROWSER_AUTOCOMPLETE_URL_INDEX_PRIVATE_DATA_H_ 6 #define CHROME_BROWSER_AUTOCOMPLETE_URL_INDEX_PRIVATE_DATA_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "chrome/browser/autocomplete/in_memory_url_index_cache.pb.h" 14 #include "chrome/browser/autocomplete/in_memory_url_index_cache.pb.h"
15 #include "chrome/browser/autocomplete/in_memory_url_index_types.h" 15 #include "chrome/browser/autocomplete/in_memory_url_index_types.h"
16 #include "chrome/browser/autocomplete/scored_history_match.h" 16 #include "chrome/browser/autocomplete/scored_history_match.h"
17 #include "components/history/core/browser/history_service.h" 17 #include "components/history/core/browser/history_service.h"
18 18
19 class HistoryQuickProviderTest; 19 class HistoryQuickProviderTest;
20 20
21 namespace bookmarks {
22 class BookmarkModel;
23 }
24
21 namespace in_memory_url_index { 25 namespace in_memory_url_index {
22 class InMemoryURLIndexCacheItem; 26 class InMemoryURLIndexCacheItem;
23 } 27 }
24 28
25 namespace history { 29 namespace history {
26 class HistoryDatabase; 30 class HistoryDatabase;
27 class InMemoryURLIndex; 31 class InMemoryURLIndex;
28 class RefCountedBool; 32 class RefCountedBool;
29 } 33 }
30 34
(...skipping 29 matching lines...) Expand all
60 // descending score. The full results set (i.e. beyond the 64 // descending score. The full results set (i.e. beyond the
61 // |kItemsToScoreLimit| limit) will be retained and used for subsequent calls 65 // |kItemsToScoreLimit| limit) will be retained and used for subsequent calls
62 // to this function. |languages| is used to help parse/format the URLs in the 66 // to this function. |languages| is used to help parse/format the URLs in the
63 // history index. In total, |max_matches| of items will be returned in the 67 // history index. In total, |max_matches| of items will be returned in the
64 // |ScoredHistoryMatches| vector. 68 // |ScoredHistoryMatches| vector.
65 ScoredHistoryMatches HistoryItemsForTerms( 69 ScoredHistoryMatches HistoryItemsForTerms(
66 base::string16 term_string, 70 base::string16 term_string,
67 size_t cursor_position, 71 size_t cursor_position,
68 size_t max_matches, 72 size_t max_matches,
69 const std::string& languages, 73 const std::string& languages,
70 const ScoredHistoryMatch::Builder& builder); 74 bookmarks::BookmarkModel* bookmark_model);
71 75
72 // Adds the history item in |row| to the index if it does not already already 76 // Adds the history item in |row| to the index if it does not already already
73 // exist and it meets the minimum 'quick' criteria. If the row already exists 77 // exist and it meets the minimum 'quick' criteria. If the row already exists
74 // in the index then the index will be updated if the row still meets the 78 // in the index then the index will be updated if the row still meets the
75 // criteria, otherwise the row will be removed from the index. Returns true 79 // criteria, otherwise the row will be removed from the index. Returns true
76 // if the index was actually updated. |languages| gives a list of language 80 // if the index was actually updated. |languages| gives a list of language
77 // encodings by which the URLs and page titles are broken down into words and 81 // encodings by which the URLs and page titles are broken down into words and
78 // characters. |scheme_whitelist| is used to filter non-qualifying schemes. 82 // characters. |scheme_whitelist| is used to filter non-qualifying schemes.
79 // |history_service| is used to schedule an update to the recent visits 83 // |history_service| is used to schedule an update to the recent visits
80 // component of this URL's entry in the index. 84 // component of this URL's entry in the index.
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 WordIDSet word_id_set_; 187 WordIDSet word_id_set_;
184 HistoryIDSet history_id_set_; 188 HistoryIDSet history_id_set_;
185 bool used_; // True if this item has been used for the current term search. 189 bool used_; // True if this item has been used for the current term search.
186 }; 190 };
187 typedef std::map<base::string16, SearchTermCacheItem> SearchTermCacheMap; 191 typedef std::map<base::string16, SearchTermCacheItem> SearchTermCacheMap;
188 192
189 // A helper class which performs the final filter on each candidate 193 // A helper class which performs the final filter on each candidate
190 // history URL match, inserting accepted matches into |scored_matches_|. 194 // history URL match, inserting accepted matches into |scored_matches_|.
191 class AddHistoryMatch : public std::unary_function<HistoryID, void> { 195 class AddHistoryMatch : public std::unary_function<HistoryID, void> {
192 public: 196 public:
193 AddHistoryMatch(const URLIndexPrivateData& private_data, 197 AddHistoryMatch(bookmarks::BookmarkModel* bookmark_model,
198 const URLIndexPrivateData& private_data,
194 const std::string& languages, 199 const std::string& languages,
195 const base::string16& lower_string, 200 const base::string16& lower_string,
196 const String16Vector& lower_terms, 201 const String16Vector& lower_terms,
197 const base::Time now, 202 const base::Time now);
198 const ScoredHistoryMatch::Builder& builder);
199 ~AddHistoryMatch(); 203 ~AddHistoryMatch();
200 204
201 void operator()(const HistoryID history_id); 205 void operator()(const HistoryID history_id);
202 206
203 ScoredHistoryMatches ScoredMatches() const { return scored_matches_; } 207 ScoredHistoryMatches ScoredMatches() const { return scored_matches_; }
204 208
205 private: 209 private:
210 bookmarks::BookmarkModel* bookmark_model_;
206 const URLIndexPrivateData& private_data_; 211 const URLIndexPrivateData& private_data_;
207 const std::string& languages_; 212 const std::string& languages_;
208 const ScoredHistoryMatch::Builder& builder_;
209 ScoredHistoryMatches scored_matches_; 213 ScoredHistoryMatches scored_matches_;
210 const base::string16& lower_string_; 214 const base::string16& lower_string_;
211 const String16Vector& lower_terms_; 215 const String16Vector& lower_terms_;
212 WordStarts lower_terms_to_word_starts_offsets_; 216 WordStarts lower_terms_to_word_starts_offsets_;
213 const base::Time now_; 217 const base::Time now_;
214 }; 218 };
215 219
216 // A helper predicate class used to filter excess history items when the 220 // A helper predicate class used to filter excess history items when the
217 // candidate results set is too large. 221 // candidate results set is too large.
218 class HistoryItemFactorGreater 222 class HistoryItemFactorGreater
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 int saved_cache_version_; 398 int saved_cache_version_;
395 399
396 // Used for unit testing only. Records the number of candidate history items 400 // Used for unit testing only. Records the number of candidate history items
397 // at three stages in the index searching process. 401 // at three stages in the index searching process.
398 size_t pre_filter_item_count_; // After word index is queried. 402 size_t pre_filter_item_count_; // After word index is queried.
399 size_t post_filter_item_count_; // After trimming large result set. 403 size_t post_filter_item_count_; // After trimming large result set.
400 size_t post_scoring_item_count_; // After performing final filter/scoring. 404 size_t post_scoring_item_count_; // After performing final filter/scoring.
401 }; 405 };
402 406
403 #endif // CHROME_BROWSER_AUTOCOMPLETE_URL_INDEX_PRIVATE_DATA_H_ 407 #endif // CHROME_BROWSER_AUTOCOMPLETE_URL_INDEX_PRIVATE_DATA_H_
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/scored_history_match_unittest.cc ('k') | chrome/browser/autocomplete/url_index_private_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698