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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 154 |
155 // HistoryDBTask used to rebuild our private data from the history database. | 155 // HistoryDBTask used to rebuild our private data from the history database. |
156 class RebuildPrivateDataFromHistoryDBTask : public HistoryDBTask { | 156 class RebuildPrivateDataFromHistoryDBTask : public HistoryDBTask { |
157 public: | 157 public: |
158 explicit RebuildPrivateDataFromHistoryDBTask( | 158 explicit RebuildPrivateDataFromHistoryDBTask( |
159 InMemoryURLIndex* index, | 159 InMemoryURLIndex* index, |
160 const std::string& languages, | 160 const std::string& languages, |
161 const std::set<std::string>& scheme_whitelist); | 161 const std::set<std::string>& scheme_whitelist); |
162 | 162 |
163 virtual bool RunOnDBThread(HistoryBackend* backend, | 163 virtual bool RunOnDBThread(HistoryBackend* backend, |
164 history::HistoryDatabase* db) OVERRIDE; | 164 history::HistoryDatabase* db) override; |
165 virtual void DoneRunOnMainThread() OVERRIDE; | 165 virtual void DoneRunOnMainThread() override; |
166 | 166 |
167 private: | 167 private: |
168 virtual ~RebuildPrivateDataFromHistoryDBTask(); | 168 virtual ~RebuildPrivateDataFromHistoryDBTask(); |
169 | 169 |
170 InMemoryURLIndex* index_; // Call back to this index at completion. | 170 InMemoryURLIndex* index_; // Call back to this index at completion. |
171 std::string languages_; // Languages for word-breaking. | 171 std::string languages_; // Languages for word-breaking. |
172 std::set<std::string> scheme_whitelist_; // Schemes to be indexed. | 172 std::set<std::string> scheme_whitelist_; // Schemes to be indexed. |
173 bool succeeded_; // Indicates if the rebuild was successful. | 173 bool succeeded_; // Indicates if the rebuild was successful. |
174 scoped_refptr<URLIndexPrivateData> data_; // The rebuilt private data. | 174 scoped_refptr<URLIndexPrivateData> data_; // The rebuilt private data. |
175 | 175 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 // Provided for unit testing so that a test cache file can be used. | 227 // Provided for unit testing so that a test cache file can be used. |
228 void DoSaveToCacheFile(const base::FilePath& path); | 228 void DoSaveToCacheFile(const base::FilePath& path); |
229 | 229 |
230 // Notifies the observer, if any, of the success of the private data caching. | 230 // Notifies the observer, if any, of the success of the private data caching. |
231 // |succeeded| is true on a successful save. | 231 // |succeeded| is true on a successful save. |
232 void OnCacheSaveDone(bool succeeded); | 232 void OnCacheSaveDone(bool succeeded); |
233 | 233 |
234 // Handles notifications of history changes. | 234 // Handles notifications of history changes. |
235 virtual void Observe(int notification_type, | 235 virtual void Observe(int notification_type, |
236 const content::NotificationSource& source, | 236 const content::NotificationSource& source, |
237 const content::NotificationDetails& details) OVERRIDE; | 237 const content::NotificationDetails& details) override; |
238 | 238 |
239 // Notification handlers. | 239 // Notification handlers. |
240 void OnURLVisited(const URLVisitedDetails* details); | 240 void OnURLVisited(const URLVisitedDetails* details); |
241 void OnURLsModified(const URLsModifiedDetails* details); | 241 void OnURLsModified(const URLsModifiedDetails* details); |
242 void OnURLsDeleted(const URLsDeletedDetails* details); | 242 void OnURLsDeleted(const URLsDeletedDetails* details); |
243 | 243 |
244 // Sets the directory wherein the cache file will be maintained. | 244 // Sets the directory wherein the cache file will be maintained. |
245 // For unit test usage only. | 245 // For unit test usage only. |
246 void set_history_dir(const base::FilePath& dir_path) { | 246 void set_history_dir(const base::FilePath& dir_path) { |
247 history_dir_ = dir_path; | 247 history_dir_ = dir_path; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 // temporary safety check to insure that the cache is saved before the | 298 // temporary safety check to insure that the cache is saved before the |
299 // index has been destructed. | 299 // index has been destructed. |
300 bool needs_to_be_cached_; | 300 bool needs_to_be_cached_; |
301 | 301 |
302 DISALLOW_COPY_AND_ASSIGN(InMemoryURLIndex); | 302 DISALLOW_COPY_AND_ASSIGN(InMemoryURLIndex); |
303 }; | 303 }; |
304 | 304 |
305 } // namespace history | 305 } // namespace history |
306 | 306 |
307 #endif // CHROME_BROWSER_HISTORY_IN_MEMORY_URL_INDEX_H_ | 307 #endif // CHROME_BROWSER_HISTORY_IN_MEMORY_URL_INDEX_H_ |
OLD | NEW |