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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 sql::Statement statement_; | 130 sql::Statement statement_; |
131 | 131 |
132 DISALLOW_COPY_AND_ASSIGN(URLEnumeratorBase); | 132 DISALLOW_COPY_AND_ASSIGN(URLEnumeratorBase); |
133 }; | 133 }; |
134 | 134 |
135 // A basic enumerator to enumerate urls | 135 // A basic enumerator to enumerate urls |
136 class URLEnumerator : public URLEnumeratorBase { | 136 class URLEnumerator : public URLEnumeratorBase { |
137 public: | 137 public: |
138 URLEnumerator(); | 138 URLEnumerator(); |
139 | 139 |
140 // Retreives the next url. Returns false if no more urls are available | 140 // Retrieves the next url. Returns false if no more urls are available. |
141 bool GetNextURL(URLRow* r); | 141 bool GetNextURL(URLRow* r); |
142 | 142 |
143 private: | 143 private: |
144 DISALLOW_COPY_AND_ASSIGN(URLEnumerator); | 144 DISALLOW_COPY_AND_ASSIGN(URLEnumerator); |
145 }; | 145 }; |
146 | 146 |
147 // Initializes the given enumerator to enumerator all URLs in the database. | 147 // Initializes the given enumerator to enumerator all URLs in the database. |
148 bool InitURLEnumeratorForEverything(URLEnumerator* enumerator); | 148 bool InitURLEnumeratorForEverything(URLEnumerator* enumerator); |
149 | 149 |
150 // Initializes the given enumerator to enumerator all URLs in the database | 150 // Initializes the given enumerator to enumerator all URLs in the database |
151 // that are historically significant: ones having been visited within 3 days, | 151 // that are historically significant: ones having been visited within 3 days, |
152 // having their URL manually typed more than once, or having been visited | 152 // having their URL manually typed more than once, or having been visited |
153 // more than 3 times. | 153 // more than 3 times. |
154 bool InitURLEnumeratorForSignificant(URLEnumerator* enumerator); | 154 bool InitURLEnumeratorForSignificant(URLEnumerator* enumerator); |
155 | 155 |
156 // Favicons ------------------------------------------------------------------ | |
157 | |
158 // Autocomplete -------------------------------------------------------------- | 156 // Autocomplete -------------------------------------------------------------- |
159 | 157 |
160 // Fills the given array with URLs matching the given prefix. They will be | 158 // Fills the given array with URLs matching the given prefix. They will be |
161 // sorted by typed count, then by visit count, then by visit date (most recent | 159 // sorted by typed count, then by visit count, then by visit date (most recent |
162 // first) up to the given maximum number. If |typed_only| is true, only urls | 160 // first) up to the given maximum number. If |typed_only| is true, only urls |
163 // that have been typed once are returned. For caller convenience, returns | 161 // that have been typed once are returned. For caller convenience, returns |
164 // whether any results were found. | 162 // whether any results were found. |
165 bool AutocompleteForPrefix(const std::string& prefix, | 163 bool AutocompleteForPrefix(const std::string& prefix, |
166 size_t max_results, | 164 size_t max_results, |
167 bool typed_only, | 165 bool typed_only, |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 // 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 |
320 // 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 |
321 // 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 |
322 // 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 |
323 // AutocompleteAgeThreshold() (or any other desired time in the past). | 321 // AutocompleteAgeThreshold() (or any other desired time in the past). |
324 bool RowQualifiesAsSignificant(const URLRow& row, const base::Time& threshold); | 322 bool RowQualifiesAsSignificant(const URLRow& row, const base::Time& threshold); |
325 | 323 |
326 } // namespace history | 324 } // namespace history |
327 | 325 |
328 #endif // COMPONENTS_HISTORY_CORE_BROWSER_URL_DATABASE_H_ | 326 #endif // COMPONENTS_HISTORY_CORE_BROWSER_URL_DATABASE_H_ |
OLD | NEW |