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_IN_MEMORY_URL_INDEX_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_IN_MEMORY_URL_INDEX_H_ |
6 #define CHROME_BROWSER_HISTORY_IN_MEMORY_URL_INDEX_H_ | 6 #define CHROME_BROWSER_HISTORY_IN_MEMORY_URL_INDEX_H_ |
7 | 7 |
8 #include <functional> | 8 #include <functional> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 23 matching lines...) Expand all Loading... |
34 } | 34 } |
35 | 35 |
36 namespace in_memory_url_index { | 36 namespace in_memory_url_index { |
37 class InMemoryURLIndexCacheItem; | 37 class InMemoryURLIndexCacheItem; |
38 } | 38 } |
39 | 39 |
40 namespace history { | 40 namespace history { |
41 | 41 |
42 namespace imui = in_memory_url_index; | 42 namespace imui = in_memory_url_index; |
43 | 43 |
| 44 class HistoryClient; |
44 class HistoryDatabase; | 45 class HistoryDatabase; |
45 class URLIndexPrivateData; | 46 class URLIndexPrivateData; |
46 struct URLsDeletedDetails; | 47 struct URLsDeletedDetails; |
47 struct URLsModifiedDetails; | 48 struct URLsModifiedDetails; |
48 struct URLVisitedDetails; | 49 struct URLVisitedDetails; |
49 | 50 |
50 // The URL history source. | 51 // The URL history source. |
51 // Holds portions of the URL database in memory in an indexed form. Used to | 52 // Holds portions of the URL database in memory in an indexed form. Used to |
52 // quickly look up matching URLs for a given query string. Used by | 53 // quickly look up matching URLs for a given query string. Used by |
53 // the HistoryURLProvider for inline autocomplete and to provide URL | 54 // the HistoryURLProvider for inline autocomplete and to provide URL |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 virtual void OnCacheSaveFinished(bool succeeded) = 0; | 94 virtual void OnCacheSaveFinished(bool succeeded) = 0; |
94 }; | 95 }; |
95 | 96 |
96 // |profile|, which may be NULL during unit testing, is used to register for | 97 // |profile|, which may be NULL during unit testing, is used to register for |
97 // history changes. |history_dir| is a path to the directory containing the | 98 // history changes. |history_dir| is a path to the directory containing the |
98 // history database within the profile wherein the cache and transaction | 99 // history database within the profile wherein the cache and transaction |
99 // journals will be stored. |languages| gives a list of language encodings by | 100 // journals will be stored. |languages| gives a list of language encodings by |
100 // which URLs and omnibox searches are broken down into words and characters. | 101 // which URLs and omnibox searches are broken down into words and characters. |
101 InMemoryURLIndex(Profile* profile, | 102 InMemoryURLIndex(Profile* profile, |
102 const base::FilePath& history_dir, | 103 const base::FilePath& history_dir, |
103 const std::string& languages); | 104 const std::string& languages, |
| 105 HistoryClient* client); |
104 virtual ~InMemoryURLIndex(); | 106 virtual ~InMemoryURLIndex(); |
105 | 107 |
106 // Opens and prepares the index of historical URL visits. If the index private | 108 // Opens and prepares the index of historical URL visits. If the index private |
107 // data cannot be restored from its cache file then it is rebuilt from the | 109 // data cannot be restored from its cache file then it is rebuilt from the |
108 // history database. | 110 // history database. |
109 void Init(); | 111 void Init(); |
110 | 112 |
111 // Signals that any outstanding initialization should be canceled and | 113 // Signals that any outstanding initialization should be canceled and |
112 // flushes the cache to disk. | 114 // flushes the cache to disk. |
113 void ShutDown(); | 115 void ShutDown(); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 | 249 |
248 // Returns a pointer to our private data. For unit testing only. | 250 // Returns a pointer to our private data. For unit testing only. |
249 URLIndexPrivateData* private_data() { return private_data_.get(); } | 251 URLIndexPrivateData* private_data() { return private_data_.get(); } |
250 | 252 |
251 // Returns the set of whitelisted schemes. For unit testing only. | 253 // Returns the set of whitelisted schemes. For unit testing only. |
252 const std::set<std::string>& scheme_whitelist() { return scheme_whitelist_; } | 254 const std::set<std::string>& scheme_whitelist() { return scheme_whitelist_; } |
253 | 255 |
254 // The profile, may be null when testing. | 256 // The profile, may be null when testing. |
255 Profile* profile_; | 257 Profile* profile_; |
256 | 258 |
| 259 // The HistoryClient; may be NULL when testing. |
| 260 HistoryClient* history_client_; |
| 261 |
257 // Directory where cache file resides. This is, except when unit testing, | 262 // Directory where cache file resides. This is, except when unit testing, |
258 // the same directory in which the profile's history database is found. It | 263 // the same directory in which the profile's history database is found. It |
259 // should never be empty. | 264 // should never be empty. |
260 base::FilePath history_dir_; | 265 base::FilePath history_dir_; |
261 | 266 |
262 // Languages used during the word-breaking process during indexing. | 267 // Languages used during the word-breaking process during indexing. |
263 std::string languages_; | 268 std::string languages_; |
264 | 269 |
265 // Only URLs with a whitelisted scheme are indexed. | 270 // Only URLs with a whitelisted scheme are indexed. |
266 std::set<std::string> scheme_whitelist_; | 271 std::set<std::string> scheme_whitelist_; |
(...skipping 21 matching lines...) Expand all Loading... |
288 // TODO(mrossetti): Eliminate once the transition to SQLite has been done. | 293 // TODO(mrossetti): Eliminate once the transition to SQLite has been done. |
289 // http://crbug.com/83659 | 294 // http://crbug.com/83659 |
290 bool needs_to_be_cached_; | 295 bool needs_to_be_cached_; |
291 | 296 |
292 DISALLOW_COPY_AND_ASSIGN(InMemoryURLIndex); | 297 DISALLOW_COPY_AND_ASSIGN(InMemoryURLIndex); |
293 }; | 298 }; |
294 | 299 |
295 } // namespace history | 300 } // namespace history |
296 | 301 |
297 #endif // CHROME_BROWSER_HISTORY_IN_MEMORY_URL_INDEX_H_ | 302 #endif // CHROME_BROWSER_HISTORY_IN_MEMORY_URL_INDEX_H_ |
OLD | NEW |