OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_SYNC_DRIVER_SYNC_CLIENT_H_ | 5 #ifndef COMPONENTS_SYNC_DRIVER_SYNC_CLIENT_H_ |
6 #define COMPONENTS_SYNC_DRIVER_SYNC_CLIENT_H_ | 6 #define COMPONENTS_SYNC_DRIVER_SYNC_CLIENT_H_ |
7 | 7 |
8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "sync/internal_api/public/base/model_type.h" | 13 #include "sync/internal_api/public/base/model_type.h" |
14 #include "sync/internal_api/public/engine/model_safe_worker.h" | 14 #include "sync/internal_api/public/engine/model_safe_worker.h" |
15 #include "sync/util/extensions_activity.h" | 15 #include "sync/util/extensions_activity.h" |
16 | 16 |
17 class BookmarkUndoService; | 17 class BookmarkUndoService; |
18 class PrefService; | 18 class PrefService; |
19 | 19 |
20 namespace autofill { | 20 namespace autofill { |
21 class AutofillWebDataService; | 21 class AutofillWebDataService; |
22 class AutocompleteSyncableService; | 22 class AutocompleteSyncableService; |
23 class PersonalDataManager; | 23 class PersonalDataManager; |
24 } // namespace autofill | 24 } // namespace autofill |
25 | 25 |
26 namespace base { | |
27 class FilePath; | |
28 class SequencedWorkerPool; | |
29 class SingleThreadTaskRunner; | |
30 } // namespace base | |
31 | |
26 namespace bookmarks { | 32 namespace bookmarks { |
27 class BookmarkModel; | 33 class BookmarkModel; |
28 } // namespace bookmarks | 34 } // namespace bookmarks |
29 | 35 |
30 namespace favicon { | 36 namespace favicon { |
31 class FaviconService; | 37 class FaviconService; |
32 } // namespace favicon | 38 } // namespace favicon |
33 | 39 |
34 namespace history { | 40 namespace history { |
35 class HistoryService; | 41 class HistoryService; |
36 } // namespace history | 42 } // namespace history |
37 | 43 |
44 namespace invalidation { | |
45 class InvalidationService; | |
46 } // namespace invalidation | |
47 | |
48 namespace net { | |
49 class URLRequestContextGetter; | |
50 } // namespace net | |
51 | |
38 namespace password_manager { | 52 namespace password_manager { |
39 class PasswordStore; | 53 class PasswordStore; |
40 } // namespace password_manager | 54 } // namespace password_manager |
41 | 55 |
42 namespace syncer { | 56 namespace syncer { |
43 class SyncableService; | 57 class SyncableService; |
44 } // namespace syncer | 58 } // namespace syncer |
45 | 59 |
46 namespace sync_sessions { | 60 namespace sync_sessions { |
47 class SyncSessionsClient; | 61 class SyncSessionsClient; |
48 } // namespace sync_sessions | 62 } // namespace sync_sessions |
49 | 63 |
64 namespace version_info { | |
65 enum class Channel; | |
66 } | |
67 | |
50 namespace sync_driver { | 68 namespace sync_driver { |
51 | 69 |
52 class SyncApiComponentFactory; | 70 class SyncApiComponentFactory; |
53 class SyncService; | 71 class SyncService; |
54 | 72 |
55 typedef base::Callback<void(base::Time, base::Time)> ClearBrowsingDataCallback; | 73 typedef base::Callback<void(base::Time, base::Time)> ClearBrowsingDataCallback; |
56 | 74 |
57 // Interface for clients of the Sync API to plumb through necessary dependent | 75 // Interface for clients of the Sync API to plumb through necessary dependent |
58 // components. This interface is purely for abstracting dependencies, and | 76 // components. This interface is purely for abstracting dependencies, and |
59 // should not contain any non-trivial functional logic. | 77 // should not contain any non-trivial functional logic. |
(...skipping 27 matching lines...) Expand all Loading... | |
87 virtual ClearBrowsingDataCallback GetClearBrowsingDataCallback() = 0; | 105 virtual ClearBrowsingDataCallback GetClearBrowsingDataCallback() = 0; |
88 | 106 |
89 // Returns a callback that will be invoked when password sync state has | 107 // Returns a callback that will be invoked when password sync state has |
90 // potentially been changed. | 108 // potentially been changed. |
91 virtual base::Closure GetPasswordStateChangedCallback() = 0; | 109 virtual base::Closure GetPasswordStateChangedCallback() = 0; |
92 | 110 |
93 virtual autofill::PersonalDataManager* GetPersonalDataManager() = 0; | 111 virtual autofill::PersonalDataManager* GetPersonalDataManager() = 0; |
94 virtual scoped_refptr<autofill::AutofillWebDataService> | 112 virtual scoped_refptr<autofill::AutofillWebDataService> |
95 GetWebDataService() = 0; | 113 GetWebDataService() = 0; |
96 virtual BookmarkUndoService* GetBookmarkUndoServiceIfExists() = 0; | 114 virtual BookmarkUndoService* GetBookmarkUndoServiceIfExists() = 0; |
115 virtual invalidation::InvalidationService* GetInvalidationService() = 0; | |
97 virtual scoped_refptr<syncer::ExtensionsActivity> GetExtensionsActivity() = 0; | 116 virtual scoped_refptr<syncer::ExtensionsActivity> GetExtensionsActivity() = 0; |
98 virtual sync_sessions::SyncSessionsClient* GetSyncSessionsClient() = 0; | 117 virtual sync_sessions::SyncSessionsClient* GetSyncSessionsClient() = 0; |
99 | 118 |
100 // Returns a weak pointer to the syncable service specified by |type|. | 119 // Returns a weak pointer to the syncable service specified by |type|. |
101 // Weak pointer may be unset if service is already destroyed. | 120 // Weak pointer may be unset if service is already destroyed. |
102 // Note: Should only be called from the model type thread. | 121 // Note: Should only be called from the model type thread. |
103 virtual base::WeakPtr<syncer::SyncableService> GetSyncableServiceForType( | 122 virtual base::WeakPtr<syncer::SyncableService> GetSyncableServiceForType( |
104 syncer::ModelType type) = 0; | 123 syncer::ModelType type) = 0; |
105 | 124 |
106 // Creates and returns a new ModelSafeWorker for the group, or null if one | 125 // Creates and returns a new ModelSafeWorker for the group, or null if one |
107 // cannot be created. | 126 // cannot be created. |
108 // TODO(maxbogue): Move this inside SyncApiComponentFactory. | 127 // TODO(maxbogue): Move this inside SyncApiComponentFactory. |
109 virtual scoped_refptr<syncer::ModelSafeWorker> CreateModelWorkerForGroup( | 128 virtual scoped_refptr<syncer::ModelSafeWorker> CreateModelWorkerForGroup( |
110 syncer::ModelSafeGroup group, | 129 syncer::ModelSafeGroup group, |
111 syncer::WorkerLoopDestructionObserver* observer) = 0; | 130 syncer::WorkerLoopDestructionObserver* observer) = 0; |
112 | 131 |
113 // Returns the current SyncApiComponentFactory instance. | 132 // Returns the current SyncApiComponentFactory instance. |
114 virtual SyncApiComponentFactory* GetSyncApiComponentFactory() = 0; | 133 virtual SyncApiComponentFactory* GetSyncApiComponentFactory() = 0; |
115 | 134 |
135 // Returns the path of the base directory under which sync should store its | |
136 // data. | |
137 virtual base::FilePath GetBaseDirectory() = 0; | |
Nicolas Zea
2015/10/31 00:15:34
How many of these can be plumbed into the ProfileS
blundell
2015/11/02 16:08:35
Done.
| |
138 | |
139 // Returns the URLRequestContext in which sync should operate. | |
140 virtual net::URLRequestContextGetter* GetURLRequestContext() = 0; | |
141 | |
142 // Returns an identifier representing this client for debugging purposes. | |
143 virtual std::string GetDebugIdentifier() = 0; | |
144 | |
145 // Returns the channel of the embedder. | |
146 virtual version_info::Channel GetChannel() = 0; | |
147 | |
148 // Accessors for threads. | |
149 virtual scoped_refptr<base::SingleThreadTaskRunner> GetDBThread() = 0; | |
150 virtual scoped_refptr<base::SingleThreadTaskRunner> GetFileThread() = 0; | |
151 virtual base::SequencedWorkerPool* GetBlockingPool() = 0; | |
152 | |
116 private: | 153 private: |
117 DISALLOW_COPY_AND_ASSIGN(SyncClient); | 154 DISALLOW_COPY_AND_ASSIGN(SyncClient); |
118 }; | 155 }; |
119 | 156 |
120 } // namespace sync_driver | 157 } // namespace sync_driver |
121 | 158 |
122 #endif // COMPONENTS_SYNC_DRIVER_SYNC_CLIENT_H_ | 159 #endif // COMPONENTS_SYNC_DRIVER_SYNC_CLIENT_H_ |
OLD | NEW |