OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_URL_DATABASE_H_ | 5 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_URL_DATABASE_H_ |
6 #define COMPONENTS_HISTORY_CORE_BROWSER_URL_DATABASE_H_ | 6 #define COMPONENTS_HISTORY_CORE_BROWSER_URL_DATABASE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "components/history/core/browser/keyword_id.h" | 9 #include "components/history/core/browser/keyword_id.h" |
10 #include "components/history/core/browser/url_row.h" | 10 #include "components/history/core/browser/url_row.h" |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 | 294 |
295 // The fields and order expected by FillURLRow(). ID is guaranteed to be first | 295 // The fields and order expected by FillURLRow(). ID is guaranteed to be first |
296 // so that DISTINCT can be prepended to get distinct URLs. | 296 // so that DISTINCT can be prepended to get distinct URLs. |
297 // | 297 // |
298 // This is available BOTH as a macro and a static string (kURLRowFields). Use | 298 // This is available BOTH as a macro and a static string (kURLRowFields). Use |
299 // the macro if you want to put this in the middle of an otherwise constant | 299 // the macro if you want to put this in the middle of an otherwise constant |
300 // string, it will save time doing string appends. If you have to build a SQL | 300 // string, it will save time doing string appends. If you have to build a SQL |
301 // string dynamically anyway, use the constant, it will save space. | 301 // string dynamically anyway, use the constant, it will save space. |
302 #define HISTORY_URL_ROW_FIELDS \ | 302 #define HISTORY_URL_ROW_FIELDS \ |
303 " urls.id, urls.url, urls.title, urls.visit_count, urls.typed_count, " \ | 303 " urls.id, urls.url, urls.title, urls.visit_count, urls.typed_count, " \ |
304 "urls.last_visit_time, urls.hidden " | 304 "urls.last_visit_time, urls.context, urls.hidden " |
305 | 305 |
306 // Constants which specify, when considered altogether, 'significant' | 306 // Constants which specify, when considered altogether, 'significant' |
307 // history items. These are used to filter out insignificant items | 307 // history items. These are used to filter out insignificant items |
308 // for consideration as autocomplete candidates. | 308 // for consideration as autocomplete candidates. |
309 extern const int kLowQualityMatchTypedLimit; | 309 extern const int kLowQualityMatchTypedLimit; |
310 extern const int kLowQualityMatchVisitLimit; | 310 extern const int kLowQualityMatchVisitLimit; |
311 extern const int kLowQualityMatchAgeLimitInDays; | 311 extern const int kLowQualityMatchAgeLimitInDays; |
312 | 312 |
313 // Returns the date threshold for considering an history item as significant. | 313 // Returns the date threshold for considering an history item as significant. |
314 base::Time AutocompleteAgeThreshold(); | 314 base::Time AutocompleteAgeThreshold(); |
315 | 315 |
316 // Return true if |row| qualifies as an autocomplete candidate. If |time_cache| | 316 // Return true if |row| qualifies as an autocomplete candidate. If |time_cache| |
317 // is_null() then this function determines a new time threshold each time it is | 317 // is_null() then this function determines a new time threshold each time it is |
318 // called. Since getting system time can be costly (such as for cases where | 318 // called. Since getting system time can be costly (such as for cases where |
319 // this function will be called in a loop over many history items), you can | 319 // this function will be called in a loop over many history items), you can |
320 // provide a non-null |time_cache| by simply initializing |time_cache| with | 320 // provide a non-null |time_cache| by simply initializing |time_cache| with |
321 // AutocompleteAgeThreshold() (or any other desired time in the past). | 321 // AutocompleteAgeThreshold() (or any other desired time in the past). |
322 bool RowQualifiesAsSignificant(const URLRow& row, const base::Time& threshold); | 322 bool RowQualifiesAsSignificant(const URLRow& row, const base::Time& threshold); |
323 | 323 |
324 } // namespace history | 324 } // namespace history |
325 | 325 |
326 #endif // COMPONENTS_HISTORY_CORE_BROWSER_URL_DATABASE_H_ | 326 #endif // COMPONENTS_HISTORY_CORE_BROWSER_URL_DATABASE_H_ |
OLD | NEW |