OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_DATABASE_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_URL_DATABASE_H_ |
6 #define CHROME_BROWSER_HISTORY_URL_DATABASE_H_ | 6 #define CHROME_BROWSER_HISTORY_URL_DATABASE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "chrome/browser/history/history_types.h" | 10 #include "chrome/browser/history/history_types.h" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 bool InitURLEnumeratorForSignificant(URLEnumerator* enumerator); | 161 bool InitURLEnumeratorForSignificant(URLEnumerator* enumerator); |
162 | 162 |
163 // Favicons ------------------------------------------------------------------ | 163 // Favicons ------------------------------------------------------------------ |
164 | 164 |
165 // Autocomplete -------------------------------------------------------------- | 165 // Autocomplete -------------------------------------------------------------- |
166 | 166 |
167 // Fills the given array with URLs matching the given prefix. They will be | 167 // Fills the given array with URLs matching the given prefix. They will be |
168 // sorted by typed count, then by visit count, then by visit date (most recent | 168 // sorted by typed count, then by visit count, then by visit date (most recent |
169 // first) up to the given maximum number. If |typed_only| is true, only urls | 169 // first) up to the given maximum number. If |typed_only| is true, only urls |
170 // that have been typed once are returned. For caller convenience, returns | 170 // that have been typed once are returned. For caller convenience, returns |
171 // whether any results were found. Called by HistoryURLProvider. | 171 // whether any results were found. |
172 bool AutocompleteForPrefix(const string16& prefix, | 172 bool AutocompleteForPrefix(const std::string& prefix, |
173 size_t max_results, | 173 size_t max_results, |
174 bool typed_only, | 174 bool typed_only, |
175 std::vector<URLRow>* results); | 175 std::vector<URLRow>* results); |
176 | 176 |
| 177 // Returns true if the database holds some past typed navigation to a URL on |
| 178 // the provided hostname. |
| 179 bool IsTypedHost(const std::string& host); |
| 180 |
177 // Tries to find the shortest URL beginning with |base| that strictly | 181 // Tries to find the shortest URL beginning with |base| that strictly |
178 // prefixes |url|, and has minimum visit_ and typed_counts as specified. | 182 // prefixes |url|, and has minimum visit_ and typed_counts as specified. |
179 // If found, fills in |info| and returns true; otherwise returns false, | 183 // If found, fills in |info| and returns true; otherwise returns false, |
180 // leaving |info| unchanged. | 184 // leaving |info| unchanged. |
181 // We allow matches of exactly |base| iff |allow_base| is true. | 185 // We allow matches of exactly |base| iff |allow_base| is true. |
182 bool FindShortestURLFromBase(const std::string& base, | 186 bool FindShortestURLFromBase(const std::string& base, |
183 const std::string& url, | 187 const std::string& url, |
184 int min_visits, | 188 int min_visits, |
185 int min_typed, | 189 int min_typed, |
186 bool allow_base, | 190 bool allow_base, |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 // the macro if you want to put this in the middle of an otherwise constant | 292 // the macro if you want to put this in the middle of an otherwise constant |
289 // string, it will save time doing string appends. If you have to build a SQL | 293 // string, it will save time doing string appends. If you have to build a SQL |
290 // string dynamically anyway, use the constant, it will save space. | 294 // string dynamically anyway, use the constant, it will save space. |
291 #define HISTORY_URL_ROW_FIELDS \ | 295 #define HISTORY_URL_ROW_FIELDS \ |
292 " urls.id, urls.url, urls.title, urls.visit_count, urls.typed_count, " \ | 296 " urls.id, urls.url, urls.title, urls.visit_count, urls.typed_count, " \ |
293 "urls.last_visit_time, urls.hidden " | 297 "urls.last_visit_time, urls.hidden " |
294 | 298 |
295 } // history | 299 } // history |
296 | 300 |
297 #endif // CHROME_BROWSER_HISTORY_URL_DATABASE_H_ | 301 #endif // CHROME_BROWSER_HISTORY_URL_DATABASE_H_ |
OLD | NEW |