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 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/bind.h" |
12 #include "base/callback.h" | 13 #include "base/callback.h" |
13 #include "base/file_path.h" | 14 #include "base/file_path.h" |
| 15 #include "base/logging.h" |
14 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
17 #include "base/observer_list.h" | 19 #include "base/observer_list.h" |
18 #include "base/string16.h" | 20 #include "base/string16.h" |
19 #include "base/time.h" | 21 #include "base/time.h" |
20 #include "base/threading/thread_checker.h" | 22 #include "base/threading/thread_checker.h" |
21 #include "chrome/browser/common/cancelable_request.h" | 23 #include "chrome/browser/common/cancelable_request.h" |
22 #include "chrome/browser/favicon/favicon_service.h" | 24 #include "chrome/browser/favicon/favicon_service.h" |
23 #include "chrome/browser/history/history_types.h" | 25 #include "chrome/browser/history/history_types.h" |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 // Called by TopSites after the thumbnails were read and it is safe | 618 // Called by TopSites after the thumbnails were read and it is safe |
617 // to delete the thumbnails DB. | 619 // to delete the thumbnails DB. |
618 void OnTopSitesReady(); | 620 void OnTopSitesReady(); |
619 | 621 |
620 // Returns true if this looks like the type of URL we want to add to the | 622 // Returns true if this looks like the type of URL we want to add to the |
621 // history. We filter out some URLs such as JavaScript. | 623 // history. We filter out some URLs such as JavaScript. |
622 static bool CanAddURL(const GURL& url); | 624 static bool CanAddURL(const GURL& url); |
623 | 625 |
624 base::WeakPtr<HistoryService> AsWeakPtr(); | 626 base::WeakPtr<HistoryService> AsWeakPtr(); |
625 | 627 |
| 628 void ProcessDeleteDirectiveForTest( |
| 629 const sync_pb::HistoryDeleteDirectiveSpecifics& delete_directive); |
| 630 |
626 // syncer::SyncableService implementation. | 631 // syncer::SyncableService implementation. |
627 virtual syncer::SyncMergeResult MergeDataAndStartSyncing( | 632 virtual syncer::SyncMergeResult MergeDataAndStartSyncing( |
628 syncer::ModelType type, | 633 syncer::ModelType type, |
629 const syncer::SyncDataList& initial_sync_data, | 634 const syncer::SyncDataList& initial_sync_data, |
630 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, | 635 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, |
631 scoped_ptr<syncer::SyncErrorFactory> error_handler) OVERRIDE; | 636 scoped_ptr<syncer::SyncErrorFactory> error_handler) OVERRIDE; |
632 virtual void StopSyncing(syncer::ModelType type) OVERRIDE; | 637 virtual void StopSyncing(syncer::ModelType type) OVERRIDE; |
633 virtual syncer::SyncDataList GetAllSyncData( | 638 virtual syncer::SyncDataList GetAllSyncData( |
634 syncer::ModelType type) const OVERRIDE; | 639 syncer::ModelType type) const OVERRIDE; |
635 virtual syncer::SyncError ProcessSyncChanges( | 640 virtual syncer::SyncError ProcessSyncChanges( |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 | 853 |
849 // Call to schedule a given task for running on the history thread with the | 854 // Call to schedule a given task for running on the history thread with the |
850 // specified priority. The task will have ownership taken. | 855 // specified priority. The task will have ownership taken. |
851 void ScheduleTask(SchedulePriority priority, const base::Closure& task); | 856 void ScheduleTask(SchedulePriority priority, const base::Closure& task); |
852 | 857 |
853 // Delete local history according to the given directive (from | 858 // Delete local history according to the given directive (from |
854 // sync). | 859 // sync). |
855 void ProcessDeleteDirective( | 860 void ProcessDeleteDirective( |
856 const sync_pb::HistoryDeleteDirectiveSpecifics& delete_directive); | 861 const sync_pb::HistoryDeleteDirectiveSpecifics& delete_directive); |
857 | 862 |
| 863 // Called when a delete directive has been processed. |
| 864 void OnDeleteDirectiveProcessed( |
| 865 const sync_pb::HistoryDeleteDirectiveSpecifics& delete_directive); |
| 866 |
858 // Schedule ------------------------------------------------------------------ | 867 // Schedule ------------------------------------------------------------------ |
859 // | 868 // |
860 // Functions for scheduling operations on the history thread that have a | 869 // Functions for scheduling operations on the history thread that have a |
861 // handle and may be cancelable. For fire-and-forget operations, see | 870 // handle and may be cancelable. For fire-and-forget operations, see |
862 // ScheduleAndForget below. | 871 // ScheduleAndForget below. |
863 | 872 |
864 template<typename BackendFunc, class RequestType> | 873 template<typename BackendFunc, class RequestType> |
865 Handle Schedule(SchedulePriority priority, | 874 Handle Schedule(SchedulePriority priority, |
866 BackendFunc func, // Function to call on the HistoryBackend. | 875 BackendFunc func, // Function to call on the HistoryBackend. |
867 CancelableRequestConsumerBase* consumer, | 876 CancelableRequestConsumerBase* consumer, |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1128 // TODO(mrossetti): Move in_memory_url_index out of history_service. | 1137 // TODO(mrossetti): Move in_memory_url_index out of history_service. |
1129 // See http://crbug.com/138321 | 1138 // See http://crbug.com/138321 |
1130 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; | 1139 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; |
1131 | 1140 |
1132 ObserverList<history::VisitDatabaseObserver> visit_database_observers_; | 1141 ObserverList<history::VisitDatabaseObserver> visit_database_observers_; |
1133 | 1142 |
1134 DISALLOW_COPY_AND_ASSIGN(HistoryService); | 1143 DISALLOW_COPY_AND_ASSIGN(HistoryService); |
1135 }; | 1144 }; |
1136 | 1145 |
1137 #endif // CHROME_BROWSER_HISTORY_HISTORY_H_ | 1146 #endif // CHROME_BROWSER_HISTORY_HISTORY_H_ |
OLD | NEW |