1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__ 6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__ 7 8 #include <string> 9 10 #include "base/basictypes.h" 11 #include "base/compiler_specific.h" 12 #include "chrome/browser/sync/profile_sync_components_factory.h" 13 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" 14 15 16 class CommandLine; 17 class Profile; 18 19 namespace extensions { 20 class ExtensionSystem; 21 } 22 23 class ProfileSyncComponentsFactoryImpl : public ProfileSyncComponentsFactory { 24 public: 25 ProfileSyncComponentsFactoryImpl(Profile* profile, 26 CommandLine* command_line); 27 virtual ~ProfileSyncComponentsFactoryImpl(); 28 29 virtual void RegisterDataTypes(ProfileSyncService* pss) OVERRIDE; 30 31 virtual browser_sync::DataTypeManager* CreateDataTypeManager( 32 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& 33 debug_info_listener, 34 const browser_sync::DataTypeController::TypeMap* controllers, 35 const browser_sync::DataTypeEncryptionHandler* encryption_handler, 36 browser_sync::SyncBackendHost* backend, 37 browser_sync::DataTypeManagerObserver* observer, 38 browser_sync::FailedDataTypesHandler* failed_data_types_handler) 39 OVERRIDE; 40 41 virtual browser_sync::GenericChangeProcessor* CreateGenericChangeProcessor( 42 ProfileSyncService* profile_sync_service, 43 browser_sync::DataTypeErrorHandler* error_handler, 44 const base::WeakPtr<syncer::SyncableService>& local_service, 45 const base::WeakPtr<syncer::SyncMergeResult>& merge_result) OVERRIDE; 46 47 virtual browser_sync::SharedChangeProcessor* 48 CreateSharedChangeProcessor() OVERRIDE; 49 50 virtual base::WeakPtr<syncer::SyncableService> GetSyncableServiceForType( 51 syncer::ModelType type) OVERRIDE; 52 53 // Legacy datatypes that need to be converted to the SyncableService API. 54 virtual SyncComponents CreateBookmarkSyncComponents( 55 ProfileSyncService* profile_sync_service, 56 browser_sync::DataTypeErrorHandler* error_handler) OVERRIDE; 57 virtual SyncComponents CreatePasswordSyncComponents( 58 ProfileSyncService* profile_sync_service, 59 PasswordStore* password_store, 60 browser_sync::DataTypeErrorHandler* error_handler) OVERRIDE; 61 virtual SyncComponents CreateTypedUrlSyncComponents( 62 ProfileSyncService* profile_sync_service, 63 history::HistoryBackend* history_backend, 64 browser_sync::DataTypeErrorHandler* error_handler) OVERRIDE; 65 virtual SyncComponents CreateSessionSyncComponents( 66 ProfileSyncService* profile_sync_service, 67 browser_sync::DataTypeErrorHandler* error_handler) OVERRIDE; 68 69 private: 70 // Register data types which are enabled on desktop platforms only. 71 void RegisterDesktopDataTypes(ProfileSyncService* pss); 72 // Register data types which are enabled on both desktop and mobile. 73 void RegisterCommonDataTypes(ProfileSyncService* pss); 74 75 Profile* profile_; 76 CommandLine* command_line_; 77 // Set on the UI thread (since extensions::ExtensionSystemFactory is 78 // non-threadsafe); accessed on both the UI and FILE threads in 79 // GetSyncableServiceForType. 80 extensions::ExtensionSystem* extension_system_; 81 scoped_refptr<autofill::AutofillWebDataService> web_data_service_; 82 83 DISALLOW_COPY_AND_ASSIGN(ProfileSyncComponentsFactoryImpl); 84 }; 85 86 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__ 87