| 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 "components/sync_driver/sync_api_component_factory.h" |
| 13 #include "sync/internal_api/public/base/model_type.h" | 14 #include "sync/internal_api/public/base/model_type.h" |
| 14 #include "sync/internal_api/public/engine/model_safe_worker.h" | 15 #include "sync/internal_api/public/engine/model_safe_worker.h" |
| 15 #include "sync/util/extensions_activity.h" | 16 #include "sync/util/extensions_activity.h" |
| 16 | 17 |
| 17 class BookmarkUndoService; | 18 class BookmarkUndoService; |
| 18 class PrefService; | 19 class PrefService; |
| 19 | 20 |
| 20 namespace autofill { | 21 namespace autofill { |
| 21 class AutofillWebDataService; | 22 class AutofillWebDataService; |
| 22 class AutocompleteSyncableService; | 23 class AutocompleteSyncableService; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 46 namespace syncer { | 47 namespace syncer { |
| 47 class SyncableService; | 48 class SyncableService; |
| 48 } // namespace syncer | 49 } // namespace syncer |
| 49 | 50 |
| 50 namespace sync_sessions { | 51 namespace sync_sessions { |
| 51 class SyncSessionsClient; | 52 class SyncSessionsClient; |
| 52 } // namespace sync_sessions | 53 } // namespace sync_sessions |
| 53 | 54 |
| 54 namespace sync_driver { | 55 namespace sync_driver { |
| 55 | 56 |
| 56 class SyncApiComponentFactory; | |
| 57 class SyncService; | 57 class SyncService; |
| 58 | 58 |
| 59 typedef base::Callback<void(base::Time, base::Time)> ClearBrowsingDataCallback; | 59 typedef base::Callback<void(base::Time, base::Time)> ClearBrowsingDataCallback; |
| 60 | 60 |
| 61 // Interface for clients of the Sync API to plumb through necessary dependent | 61 // Interface for clients of the Sync API to plumb through necessary dependent |
| 62 // components. This interface is purely for abstracting dependencies, and | 62 // components. This interface is purely for abstracting dependencies, and |
| 63 // should not contain any non-trivial functional logic. | 63 // should not contain any non-trivial functional logic. |
| 64 // | 64 // |
| 65 // Note: on some platforms, getters might return nullptr. Callers are expected | 65 // Note: on some platforms, getters might return nullptr. Callers are expected |
| 66 // to handle these scenarios gracefully. | 66 // to handle these scenarios gracefully. |
| 67 class SyncClient { | 67 class SyncClient { |
| 68 public: | 68 public: |
| 69 SyncClient(); | 69 SyncClient(); |
| 70 virtual ~SyncClient(); | 70 virtual ~SyncClient(); |
| 71 | 71 |
| 72 // Initializes the sync client with the specified sync service. This will also | 72 // Initializes the sync client with the specified sync service. |
| 73 // register data type controllers with |service| (via | |
| 74 // SyncApiComponentFactory::RegisterDataTypes). | |
| 75 virtual void Initialize(SyncService* service) = 0; | 73 virtual void Initialize(SyncService* service) = 0; |
| 76 | 74 |
| 77 // Returns the current SyncService instance. | 75 // Returns the current SyncService instance. |
| 78 virtual SyncService* GetSyncService() = 0; | 76 virtual SyncService* GetSyncService() = 0; |
| 79 | 77 |
| 80 // Returns the current profile's preference service. | 78 // Returns the current profile's preference service. |
| 81 virtual PrefService* GetPrefService() = 0; | 79 virtual PrefService* GetPrefService() = 0; |
| 82 | 80 |
| 83 // DataType specific service getters. | 81 // DataType specific service getters. |
| 84 virtual bookmarks::BookmarkModel* GetBookmarkModel() = 0; | 82 virtual bookmarks::BookmarkModel* GetBookmarkModel() = 0; |
| 85 virtual favicon::FaviconService* GetFaviconService() = 0; | 83 virtual favicon::FaviconService* GetFaviconService() = 0; |
| 86 virtual history::HistoryService* GetHistoryService() = 0; | 84 virtual history::HistoryService* GetHistoryService() = 0; |
| 87 virtual scoped_refptr<password_manager::PasswordStore> GetPasswordStore() = 0; | 85 virtual scoped_refptr<password_manager::PasswordStore> GetPasswordStore() = 0; |
| 88 | 86 |
| 89 // Returns a callback that will be invoked when the sync service wishes to | 87 // Returns a callback that will be invoked when the sync service wishes to |
| 90 // have browsing data cleared. | 88 // have browsing data cleared. |
| 91 virtual ClearBrowsingDataCallback GetClearBrowsingDataCallback() = 0; | 89 virtual ClearBrowsingDataCallback GetClearBrowsingDataCallback() = 0; |
| 92 | 90 |
| 91 // Returns a callback that will register the types specific to the current |
| 92 // platform. |
| 93 virtual sync_driver::SyncApiComponentFactory::RegisterDataTypesMethod |
| 94 GetRegisterPlatformTypesCallback() = 0; |
| 95 |
| 93 // Returns a callback that will be invoked when password sync state has | 96 // Returns a callback that will be invoked when password sync state has |
| 94 // potentially been changed. | 97 // potentially been changed. |
| 95 virtual base::Closure GetPasswordStateChangedCallback() = 0; | 98 virtual base::Closure GetPasswordStateChangedCallback() = 0; |
| 96 | 99 |
| 97 virtual autofill::PersonalDataManager* GetPersonalDataManager() = 0; | 100 virtual autofill::PersonalDataManager* GetPersonalDataManager() = 0; |
| 98 virtual scoped_refptr<autofill::AutofillWebDataService> | 101 virtual scoped_refptr<autofill::AutofillWebDataService> |
| 99 GetWebDataService() = 0; | 102 GetWebDataService() = 0; |
| 100 virtual BookmarkUndoService* GetBookmarkUndoServiceIfExists() = 0; | 103 virtual BookmarkUndoService* GetBookmarkUndoServiceIfExists() = 0; |
| 101 virtual invalidation::InvalidationService* GetInvalidationService() = 0; | 104 virtual invalidation::InvalidationService* GetInvalidationService() = 0; |
| 102 virtual scoped_refptr<syncer::ExtensionsActivity> GetExtensionsActivity() = 0; | 105 virtual scoped_refptr<syncer::ExtensionsActivity> GetExtensionsActivity() = 0; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 118 // Returns the current SyncApiComponentFactory instance. | 121 // Returns the current SyncApiComponentFactory instance. |
| 119 virtual SyncApiComponentFactory* GetSyncApiComponentFactory() = 0; | 122 virtual SyncApiComponentFactory* GetSyncApiComponentFactory() = 0; |
| 120 | 123 |
| 121 private: | 124 private: |
| 122 DISALLOW_COPY_AND_ASSIGN(SyncClient); | 125 DISALLOW_COPY_AND_ASSIGN(SyncClient); |
| 123 }; | 126 }; |
| 124 | 127 |
| 125 } // namespace sync_driver | 128 } // namespace sync_driver |
| 126 | 129 |
| 127 #endif // COMPONENTS_SYNC_DRIVER_SYNC_CLIENT_H_ | 130 #endif // COMPONENTS_SYNC_DRIVER_SYNC_CLIENT_H_ |
| OLD | NEW |