Chromium Code Reviews| 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 CHROME_BROWSER_HISTORY_URL_INDEX_PRIVATE_DATA_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_URL_INDEX_PRIVATE_DATA_H_ |
| 6 #define CHROME_BROWSER_HISTORY_URL_INDEX_PRIVATE_DATA_H_ | 6 #define CHROME_BROWSER_HISTORY_URL_INDEX_PRIVATE_DATA_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 // annotated. | 43 // annotated. |
| 44 class URLIndexPrivateData | 44 class URLIndexPrivateData |
| 45 : public base::RefCountedThreadSafe<URLIndexPrivateData> { | 45 : public base::RefCountedThreadSafe<URLIndexPrivateData> { |
| 46 public: | 46 public: |
| 47 URLIndexPrivateData(); | 47 URLIndexPrivateData(); |
| 48 | 48 |
| 49 // Given a string16 in |term_string|, scans the history index and returns a | 49 // Given a string16 in |term_string|, scans the history index and returns a |
| 50 // vector with all scored, matching history items. The |term_string| is | 50 // vector with all scored, matching history items. The |term_string| is |
| 51 // broken down into individual terms (words), each of which must occur in the | 51 // broken down into individual terms (words), each of which must occur in the |
| 52 // candidate history item's URL or page title for the item to qualify; | 52 // candidate history item's URL or page title for the item to qualify; |
| 53 // however, the terms do not necessarily have to be adjacent. Once we have | 53 // however, the terms do not necessarily have to be adjacent. We |
| 54 // a set of candidates, they are filtered to insure that all |term_string| | 54 // also allow breaking |term_string| at |cursor_position| (if |
| 55 // terms, as separated by whitespace, occur within the candidate's URL | 55 // set). Once we have a set of candidates, they are filtered to insure |
|
Peter Kasting
2013/01/04 20:04:32
Nit: ensure
Mark P
2013/01/04 23:38:58
Done.
| |
| 56 // or page title. Scores are then calculated on no more than | 56 // that all |term_string| terms, as separated by whitespace and the |
| 57 // |kItemsToScoreLimit| candidates, as the scoring of such a large number of | 57 // cursor (if set), occur within the candidate's URL or page title. |
| 58 // candidates may cause perceptible typing response delays in the omnibox. | 58 // Scores are then calculated on no more than |kItemsToScoreLimit| |
| 59 // This is likely to occur for short omnibox terms such as 'h' and 'w' which | 59 // candidates, as the scoring of such a large number of candidates may |
| 60 // cause perceptible typing response delays in the omnibox. This is | |
| 61 // likely to occur for short omnibox terms such as 'h' and 'w' which | |
| 60 // will be found in nearly all history candidates. Results are sorted by | 62 // will be found in nearly all history candidates. Results are sorted by |
| 61 // descending score. The full results set (i.e. beyond the | 63 // descending score. The full results set (i.e. beyond the |
| 62 // |kItemsToScoreLimit| limit) will be retained and used for subsequent calls | 64 // |kItemsToScoreLimit| limit) will be retained and used for subsequent calls |
| 63 // to this function. |bookmark_service| is used to boost a result's score if | 65 // to this function. |bookmark_service| is used to boost a result's score if |
| 64 // its URL is referenced by one or more of the user's bookmarks. | 66 // its URL is referenced by one or more of the user's bookmarks. |
| 65 ScoredHistoryMatches HistoryItemsForTerms(const string16& term_string, | 67 ScoredHistoryMatches HistoryItemsForTerms(const string16& term_string, |
| 68 size_t cursor_position, | |
| 66 BookmarkService* bookmark_service); | 69 BookmarkService* bookmark_service); |
| 67 | 70 |
| 68 // Adds the history item in |row| to the index if it does not already already | 71 // Adds the history item in |row| to the index if it does not already already |
| 69 // exist and it meets the minimum 'quick' criteria. If the row already exists | 72 // exist and it meets the minimum 'quick' criteria. If the row already exists |
| 70 // in the index then the index will be updated if the row still meets the | 73 // in the index then the index will be updated if the row still meets the |
| 71 // criteria, otherwise the row will be removed from the index. Returns true | 74 // criteria, otherwise the row will be removed from the index. Returns true |
| 72 // if the index was actually updated. |languages| gives a list of language | 75 // if the index was actually updated. |languages| gives a list of language |
| 73 // encodings by which the URLs and page titles are broken down into words and | 76 // encodings by which the URLs and page titles are broken down into words and |
| 74 // characters. |scheme_whitelist| is used to filter non-qualifying schemes. | 77 // characters. |scheme_whitelist| is used to filter non-qualifying schemes. |
| 75 bool UpdateURL(const URLRow& row, | 78 bool UpdateURL(const URLRow& row, |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 351 // Used for unit testing only. Records the number of candidate history items | 354 // Used for unit testing only. Records the number of candidate history items |
| 352 // at three stages in the index searching process. | 355 // at three stages in the index searching process. |
| 353 size_t pre_filter_item_count_; // After word index is queried. | 356 size_t pre_filter_item_count_; // After word index is queried. |
| 354 size_t post_filter_item_count_; // After trimming large result set. | 357 size_t post_filter_item_count_; // After trimming large result set. |
| 355 size_t post_scoring_item_count_; // After performing final filter/scoring. | 358 size_t post_scoring_item_count_; // After performing final filter/scoring. |
| 356 }; | 359 }; |
| 357 | 360 |
| 358 } // namespace history | 361 } // namespace history |
| 359 | 362 |
| 360 #endif // CHROME_BROWSER_HISTORY_URL_INDEX_PRIVATE_DATA_H_ | 363 #endif // CHROME_BROWSER_HISTORY_URL_INDEX_PRIVATE_DATA_H_ |
| OLD | NEW |