| 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" | |
| 14 #include "sync/internal_api/public/base/model_type.h" | 13 #include "sync/internal_api/public/base/model_type.h" |
| 15 #include "sync/internal_api/public/engine/model_safe_worker.h" | 14 #include "sync/internal_api/public/engine/model_safe_worker.h" |
| 16 #include "sync/util/extensions_activity.h" | 15 #include "sync/util/extensions_activity.h" |
| 17 | 16 |
| 18 class BookmarkUndoService; | 17 class BookmarkUndoService; |
| 19 class PrefService; | 18 class PrefService; |
| 20 | 19 |
| 21 namespace autofill { | 20 namespace autofill { |
| 22 class AutofillWebDataService; | 21 class AutofillWebDataService; |
| 23 class AutocompleteSyncableService; | 22 class AutocompleteSyncableService; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 47 namespace syncer { | 46 namespace syncer { |
| 48 class SyncableService; | 47 class SyncableService; |
| 49 } // namespace syncer | 48 } // namespace syncer |
| 50 | 49 |
| 51 namespace sync_sessions { | 50 namespace sync_sessions { |
| 52 class SyncSessionsClient; | 51 class SyncSessionsClient; |
| 53 } // namespace sync_sessions | 52 } // namespace sync_sessions |
| 54 | 53 |
| 55 namespace sync_driver { | 54 namespace sync_driver { |
| 56 | 55 |
| 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. | 72 // Initializes the sync client with the specified sync service. This will also |
| 73 // register data type controllers with |service| (via |
| 74 // SyncApiComponentFactory::RegisterDataTypes). |
| 73 virtual void Initialize(SyncService* service) = 0; | 75 virtual void Initialize(SyncService* service) = 0; |
| 74 | 76 |
| 75 // Returns the current SyncService instance. | 77 // Returns the current SyncService instance. |
| 76 virtual SyncService* GetSyncService() = 0; | 78 virtual SyncService* GetSyncService() = 0; |
| 77 | 79 |
| 78 // Returns the current profile's preference service. | 80 // Returns the current profile's preference service. |
| 79 virtual PrefService* GetPrefService() = 0; | 81 virtual PrefService* GetPrefService() = 0; |
| 80 | 82 |
| 81 // DataType specific service getters. | 83 // DataType specific service getters. |
| 82 virtual bookmarks::BookmarkModel* GetBookmarkModel() = 0; | 84 virtual bookmarks::BookmarkModel* GetBookmarkModel() = 0; |
| 83 virtual favicon::FaviconService* GetFaviconService() = 0; | 85 virtual favicon::FaviconService* GetFaviconService() = 0; |
| 84 virtual history::HistoryService* GetHistoryService() = 0; | 86 virtual history::HistoryService* GetHistoryService() = 0; |
| 85 virtual scoped_refptr<password_manager::PasswordStore> GetPasswordStore() = 0; | 87 virtual scoped_refptr<password_manager::PasswordStore> GetPasswordStore() = 0; |
| 86 | 88 |
| 87 // Returns a callback that will be invoked when the sync service wishes to | 89 // Returns a callback that will be invoked when the sync service wishes to |
| 88 // have browsing data cleared. | 90 // have browsing data cleared. |
| 89 virtual ClearBrowsingDataCallback GetClearBrowsingDataCallback() = 0; | 91 virtual ClearBrowsingDataCallback GetClearBrowsingDataCallback() = 0; |
| 90 | 92 |
| 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 | |
| 96 // Returns a callback that will be invoked when password sync state has | 93 // Returns a callback that will be invoked when password sync state has |
| 97 // potentially been changed. | 94 // potentially been changed. |
| 98 virtual base::Closure GetPasswordStateChangedCallback() = 0; | 95 virtual base::Closure GetPasswordStateChangedCallback() = 0; |
| 99 | 96 |
| 100 virtual autofill::PersonalDataManager* GetPersonalDataManager() = 0; | 97 virtual autofill::PersonalDataManager* GetPersonalDataManager() = 0; |
| 101 virtual scoped_refptr<autofill::AutofillWebDataService> | 98 virtual scoped_refptr<autofill::AutofillWebDataService> |
| 102 GetWebDataService() = 0; | 99 GetWebDataService() = 0; |
| 103 virtual BookmarkUndoService* GetBookmarkUndoServiceIfExists() = 0; | 100 virtual BookmarkUndoService* GetBookmarkUndoServiceIfExists() = 0; |
| 104 virtual invalidation::InvalidationService* GetInvalidationService() = 0; | 101 virtual invalidation::InvalidationService* GetInvalidationService() = 0; |
| 105 virtual scoped_refptr<syncer::ExtensionsActivity> GetExtensionsActivity() = 0; | 102 virtual scoped_refptr<syncer::ExtensionsActivity> GetExtensionsActivity() = 0; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 121 // Returns the current SyncApiComponentFactory instance. | 118 // Returns the current SyncApiComponentFactory instance. |
| 122 virtual SyncApiComponentFactory* GetSyncApiComponentFactory() = 0; | 119 virtual SyncApiComponentFactory* GetSyncApiComponentFactory() = 0; |
| 123 | 120 |
| 124 private: | 121 private: |
| 125 DISALLOW_COPY_AND_ASSIGN(SyncClient); | 122 DISALLOW_COPY_AND_ASSIGN(SyncClient); |
| 126 }; | 123 }; |
| 127 | 124 |
| 128 } // namespace sync_driver | 125 } // namespace sync_driver |
| 129 | 126 |
| 130 #endif // COMPONENTS_SYNC_DRIVER_SYNC_CLIENT_H_ | 127 #endif // COMPONENTS_SYNC_DRIVER_SYNC_CLIENT_H_ |
| OLD | NEW |