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 "components/omnibox/browser/url_index_private_data.h" | 5 #include "components/omnibox/browser/url_index_private_data.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <functional> | 9 #include <functional> |
10 #include <iterator> | 10 #include <iterator> |
(...skipping 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1260 | 1260 |
1261 URLIndexPrivateData::SearchTermCacheItem::SearchTermCacheItem( | 1261 URLIndexPrivateData::SearchTermCacheItem::SearchTermCacheItem( |
1262 const WordIDSet& word_id_set, | 1262 const WordIDSet& word_id_set, |
1263 const HistoryIDSet& history_id_set) | 1263 const HistoryIDSet& history_id_set) |
1264 : word_id_set_(word_id_set), history_id_set_(history_id_set), used_(true) { | 1264 : word_id_set_(word_id_set), history_id_set_(history_id_set), used_(true) { |
1265 } | 1265 } |
1266 | 1266 |
1267 URLIndexPrivateData::SearchTermCacheItem::SearchTermCacheItem() : used_(true) { | 1267 URLIndexPrivateData::SearchTermCacheItem::SearchTermCacheItem() : used_(true) { |
1268 } | 1268 } |
1269 | 1269 |
| 1270 URLIndexPrivateData::SearchTermCacheItem::SearchTermCacheItem( |
| 1271 const SearchTermCacheItem& other) = default; |
| 1272 |
1270 URLIndexPrivateData::SearchTermCacheItem::~SearchTermCacheItem() { | 1273 URLIndexPrivateData::SearchTermCacheItem::~SearchTermCacheItem() { |
1271 } | 1274 } |
1272 | 1275 |
1273 // URLIndexPrivateData::AddHistoryMatch ---------------------------------------- | 1276 // URLIndexPrivateData::AddHistoryMatch ---------------------------------------- |
1274 | 1277 |
1275 URLIndexPrivateData::AddHistoryMatch::AddHistoryMatch( | 1278 URLIndexPrivateData::AddHistoryMatch::AddHistoryMatch( |
1276 bookmarks::BookmarkModel* bookmark_model, | 1279 bookmarks::BookmarkModel* bookmark_model, |
1277 const URLIndexPrivateData& private_data, | 1280 const URLIndexPrivateData& private_data, |
1278 const std::string& languages, | 1281 const std::string& languages, |
1279 const base::string16& lower_string, | 1282 const base::string16& lower_string, |
(...skipping 17 matching lines...) Expand all Loading... |
1297 continue; | 1300 continue; |
1298 // Find the first word start. If the iterator didn't find a word break, set | 1301 // Find the first word start. If the iterator didn't find a word break, set |
1299 // an offset of term size. For example, the offset for "://" should be 3, | 1302 // an offset of term size. For example, the offset for "://" should be 3, |
1300 // indicating that the word-part is missing. | 1303 // indicating that the word-part is missing. |
1301 while (iter.Advance() && !iter.IsWord()) {} | 1304 while (iter.Advance() && !iter.IsWord()) {} |
1302 | 1305 |
1303 lower_terms_to_word_starts_offsets_[i] = iter.prev(); | 1306 lower_terms_to_word_starts_offsets_[i] = iter.prev(); |
1304 } | 1307 } |
1305 } | 1308 } |
1306 | 1309 |
| 1310 URLIndexPrivateData::AddHistoryMatch::AddHistoryMatch( |
| 1311 const AddHistoryMatch& other) = default; |
| 1312 |
1307 URLIndexPrivateData::AddHistoryMatch::~AddHistoryMatch() { | 1313 URLIndexPrivateData::AddHistoryMatch::~AddHistoryMatch() { |
1308 } | 1314 } |
1309 | 1315 |
1310 void URLIndexPrivateData::AddHistoryMatch::operator()( | 1316 void URLIndexPrivateData::AddHistoryMatch::operator()( |
1311 const HistoryID history_id) { | 1317 const HistoryID history_id) { |
1312 HistoryInfoMap::const_iterator hist_pos = | 1318 HistoryInfoMap::const_iterator hist_pos = |
1313 private_data_.history_info_map_.find(history_id); | 1319 private_data_.history_info_map_.find(history_id); |
1314 if (hist_pos != private_data_.history_info_map_.end()) { | 1320 if (hist_pos != private_data_.history_info_map_.end()) { |
1315 const history::URLRow& hist_item = hist_pos->second.url_row; | 1321 const history::URLRow& hist_item = hist_pos->second.url_row; |
1316 const VisitInfoVector& visits = hist_pos->second.visits; | 1322 const VisitInfoVector& visits = hist_pos->second.visits; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1352 // First cut: typed count, visit count, recency. | 1358 // First cut: typed count, visit count, recency. |
1353 // TODO(mrossetti): This is too simplistic. Consider an approach which ranks | 1359 // TODO(mrossetti): This is too simplistic. Consider an approach which ranks |
1354 // recently visited (within the last 12/24 hours) as highly important. Get | 1360 // recently visited (within the last 12/24 hours) as highly important. Get |
1355 // input from mpearson. | 1361 // input from mpearson. |
1356 if (r1.typed_count() != r2.typed_count()) | 1362 if (r1.typed_count() != r2.typed_count()) |
1357 return (r1.typed_count() > r2.typed_count()); | 1363 return (r1.typed_count() > r2.typed_count()); |
1358 if (r1.visit_count() != r2.visit_count()) | 1364 if (r1.visit_count() != r2.visit_count()) |
1359 return (r1.visit_count() > r2.visit_count()); | 1365 return (r1.visit_count() > r2.visit_count()); |
1360 return (r1.last_visit() > r2.last_visit()); | 1366 return (r1.last_visit() > r2.last_visit()); |
1361 } | 1367 } |
OLD | NEW |