| 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 CHROME_BROWSER_SYNC_CHROME_SYNC_CLIENT_H__ | 5 #ifndef CHROME_BROWSER_SYNC_CHROME_SYNC_CLIENT_H__ | 
| 6 #define CHROME_BROWSER_SYNC_CHROME_SYNC_CLIENT_H__ | 6 #define CHROME_BROWSER_SYNC_CHROME_SYNC_CLIENT_H__ | 
| 7 | 7 | 
| 8 #include "base/macros.h" | 8 #include "base/macros.h" | 
| 9 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 9 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 
| 10 #include "chrome/browser/sync/glue/extensions_activity_monitor.h" | 10 #include "chrome/browser/sync/glue/extensions_activity_monitor.h" | 
| 11 #include "components/sync_driver/sync_client.h" | 11 #include "components/sync_driver/sync_client.h" | 
| 12 | 12 | 
| 13 class Profile; | 13 class Profile; | 
| 14 | 14 | 
| 15 namespace sync_driver { | 15 namespace sync_driver { | 
| 16 class SyncApiComponentFactory; | 16 class SyncApiComponentFactory; | 
| 17 class SyncService; | 17 class SyncService; | 
| 18 } | 18 } | 
| 19 | 19 | 
| 20 namespace browser_sync { | 20 namespace browser_sync { | 
| 21 | 21 | 
| 22 class ChromeSyncClient : public sync_driver::SyncClient { | 22 class ChromeSyncClient : public sync_driver::SyncClient { | 
| 23  public: | 23  public: | 
| 24   ChromeSyncClient( | 24   explicit ChromeSyncClient(Profile* profile); | 
| 25       Profile* profile, |  | 
| 26       scoped_ptr<sync_driver::SyncApiComponentFactory> component_factory); |  | 
| 27   ~ChromeSyncClient() override; | 25   ~ChromeSyncClient() override; | 
| 28 | 26 | 
| 29   // SyncClient implementation. | 27   // SyncClient implementation. | 
| 30   void Initialize(sync_driver::SyncService* sync_service) override; | 28   void Initialize( | 
|  | 29       scoped_ptr<sync_driver::SyncApiComponentFactory> component_factory, | 
|  | 30       sync_driver::SyncService* sync_service) override; | 
| 31   sync_driver::SyncService* GetSyncService() override; | 31   sync_driver::SyncService* GetSyncService() override; | 
| 32   PrefService* GetPrefService() override; | 32   PrefService* GetPrefService() override; | 
| 33   bookmarks::BookmarkModel* GetBookmarkModel() override; | 33   bookmarks::BookmarkModel* GetBookmarkModel() override; | 
| 34   favicon::FaviconService* GetFaviconService() override; | 34   favicon::FaviconService* GetFaviconService() override; | 
| 35   history::HistoryService* GetHistoryService() override; | 35   history::HistoryService* GetHistoryService() override; | 
| 36   scoped_refptr<password_manager::PasswordStore> GetPasswordStore() override; | 36   scoped_refptr<password_manager::PasswordStore> GetPasswordStore() override; | 
| 37   sync_driver::ClearBrowsingDataCallback GetClearBrowsingDataCallback() | 37   sync_driver::ClearBrowsingDataCallback GetClearBrowsingDataCallback() | 
| 38       override; | 38       override; | 
| 39   base::Closure GetPasswordStateChangedCallback() override; | 39   base::Closure GetPasswordStateChangedCallback() override; | 
|  | 40   sync_driver::SyncApiComponentFactory::RegisterDataTypesMethod | 
|  | 41   GetRegisterPlatformTypesCallback() override; | 
| 40   autofill::PersonalDataManager* GetPersonalDataManager() override; | 42   autofill::PersonalDataManager* GetPersonalDataManager() override; | 
| 41   invalidation::InvalidationService* GetInvalidationService() override; | 43   invalidation::InvalidationService* GetInvalidationService() override; | 
| 42   scoped_refptr<autofill::AutofillWebDataService> GetWebDataService() override; | 44   scoped_refptr<autofill::AutofillWebDataService> GetWebDataService() override; | 
| 43   BookmarkUndoService* GetBookmarkUndoServiceIfExists() override; | 45   BookmarkUndoService* GetBookmarkUndoServiceIfExists() override; | 
| 44   scoped_refptr<syncer::ExtensionsActivity> GetExtensionsActivity() override; | 46   scoped_refptr<syncer::ExtensionsActivity> GetExtensionsActivity() override; | 
| 45   sync_sessions::SyncSessionsClient* GetSyncSessionsClient() override; | 47   sync_sessions::SyncSessionsClient* GetSyncSessionsClient() override; | 
| 46   base::WeakPtr<syncer::SyncableService> GetSyncableServiceForType( | 48   base::WeakPtr<syncer::SyncableService> GetSyncableServiceForType( | 
| 47       syncer::ModelType type) override; | 49       syncer::ModelType type) override; | 
| 48   scoped_refptr<syncer::ModelSafeWorker> CreateModelWorkerForGroup( | 50   scoped_refptr<syncer::ModelSafeWorker> CreateModelWorkerForGroup( | 
| 49       syncer::ModelSafeGroup group, | 51       syncer::ModelSafeGroup group, | 
| 50       syncer::WorkerLoopDestructionObserver* observer) override; | 52       syncer::WorkerLoopDestructionObserver* observer) override; | 
| 51   sync_driver::SyncApiComponentFactory* GetSyncApiComponentFactory() override; | 53   sync_driver::SyncApiComponentFactory* GetSyncApiComponentFactory() override; | 
| 52 | 54 | 
| 53   // Helper for testing rollback. | 55   // Helper for testing rollback. | 
| 54   void SetBrowsingDataRemoverObserverForTesting( | 56   void SetBrowsingDataRemoverObserverForTesting( | 
| 55       BrowsingDataRemover::Observer* observer); | 57       BrowsingDataRemover::Observer* observer); | 
| 56 | 58 | 
| 57  private: | 59  private: | 
| 58   Profile* const profile_; | 60   // Register data types which are enabled on desktop platforms only. | 
|  | 61   // |disabled_types| and |enabled_types| correspond only to those types | 
|  | 62   // being explicitly disabled/enabled by the command line. | 
|  | 63   void RegisterDesktopDataTypes(syncer::ModelTypeSet disabled_types, | 
|  | 64                                 syncer::ModelTypeSet enabled_types); | 
|  | 65 | 
|  | 66   // Register data types which are enabled on Android platforms only. | 
|  | 67   // |disabled_types| and |enabled_types| correspond only to those types | 
|  | 68   // being explicitly disabled/enabled by the command line. | 
|  | 69   void RegisterAndroidDataTypes(syncer::ModelTypeSet disabled_types, | 
|  | 70                                 syncer::ModelTypeSet enabled_types); | 
| 59 | 71 | 
| 60   void ClearBrowsingData(base::Time start, base::Time end); | 72   void ClearBrowsingData(base::Time start, base::Time end); | 
| 61 | 73 | 
|  | 74   Profile* const profile_; | 
|  | 75 | 
| 62   // The sync api component factory in use by this client. | 76   // The sync api component factory in use by this client. | 
| 63   scoped_ptr<sync_driver::SyncApiComponentFactory> component_factory_; | 77   scoped_ptr<sync_driver::SyncApiComponentFactory> component_factory_; | 
| 64 | 78 | 
| 65   // Members that must be fetched on the UI thread but accessed on their | 79   // Members that must be fetched on the UI thread but accessed on their | 
| 66   // respective backend threads. | 80   // respective backend threads. | 
| 67   scoped_refptr<autofill::AutofillWebDataService> web_data_service_; | 81   scoped_refptr<autofill::AutofillWebDataService> web_data_service_; | 
| 68   scoped_refptr<password_manager::PasswordStore> password_store_; | 82   scoped_refptr<password_manager::PasswordStore> password_store_; | 
| 69 | 83 | 
| 70   scoped_ptr<sync_sessions::SyncSessionsClient> sync_sessions_client_; | 84   scoped_ptr<sync_sessions::SyncSessionsClient> sync_sessions_client_; | 
| 71 | 85 | 
| 72   // TODO(zea): this is a member only because Typed URLs needs access to | 86   // TODO(zea): this is a member only because Typed URLs needs access to | 
| 73   // the UserShare and Cryptographer outside of the UI thread. Remove this | 87   // the UserShare and Cryptographer outside of the UI thread. Remove this | 
| 74   // once that's no longer the case. | 88   // once that's no longer the case. | 
| 75   // Note: not owned. | 89   // Note: not owned. | 
| 76   sync_driver::SyncService* sync_service_; | 90   sync_driver::SyncService* sync_service_; | 
| 77 | 91 | 
| 78   // Generates and monitors the ExtensionsActivity object used by sync. | 92   // Generates and monitors the ExtensionsActivity object used by sync. | 
| 79   ExtensionsActivityMonitor extensions_activity_monitor_; | 93   ExtensionsActivityMonitor extensions_activity_monitor_; | 
| 80 | 94 | 
| 81   // Used in integration tests. | 95   // Used in integration tests. | 
| 82   BrowsingDataRemover::Observer* browsing_data_remover_observer_; | 96   BrowsingDataRemover::Observer* browsing_data_remover_observer_; | 
| 83 | 97 | 
|  | 98   base::WeakPtrFactory<ChromeSyncClient> weak_ptr_factory_; | 
|  | 99 | 
| 84   DISALLOW_COPY_AND_ASSIGN(ChromeSyncClient); | 100   DISALLOW_COPY_AND_ASSIGN(ChromeSyncClient); | 
| 85 }; | 101 }; | 
| 86 | 102 | 
| 87 }  // namespace browser_sync | 103 }  // namespace browser_sync | 
| 88 | 104 | 
| 89 #endif  // CHROME_BROWSER_SYNC_CHROME_SYNC_CLIENT_H__ | 105 #endif  // CHROME_BROWSER_SYNC_CHROME_SYNC_CLIENT_H__ | 
| OLD | NEW | 
|---|