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_HISTORY_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_HISTORY_H_ |
6 #define CHROME_BROWSER_HISTORY_HISTORY_H_ | 6 #define CHROME_BROWSER_HISTORY_HISTORY_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 class InMemoryHistoryBackend; | 47 class InMemoryHistoryBackend; |
48 class InMemoryURLIndex; | 48 class InMemoryURLIndex; |
49 class InMemoryURLIndexTest; | 49 class InMemoryURLIndexTest; |
50 class HistoryAddPageArgs; | 50 class HistoryAddPageArgs; |
51 class HistoryBackend; | 51 class HistoryBackend; |
52 class HistoryDatabase; | 52 class HistoryDatabase; |
53 struct HistoryDetails; | 53 struct HistoryDetails; |
54 class HistoryQueryTest; | 54 class HistoryQueryTest; |
55 class VisitFilter; | 55 class VisitFilter; |
56 class URLDatabase; | 56 class URLDatabase; |
| 57 class VisitDatabaseObserver; |
57 } // namespace history | 58 } // namespace history |
58 | 59 |
59 | 60 |
60 // HistoryDBTask can be used to process arbitrary work on the history backend | 61 // HistoryDBTask can be used to process arbitrary work on the history backend |
61 // thread. HistoryDBTask is scheduled using HistoryService::ScheduleDBTask. | 62 // thread. HistoryDBTask is scheduled using HistoryService::ScheduleDBTask. |
62 // When HistoryBackend processes the task it invokes RunOnDBThread. Once the | 63 // When HistoryBackend processes the task it invokes RunOnDBThread. Once the |
63 // task completes and has not been canceled, DoneRunOnMainThread is invoked back | 64 // task completes and has not been canceled, DoneRunOnMainThread is invoked back |
64 // on the main thread. | 65 // on the main thread. |
65 class HistoryDBTask : public base::RefCountedThreadSafe<HistoryDBTask> { | 66 class HistoryDBTask : public base::RefCountedThreadSafe<HistoryDBTask> { |
66 public: | 67 public: |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 | 542 |
542 // Schedules a HistoryDBTask for running on the history backend thread. See | 543 // Schedules a HistoryDBTask for running on the history backend thread. See |
543 // HistoryDBTask for details on what this does. | 544 // HistoryDBTask for details on what this does. |
544 virtual void ScheduleDBTask(HistoryDBTask* task, | 545 virtual void ScheduleDBTask(HistoryDBTask* task, |
545 CancelableRequestConsumerBase* consumer); | 546 CancelableRequestConsumerBase* consumer); |
546 | 547 |
547 // Returns true if top sites needs to be migrated out of history into its own | 548 // Returns true if top sites needs to be migrated out of history into its own |
548 // db. | 549 // db. |
549 bool needs_top_sites_migration() const { return needs_top_sites_migration_; } | 550 bool needs_top_sites_migration() const { return needs_top_sites_migration_; } |
550 | 551 |
| 552 // Adds or removes observers for the VisitDatabase. Should be run in the |
| 553 // thread in which the observer would like to be notified. |
| 554 void AddVisitDatabaseObserver(history::VisitDatabaseObserver* observer); |
| 555 void RemoveVisitDatabaseObserver(history::VisitDatabaseObserver* observer); |
| 556 |
551 // Testing ------------------------------------------------------------------- | 557 // Testing ------------------------------------------------------------------- |
552 | 558 |
553 // Designed for unit tests, this passes the given task on to the history | 559 // Designed for unit tests, this passes the given task on to the history |
554 // backend to be called once the history backend has terminated. This allows | 560 // backend to be called once the history backend has terminated. This allows |
555 // callers to know when the history thread is complete and the database files | 561 // callers to know when the history thread is complete and the database files |
556 // can be deleted and the next test run. Otherwise, the history thread may | 562 // can be deleted and the next test run. Otherwise, the history thread may |
557 // still be running, causing problems in subsequent tests. | 563 // still be running, causing problems in subsequent tests. |
558 // | 564 // |
559 // There can be only one closing task, so this will override any previously | 565 // There can be only one closing task, so this will override any previously |
560 // set task. We will take ownership of the pointer and delete it when done. | 566 // set task. We will take ownership of the pointer and delete it when done. |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
897 // True if needs top site migration. | 903 // True if needs top site migration. |
898 bool needs_top_sites_migration_; | 904 bool needs_top_sites_migration_; |
899 | 905 |
900 // The index used for quick history lookups. | 906 // The index used for quick history lookups. |
901 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; | 907 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; |
902 | 908 |
903 DISALLOW_COPY_AND_ASSIGN(HistoryService); | 909 DISALLOW_COPY_AND_ASSIGN(HistoryService); |
904 }; | 910 }; |
905 | 911 |
906 #endif // CHROME_BROWSER_HISTORY_HISTORY_H_ | 912 #endif // CHROME_BROWSER_HISTORY_HISTORY_H_ |
OLD | NEW |