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> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
16 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 19 #include "base/scoped_observer.h" |
19 #include "base/strings/string16.h" | 20 #include "base/strings/string16.h" |
20 #include "base/task/cancelable_task_tracker.h" | 21 #include "base/task/cancelable_task_tracker.h" |
21 #include "chrome/browser/history/history_db_task.h" | 22 #include "chrome/browser/history/history_db_task.h" |
22 #include "chrome/browser/history/in_memory_url_index_types.h" | 23 #include "chrome/browser/history/in_memory_url_index_types.h" |
23 #include "chrome/browser/history/scored_history_match.h" | 24 #include "chrome/browser/history/scored_history_match.h" |
24 #include "components/history/core/browser/history_service_observer.h" | 25 #include "components/history/core/browser/history_service_observer.h" |
25 #include "components/history/core/browser/history_types.h" | 26 #include "components/history/core/browser/history_types.h" |
26 #include "content/public/browser/notification_observer.h" | 27 #include "content/public/browser/notification_observer.h" |
27 #include "content/public/browser/notification_registrar.h" | 28 #include "content/public/browser/notification_registrar.h" |
28 #include "sql/connection.h" | 29 #include "sql/connection.h" |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 void Observe(int notification_type, | 239 void Observe(int notification_type, |
239 const content::NotificationSource& source, | 240 const content::NotificationSource& source, |
240 const content::NotificationDetails& details) override; | 241 const content::NotificationDetails& details) override; |
241 | 242 |
242 // HistoryServiceObserver: | 243 // HistoryServiceObserver: |
243 void OnURLVisited(HistoryService* history_service, | 244 void OnURLVisited(HistoryService* history_service, |
244 ui::PageTransition transition, | 245 ui::PageTransition transition, |
245 const URLRow& row, | 246 const URLRow& row, |
246 const RedirectList& redirects, | 247 const RedirectList& redirects, |
247 base::Time visit_time) override; | 248 base::Time visit_time) override; |
| 249 void OnHistoryServiceLoaded(HistoryService* history_service) override; |
248 | 250 |
249 // Notification handlers. | 251 // Notification handlers. |
250 void OnURLsModified(const URLsModifiedDetails* details); | 252 void OnURLsModified(const URLsModifiedDetails* details); |
251 void OnURLsDeleted(const URLsDeletedDetails* details); | 253 void OnURLsDeleted(const URLsDeletedDetails* details); |
252 | 254 |
253 // Sets the directory wherein the cache file will be maintained. | 255 // Sets the directory wherein the cache file will be maintained. |
254 // For unit test usage only. | 256 // For unit test usage only. |
255 void set_history_dir(const base::FilePath& dir_path) { | 257 void set_history_dir(const base::FilePath& dir_path) { |
256 history_dir_ = dir_path; | 258 history_dir_ = dir_path; |
257 } | 259 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 | 304 |
303 // Set to true once the index restoration is complete. | 305 // Set to true once the index restoration is complete. |
304 bool restored_; | 306 bool restored_; |
305 | 307 |
306 // Set to true when changes to the index have been made and the index needs | 308 // Set to true when changes to the index have been made and the index needs |
307 // to be cached. Set to false when the index has been cached. Used as a | 309 // to be cached. Set to false when the index has been cached. Used as a |
308 // temporary safety check to insure that the cache is saved before the | 310 // temporary safety check to insure that the cache is saved before the |
309 // index has been destructed. | 311 // index has been destructed. |
310 bool needs_to_be_cached_; | 312 bool needs_to_be_cached_; |
311 | 313 |
| 314 ScopedObserver<HistoryService, HistoryServiceObserver> |
| 315 history_service_observer_; |
| 316 |
312 DISALLOW_COPY_AND_ASSIGN(InMemoryURLIndex); | 317 DISALLOW_COPY_AND_ASSIGN(InMemoryURLIndex); |
313 }; | 318 }; |
314 | 319 |
315 } // namespace history | 320 } // namespace history |
316 | 321 |
317 #endif // CHROME_BROWSER_HISTORY_IN_MEMORY_URL_INDEX_H_ | 322 #endif // CHROME_BROWSER_HISTORY_IN_MEMORY_URL_INDEX_H_ |
OLD | NEW |