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.
5 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__
6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__
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"
21 namespace extensions
{
22 class ExtensionSystem
;
25 class ProfileSyncComponentsFactoryImpl
: public ProfileSyncComponentsFactory
{
27 ProfileSyncComponentsFactoryImpl(Profile
* profile
,
28 base::CommandLine
* command_line
);
29 virtual ~ProfileSyncComponentsFactoryImpl();
31 virtual void RegisterDataTypes(ProfileSyncService
* pss
) OVERRIDE
;
33 virtual browser_sync::DataTypeManager
* CreateDataTypeManager(
34 const syncer::WeakHandle
<syncer::DataTypeDebugInfoListener
>&
36 const browser_sync::DataTypeController::TypeMap
* controllers
,
37 const browser_sync::DataTypeEncryptionHandler
* encryption_handler
,
38 browser_sync::SyncBackendHost
* backend
,
39 browser_sync::DataTypeManagerObserver
* observer
,
40 browser_sync::FailedDataTypesHandler
* failed_data_types_handler
)
43 virtual browser_sync::SyncBackendHost
* CreateSyncBackendHost(
44 const std::string
& name
,
46 const base::WeakPtr
<sync_driver::SyncPrefs
>& sync_prefs
) OVERRIDE
;
48 virtual base::WeakPtr
<syncer::SyncableService
> GetSyncableServiceForType(
49 syncer::ModelType type
) OVERRIDE
;
50 virtual scoped_ptr
<syncer::AttachmentStore
>
51 CreateCustomAttachmentStoreForType(syncer::ModelType type
) OVERRIDE
;
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
CreateTypedUrlSyncComponents(
58 ProfileSyncService
* profile_sync_service
,
59 history::HistoryBackend
* history_backend
,
60 browser_sync::DataTypeErrorHandler
* error_handler
) OVERRIDE
;
63 // Register data types which are enabled on desktop platforms only.
64 void RegisterDesktopDataTypes(syncer::ModelTypeSet disabled_types
,
65 ProfileSyncService
* pss
);
66 // Register data types which are enabled on both desktop and mobile.
67 void RegisterCommonDataTypes(syncer::ModelTypeSet disabled_types
,
68 ProfileSyncService
* pss
);
71 base::CommandLine
* command_line_
;
72 // Set on the UI thread (since extensions::ExtensionSystemFactory is
73 // non-threadsafe); accessed on both the UI and FILE threads in
74 // GetSyncableServiceForType.
75 extensions::ExtensionSystem
* extension_system_
;
76 scoped_refptr
<autofill::AutofillWebDataService
> web_data_service_
;
78 DISALLOW_COPY_AND_ASSIGN(ProfileSyncComponentsFactoryImpl
);
81 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__