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"
19 namespace extensions
{
20 class ExtensionSystem
;
23 class ProfileSyncComponentsFactoryImpl
: public ProfileSyncComponentsFactory
{
25 ProfileSyncComponentsFactoryImpl(Profile
* profile
,
26 CommandLine
* command_line
);
27 virtual ~ProfileSyncComponentsFactoryImpl();
29 virtual void RegisterDataTypes(ProfileSyncService
* pss
) OVERRIDE
;
31 virtual browser_sync::DataTypeManager
* CreateDataTypeManager(
32 const syncer::WeakHandle
<syncer::DataTypeDebugInfoListener
>&
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
)
41 virtual browser_sync::SyncBackendHost
* CreateSyncBackendHost(
42 const std::string
& name
,
44 const base::WeakPtr
<browser_sync::SyncPrefs
>& sync_prefs
) OVERRIDE
;
46 virtual browser_sync::GenericChangeProcessor
* CreateGenericChangeProcessor(
47 ProfileSyncService
* profile_sync_service
,
48 browser_sync::DataTypeErrorHandler
* error_handler
,
49 const base::WeakPtr
<syncer::SyncableService
>& local_service
,
50 const base::WeakPtr
<syncer::SyncMergeResult
>& merge_result
) OVERRIDE
;
52 virtual browser_sync::SharedChangeProcessor
*
53 CreateSharedChangeProcessor() OVERRIDE
;
55 virtual base::WeakPtr
<syncer::SyncableService
> GetSyncableServiceForType(
56 syncer::ModelType type
) OVERRIDE
;
58 // Legacy datatypes that need to be converted to the SyncableService API.
59 virtual SyncComponents
CreateBookmarkSyncComponents(
60 ProfileSyncService
* profile_sync_service
,
61 browser_sync::DataTypeErrorHandler
* error_handler
) OVERRIDE
;
62 virtual SyncComponents
CreatePasswordSyncComponents(
63 ProfileSyncService
* profile_sync_service
,
64 PasswordStore
* password_store
,
65 browser_sync::DataTypeErrorHandler
* error_handler
) OVERRIDE
;
66 virtual SyncComponents
CreateTypedUrlSyncComponents(
67 ProfileSyncService
* profile_sync_service
,
68 history::HistoryBackend
* history_backend
,
69 browser_sync::DataTypeErrorHandler
* error_handler
) OVERRIDE
;
70 virtual SyncComponents
CreateSessionSyncComponents(
71 ProfileSyncService
* profile_sync_service
,
72 browser_sync::DataTypeErrorHandler
* error_handler
) OVERRIDE
;
75 // Register data types which are enabled on desktop platforms only.
76 void RegisterDesktopDataTypes(ProfileSyncService
* pss
);
77 // Register data types which are enabled on both desktop and mobile.
78 void RegisterCommonDataTypes(ProfileSyncService
* pss
);
81 CommandLine
* command_line_
;
82 // Set on the UI thread (since extensions::ExtensionSystemFactory is
83 // non-threadsafe); accessed on both the UI and FILE threads in
84 // GetSyncableServiceForType.
85 extensions::ExtensionSystem
* extension_system_
;
86 scoped_refptr
<autofill::AutofillWebDataService
> web_data_service_
;
88 DISALLOW_COPY_AND_ASSIGN(ProfileSyncComponentsFactoryImpl
);
91 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__