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" |
(...skipping 21 matching lines...) Expand all Loading... |
32 } // namespace favicon | 32 } // namespace favicon |
33 | 33 |
34 namespace history { | 34 namespace history { |
35 class HistoryService; | 35 class HistoryService; |
36 } // namespace history | 36 } // namespace history |
37 | 37 |
38 namespace invalidation { | 38 namespace invalidation { |
39 class InvalidationService; | 39 class InvalidationService; |
40 } // namespace invalidation | 40 } // namespace invalidation |
41 | 41 |
| 42 namespace syncer { |
| 43 class SyncableService; |
| 44 } // namespace syncer |
| 45 |
42 namespace sync_sessions { | 46 namespace sync_sessions { |
43 class SyncSessionsClient; | 47 class SyncSessionsClient; |
44 } // namespace sync_sessions | 48 } // namespace sync_sessions |
45 | 49 |
46 namespace syncer { | 50 namespace sync_driver { |
47 | 51 |
48 class SyncService; | 52 class SyncService; |
49 class SyncableService; | |
50 | 53 |
51 // Interface for clients of the Sync API to plumb through necessary dependent | 54 // Interface for clients of the Sync API to plumb through necessary dependent |
52 // components. This interface is purely for abstracting dependencies, and | 55 // components. This interface is purely for abstracting dependencies, and |
53 // should not contain any non-trivial functional logic. | 56 // should not contain any non-trivial functional logic. |
54 // | 57 // |
55 // Note: on some platforms, getters might return nullptr. Callers are expected | 58 // Note: on some platforms, getters might return nullptr. Callers are expected |
56 // to handle these scenarios gracefully. | 59 // to handle these scenarios gracefully. |
57 class SyncClient { | 60 class SyncClient { |
58 public: | 61 public: |
59 SyncClient(); | 62 SyncClient(); |
60 virtual ~SyncClient(); | 63 virtual ~SyncClient(); |
61 | 64 |
62 // Initializes the sync client with the specified sync service. | 65 // Initializes the sync client with the specified sync service. |
63 virtual void Initialize() = 0; | 66 virtual void Initialize() = 0; |
64 | 67 |
65 // Returns the current SyncService instance. | 68 // Returns the current SyncService instance. |
66 virtual SyncService* GetSyncService() = 0; | 69 virtual SyncService* GetSyncService() = 0; |
67 | 70 |
68 // Returns the current profile's preference service. | 71 // Returns the current profile's preference service. |
69 virtual PrefService* GetPrefService() = 0; | 72 virtual PrefService* GetPrefService() = 0; |
70 | 73 |
71 // DataType specific service getters. | 74 // DataType specific service getters. |
72 virtual bookmarks::BookmarkModel* GetBookmarkModel() = 0; | 75 virtual bookmarks::BookmarkModel* GetBookmarkModel() = 0; |
73 virtual favicon::FaviconService* GetFaviconService() = 0; | 76 virtual favicon::FaviconService* GetFaviconService() = 0; |
74 virtual history::HistoryService* GetHistoryService() = 0; | 77 virtual history::HistoryService* GetHistoryService() = 0; |
75 | 78 |
76 // Returns a callback that will register the types specific to the current | 79 // Returns a callback that will register the types specific to the current |
77 // platform. | 80 // platform. |
78 virtual SyncApiComponentFactory::RegisterDataTypesMethod | 81 virtual sync_driver::SyncApiComponentFactory::RegisterDataTypesMethod |
79 GetRegisterPlatformTypesCallback() = 0; | 82 GetRegisterPlatformTypesCallback() = 0; |
80 | 83 |
81 // Returns a callback that will be invoked when password sync state has | 84 // Returns a callback that will be invoked when password sync state has |
82 // potentially been changed. | 85 // potentially been changed. |
83 virtual base::Closure GetPasswordStateChangedCallback() = 0; | 86 virtual base::Closure GetPasswordStateChangedCallback() = 0; |
84 | 87 |
85 virtual autofill::PersonalDataManager* GetPersonalDataManager() = 0; | 88 virtual autofill::PersonalDataManager* GetPersonalDataManager() = 0; |
86 virtual BookmarkUndoService* GetBookmarkUndoServiceIfExists() = 0; | 89 virtual BookmarkUndoService* GetBookmarkUndoServiceIfExists() = 0; |
87 virtual invalidation::InvalidationService* GetInvalidationService() = 0; | 90 virtual invalidation::InvalidationService* GetInvalidationService() = 0; |
88 virtual scoped_refptr<ExtensionsActivity> GetExtensionsActivity() = 0; | 91 virtual scoped_refptr<syncer::ExtensionsActivity> GetExtensionsActivity() = 0; |
89 virtual sync_sessions::SyncSessionsClient* GetSyncSessionsClient() = 0; | 92 virtual sync_sessions::SyncSessionsClient* GetSyncSessionsClient() = 0; |
90 | 93 |
91 // Returns a weak pointer to the syncable service specified by |type|. | 94 // Returns a weak pointer to the syncable service specified by |type|. |
92 // Weak pointer may be unset if service is already destroyed. | 95 // Weak pointer may be unset if service is already destroyed. |
93 // Note: Should only be dereferenced from the model type thread. | 96 // Note: Should only be dereferenced from the model type thread. |
94 virtual base::WeakPtr<SyncableService> GetSyncableServiceForType( | 97 virtual base::WeakPtr<syncer::SyncableService> GetSyncableServiceForType( |
95 ModelType type) = 0; | 98 syncer::ModelType type) = 0; |
96 | 99 |
97 // Returns a weak pointer to the ModelTypeService specified by |type|. Weak | 100 // Returns a weak pointer to the ModelTypeService specified by |type|. Weak |
98 // pointer may be unset if service is already destroyed. | 101 // pointer may be unset if service is already destroyed. |
99 // Note: Should only be dereferenced from the model type thread. | 102 // Note: Should only be dereferenced from the model type thread. |
100 virtual base::WeakPtr<ModelTypeService> GetModelTypeServiceForType( | 103 virtual base::WeakPtr<syncer_v2::ModelTypeService> GetModelTypeServiceForType( |
101 ModelType type) = 0; | 104 syncer::ModelType type) = 0; |
102 | 105 |
103 // Creates and returns a new ModelSafeWorker for the group, or null if one | 106 // Creates and returns a new ModelSafeWorker for the group, or null if one |
104 // cannot be created. | 107 // cannot be created. |
105 // TODO(maxbogue): Move this inside SyncApiComponentFactory. | 108 // TODO(maxbogue): Move this inside SyncApiComponentFactory. |
106 virtual scoped_refptr<ModelSafeWorker> CreateModelWorkerForGroup( | 109 virtual scoped_refptr<syncer::ModelSafeWorker> CreateModelWorkerForGroup( |
107 ModelSafeGroup group, | 110 syncer::ModelSafeGroup group, |
108 WorkerLoopDestructionObserver* observer) = 0; | 111 syncer::WorkerLoopDestructionObserver* observer) = 0; |
109 | 112 |
110 // Returns the current SyncApiComponentFactory instance. | 113 // Returns the current SyncApiComponentFactory instance. |
111 virtual SyncApiComponentFactory* GetSyncApiComponentFactory() = 0; | 114 virtual SyncApiComponentFactory* GetSyncApiComponentFactory() = 0; |
112 | 115 |
113 private: | 116 private: |
114 DISALLOW_COPY_AND_ASSIGN(SyncClient); | 117 DISALLOW_COPY_AND_ASSIGN(SyncClient); |
115 }; | 118 }; |
116 | 119 |
117 } // namespace syncer | 120 } // namespace sync_driver |
118 | 121 |
119 #endif // COMPONENTS_SYNC_DRIVER_SYNC_CLIENT_H_ | 122 #endif // COMPONENTS_SYNC_DRIVER_SYNC_CLIENT_H_ |
OLD | NEW |