| 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_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ |
| 6 #define CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ | 6 #define CHROME_BROWSER_HISTORY_HISTORY_SERVICE_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/bind.h" |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
| 18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 19 #include "base/observer_list.h" | 19 #include "base/observer_list.h" |
| 20 #include "base/strings/string16.h" | 20 #include "base/strings/string16.h" |
| 21 #include "base/task/cancelable_task_tracker.h" | 21 #include "base/task/cancelable_task_tracker.h" |
| 22 #include "base/threading/thread_checker.h" | 22 #include "base/threading/thread_checker.h" |
| 23 #include "base/time/time.h" | 23 #include "base/time/time.h" |
| 24 #include "chrome/browser/common/cancelable_request.h" | 24 #include "chrome/browser/common/cancelable_request.h" |
| 25 #include "chrome/browser/favicon/favicon_service.h" | 25 #include "chrome/browser/favicon/favicon_service.h" |
| 26 #include "chrome/browser/history/delete_directive_handler.h" | 26 #include "chrome/browser/history/delete_directive_handler.h" |
| 27 #include "chrome/browser/history/history_types.h" | 27 #include "chrome/browser/history/history_types.h" |
| 28 #include "chrome/browser/history/typed_url_syncable_service.h" | 28 #include "chrome/browser/history/typed_url_syncable_service.h" |
| 29 #include "chrome/browser/history/web_history_service.h" |
| 29 #include "chrome/browser/search_engines/template_url_id.h" | 30 #include "chrome/browser/search_engines/template_url_id.h" |
| 30 #include "chrome/common/ref_counted_util.h" | 31 #include "chrome/common/ref_counted_util.h" |
| 31 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" | 32 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" |
| 32 #include "components/visitedlink/browser/visitedlink_delegate.h" | 33 #include "components/visitedlink/browser/visitedlink_delegate.h" |
| 33 #include "content/public/browser/download_manager_delegate.h" | 34 #include "content/public/browser/download_manager_delegate.h" |
| 34 #include "content/public/browser/notification_observer.h" | 35 #include "content/public/browser/notification_observer.h" |
| 35 #include "content/public/browser/notification_registrar.h" | 36 #include "content/public/browser/notification_registrar.h" |
| 36 #include "content/public/common/page_transition_types.h" | 37 #include "content/public/common/page_transition_types.h" |
| 37 #include "sql/init_status.h" | 38 #include "sql/init_status.h" |
| 38 #include "sync/api/syncable_service.h" | 39 #include "sync/api/syncable_service.h" |
| (...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 int backend_id, | 810 int backend_id, |
| 810 scoped_ptr<history::InMemoryHistoryBackend> mem_backend); | 811 scoped_ptr<history::InMemoryHistoryBackend> mem_backend); |
| 811 | 812 |
| 812 // Called by our BackendDelegate when there is a problem reading the database. | 813 // Called by our BackendDelegate when there is a problem reading the database. |
| 813 void NotifyProfileError(int backend_id, sql::InitStatus init_status); | 814 void NotifyProfileError(int backend_id, sql::InitStatus init_status); |
| 814 | 815 |
| 815 // Call to schedule a given task for running on the history thread with the | 816 // Call to schedule a given task for running on the history thread with the |
| 816 // specified priority. The task will have ownership taken. | 817 // specified priority. The task will have ownership taken. |
| 817 void ScheduleTask(SchedulePriority priority, const base::Closure& task); | 818 void ScheduleTask(SchedulePriority priority, const base::Closure& task); |
| 818 | 819 |
| 820 // Cleans up after a WebHistoryService::Request completes. |
| 821 void WebHistoryServiceRequestComplete( |
| 822 history::WebHistoryService::Request* request, |
| 823 bool success); |
| 824 |
| 819 // Schedule ------------------------------------------------------------------ | 825 // Schedule ------------------------------------------------------------------ |
| 820 // | 826 // |
| 821 // Functions for scheduling operations on the history thread that have a | 827 // Functions for scheduling operations on the history thread that have a |
| 822 // handle and may be cancelable. For fire-and-forget operations, see | 828 // handle and may be cancelable. For fire-and-forget operations, see |
| 823 // ScheduleAndForget below. | 829 // ScheduleAndForget below. |
| 824 | 830 |
| 825 template<typename BackendFunc, class RequestType> | 831 template<typename BackendFunc, class RequestType> |
| 826 Handle Schedule(SchedulePriority priority, | 832 Handle Schedule(SchedulePriority priority, |
| 827 BackendFunc func, // Function to call on the HistoryBackend. | 833 BackendFunc func, // Function to call on the HistoryBackend. |
| 828 CancelableRequestConsumerBase* consumer, | 834 CancelableRequestConsumerBase* consumer, |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1060 | 1066 |
| 1061 // The index used for quick history lookups. | 1067 // The index used for quick history lookups. |
| 1062 // TODO(mrossetti): Move in_memory_url_index out of history_service. | 1068 // TODO(mrossetti): Move in_memory_url_index out of history_service. |
| 1063 // See http://crbug.com/138321 | 1069 // See http://crbug.com/138321 |
| 1064 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; | 1070 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; |
| 1065 | 1071 |
| 1066 ObserverList<history::VisitDatabaseObserver> visit_database_observers_; | 1072 ObserverList<history::VisitDatabaseObserver> visit_database_observers_; |
| 1067 | 1073 |
| 1068 history::DeleteDirectiveHandler delete_directive_handler_; | 1074 history::DeleteDirectiveHandler delete_directive_handler_; |
| 1069 | 1075 |
| 1076 // Maintain the set of pending WebHistoryService requests so they may all be |
| 1077 // cancelled on profile shutdown. |
| 1078 std::set<history::WebHistoryService::Request*> |
| 1079 pending_web_history_service_requests_; |
| 1080 |
| 1070 DISALLOW_COPY_AND_ASSIGN(HistoryService); | 1081 DISALLOW_COPY_AND_ASSIGN(HistoryService); |
| 1071 }; | 1082 }; |
| 1072 | 1083 |
| 1073 #endif // CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ | 1084 #endif // CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ |
| OLD | NEW |