| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 | 247 |
| 246 // Returns a pointer to our private data. For unit testing only. | 248 // Returns a pointer to our private data. For unit testing only. |
| 247 URLIndexPrivateData* private_data() { return private_data_.get(); } | 249 URLIndexPrivateData* private_data() { return private_data_.get(); } |
| 248 | 250 |
| 249 // Returns the set of whitelisted schemes. For unit testing only. | 251 // Returns the set of whitelisted schemes. For unit testing only. |
| 250 const std::set<std::string>& scheme_whitelist() { return scheme_whitelist_; } | 252 const std::set<std::string>& scheme_whitelist() { return scheme_whitelist_; } |
| 251 | 253 |
| 252 // The profile, may be null when testing. | 254 // The profile, may be null when testing. |
| 253 Profile* profile_; | 255 Profile* profile_; |
| 254 | 256 |
| 257 // The HistoryClient; may be NULL when testing. |
| 258 HistoryClient* history_client_; |
| 259 |
| 255 // Directory where cache file resides. This is, except when unit testing, | 260 // Directory where cache file resides. This is, except when unit testing, |
| 256 // the same directory in which the profile's history database is found. It | 261 // the same directory in which the profile's history database is found. It |
| 257 // should never be empty. | 262 // should never be empty. |
| 258 base::FilePath history_dir_; | 263 base::FilePath history_dir_; |
| 259 | 264 |
| 260 // Languages used during the word-breaking process during indexing. | 265 // Languages used during the word-breaking process during indexing. |
| 261 std::string languages_; | 266 std::string languages_; |
| 262 | 267 |
| 263 // Only URLs with a whitelisted scheme are indexed. | 268 // Only URLs with a whitelisted scheme are indexed. |
| 264 std::set<std::string> scheme_whitelist_; | 269 std::set<std::string> scheme_whitelist_; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 286 // TODO(mrossetti): Eliminate once the transition to SQLite has been done. | 291 // TODO(mrossetti): Eliminate once the transition to SQLite has been done. |
| 287 // http://crbug.com/83659 | 292 // http://crbug.com/83659 |
| 288 bool needs_to_be_cached_; | 293 bool needs_to_be_cached_; |
| 289 | 294 |
| 290 DISALLOW_COPY_AND_ASSIGN(InMemoryURLIndex); | 295 DISALLOW_COPY_AND_ASSIGN(InMemoryURLIndex); |
| 291 }; | 296 }; |
| 292 | 297 |
| 293 } // namespace history | 298 } // namespace history |
| 294 | 299 |
| 295 #endif // CHROME_BROWSER_HISTORY_IN_MEMORY_URL_INDEX_H_ | 300 #endif // CHROME_BROWSER_HISTORY_IN_MEMORY_URL_INDEX_H_ |
| OLD | NEW |