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 invalidation::InvalidationService
* invalidator
,
47 const base::WeakPtr
<sync_driver::SyncPrefs
>& sync_prefs
,
48 const base::FilePath
& sync_folder
) OVERRIDE
;
50 virtual base::WeakPtr
<syncer::SyncableService
> GetSyncableServiceForType(
51 syncer::ModelType type
) OVERRIDE
;
52 virtual scoped_ptr
<syncer::AttachmentService
> CreateAttachmentService(
53 syncer::AttachmentService::Delegate
* delegate
) OVERRIDE
;
55 // Legacy datatypes that need to be converted to the SyncableService API.
56 virtual SyncComponents
CreateBookmarkSyncComponents(
57 ProfileSyncService
* profile_sync_service
,
58 browser_sync::DataTypeErrorHandler
* error_handler
) OVERRIDE
;
59 virtual SyncComponents
CreateTypedUrlSyncComponents(
60 ProfileSyncService
* profile_sync_service
,
61 history::HistoryBackend
* history_backend
,
62 browser_sync::DataTypeErrorHandler
* error_handler
) OVERRIDE
;
65 // Register data types which are enabled on desktop platforms only.
66 void RegisterDesktopDataTypes(syncer::ModelTypeSet disabled_types
,
67 ProfileSyncService
* pss
);
68 // Register data types which are enabled on both desktop and mobile.
69 void RegisterCommonDataTypes(syncer::ModelTypeSet disabled_types
,
70 ProfileSyncService
* pss
);
73 base::CommandLine
* command_line_
;
74 // Set on the UI thread (since extensions::ExtensionSystemFactory is
75 // non-threadsafe); accessed on both the UI and FILE threads in
76 // GetSyncableServiceForType.
77 extensions::ExtensionSystem
* extension_system_
;
78 scoped_refptr
<autofill::AutofillWebDataService
> web_data_service_
;
80 DISALLOW_COPY_AND_ASSIGN(ProfileSyncComponentsFactoryImpl
);
83 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__