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 "components/sync_driver/sync_client.h" | 8 #include "components/sync_driver/sync_client.h" |
9 | 9 |
10 class ProfileSyncComponentsFactoryImpl; | 10 class Profile; |
11 | |
12 namespace sync_driver { | |
13 class SyncApiComponentFactory; | |
14 class SyncService; | |
15 } | |
11 | 16 |
12 namespace browser_sync { | 17 namespace browser_sync { |
13 | 18 |
14 class ChromeSyncClient : public sync_driver::SyncClient { | 19 class ChromeSyncClient : public sync_driver::SyncClient { |
15 public: | 20 public: |
16 ChromeSyncClient(Profile* profile, | 21 ChromeSyncClient(Profile* profile, |
17 ProfileSyncComponentsFactoryImpl* component_factory); | 22 sync_driver::SyncApiComponentFactory* component_factory); |
18 ~ChromeSyncClient() override; | 23 ~ChromeSyncClient() override; |
19 | 24 |
25 // Initializes the ChromeSyncClient internal state. | |
26 void Initialize(sync_driver::SyncService* sync_service); | |
27 | |
20 // SyncClient implementation. | 28 // SyncClient implementation. |
29 sync_driver::SyncService* GetSyncService() override; | |
21 PrefService* GetPrefService() override; | 30 PrefService* GetPrefService() override; |
22 bookmarks::BookmarkModel* GetBookmarkModel() override; | 31 bookmarks::BookmarkModel* GetBookmarkModel() override; |
23 history::HistoryService* GetHistoryService() override; | 32 history::HistoryService* GetHistoryService() override; |
24 scoped_refptr<password_manager::PasswordStore> GetPasswordStore() override; | 33 scoped_refptr<password_manager::PasswordStore> GetPasswordStore() override; |
25 autofill::PersonalDataManager* GetPersonalDataManager() override; | 34 autofill::PersonalDataManager* GetPersonalDataManager() override; |
26 scoped_refptr<autofill::AutofillWebDataService> GetWebDataService() override; | 35 scoped_refptr<autofill::AutofillWebDataService> GetWebDataService() override; |
27 base::WeakPtr<syncer::SyncableService> GetSyncableServiceForType( | 36 base::WeakPtr<syncer::SyncableService> GetSyncableServiceForType( |
28 syncer::ModelType type) override; | 37 syncer::ModelType type) override; |
29 // TODO(zea): crbug.com/512768 Move the rest of these methods into | |
30 // SyncApiComponentFactoryImpl (all of these methods currently delegate to | |
31 // |component_factory_|), which will replace ProfileSyncComponentsFactoryImpl. | |
32 scoped_ptr<syncer::AttachmentService> CreateAttachmentService( | |
33 scoped_ptr<syncer::AttachmentStoreForSync> attachment_store, | |
34 const syncer::UserShare& user_share, | |
35 const std::string& store_birthday, | |
36 syncer::ModelType model_type, | |
37 syncer::AttachmentService::Delegate* delegate) override; | |
38 void RegisterDataTypes(ProfileSyncService* pss) override; | |
39 sync_driver::DataTypeManager* CreateDataTypeManager( | |
40 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& | |
41 debug_info_listener, | |
42 const sync_driver::DataTypeController::TypeMap* controllers, | |
43 const sync_driver::DataTypeEncryptionHandler* encryption_handler, | |
44 browser_sync::SyncBackendHost* backend, | |
45 sync_driver::DataTypeManagerObserver* observer) override; | |
46 browser_sync::SyncBackendHost* CreateSyncBackendHost( | |
47 const std::string& name, | |
48 Profile* profile, | |
49 invalidation::InvalidationService* invalidator, | |
50 const base::WeakPtr<sync_driver::SyncPrefs>& sync_prefs, | |
51 const base::FilePath& sync_folder) override; | |
52 scoped_ptr<sync_driver::LocalDeviceInfoProvider> | |
53 CreateLocalDeviceInfoProvider() override; | |
54 ProfileSyncComponentsFactory::SyncComponents CreateBookmarkSyncComponents( | |
55 ProfileSyncService* profile_sync_service, | |
56 sync_driver::DataTypeErrorHandler* error_handler) override; | |
57 ProfileSyncComponentsFactory::SyncComponents CreateTypedUrlSyncComponents( | |
58 ProfileSyncService* profile_sync_service, | |
59 history::HistoryBackend* history_backend, | |
60 sync_driver::DataTypeErrorHandler* error_handler) override; | |
61 | 38 |
62 // TODO(zea): crbug.com/512768 Convert this to SyncApiComponentFactoryImpl | 39 sync_driver::SyncApiComponentFactory* GetSyncApiComponentFactory() override; |
63 // and make it part of the SyncClient interface. | |
64 ProfileSyncComponentsFactoryImpl* GetProfileSyncComponentsFactoryImpl(); | |
65 | |
66 | 40 |
67 private: | 41 private: |
68 Profile* const profile_; | 42 Profile* const profile_; |
stanisc
2015/08/27 22:14:04
I wonder if SyncClient should have a method that r
Nicolas Zea
2015/08/27 23:37:15
Most places that a profile is passed with the Sync
| |
69 ProfileSyncComponentsFactoryImpl* const component_factory_; | 43 sync_driver::SyncApiComponentFactory* const component_factory_; |
stanisc
2015/08/27 22:14:04
Consider adding a comment about ownership of compo
Nicolas Zea
2015/08/27 23:37:15
Done.
| |
70 | 44 |
71 // Members that must be fetched on the UI thread but accessed on their | 45 // Members that must be fetched on the UI thread but accessed on their |
72 // respective backend threads. | 46 // respective backend threads. |
73 scoped_refptr<autofill::AutofillWebDataService> web_data_service_; | 47 scoped_refptr<autofill::AutofillWebDataService> web_data_service_; |
74 scoped_refptr<password_manager::PasswordStore> password_store_; | 48 scoped_refptr<password_manager::PasswordStore> password_store_; |
49 // TODO(zea): this is a member only because Typed URLs needs access to | |
50 // the UserShare and Cryptographer outside of the UI thread. Remove this | |
51 // once that's no longer the case. | |
52 sync_driver::SyncService* sync_service_; | |
stanisc
2015/08/27 22:14:04
Consider mentioning ownership of sync_service.
Nicolas Zea
2015/08/27 23:37:15
Done.
| |
75 }; | 53 }; |
76 | 54 |
77 } // namespace browser_sync | 55 } // namespace browser_sync |
78 | 56 |
79 #endif // CHROME_BROWSER_SYNC_CHROME_SYNC_CLIENT_H__ | 57 #endif // CHROME_BROWSER_SYNC_CHROME_SYNC_CLIENT_H__ |
OLD | NEW |