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/webdata/autofill/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 browser_sync::SyncBackendHost
* backend
,
35 const browser_sync::DataTypeController::TypeMap
* controllers
,
36 browser_sync::DataTypeManagerObserver
* observer
,
37 const FailedDatatypesHandler
* failed_datatypes_handler
) OVERRIDE
;
39 virtual browser_sync::GenericChangeProcessor
* CreateGenericChangeProcessor(
40 ProfileSyncService
* profile_sync_service
,
41 browser_sync::DataTypeErrorHandler
* error_handler
,
42 const base::WeakPtr
<syncer::SyncableService
>& local_service
,
43 const base::WeakPtr
<syncer::SyncMergeResult
>& merge_result
) OVERRIDE
;
45 virtual browser_sync::SharedChangeProcessor
*
46 CreateSharedChangeProcessor() OVERRIDE
;
48 virtual base::WeakPtr
<syncer::SyncableService
> GetSyncableServiceForType(
49 syncer::ModelType type
) OVERRIDE
;
51 // Legacy datatypes that need to be converted to the SyncableService API.
52 virtual SyncComponents
CreateBookmarkSyncComponents(
53 ProfileSyncService
* profile_sync_service
,
54 browser_sync::DataTypeErrorHandler
* error_handler
) OVERRIDE
;
55 virtual SyncComponents
CreatePasswordSyncComponents(
56 ProfileSyncService
* profile_sync_service
,
57 PasswordStore
* password_store
,
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
;
63 virtual SyncComponents
CreateSessionSyncComponents(
64 ProfileSyncService
* profile_sync_service
,
65 browser_sync::DataTypeErrorHandler
* error_handler
) OVERRIDE
;
68 // Register data types which are enabled on desktop platforms only.
69 void RegisterDesktopDataTypes(ProfileSyncService
* pss
);
70 // Register data types which are enabled on both desktop and mobile.
71 void RegisterCommonDataTypes(ProfileSyncService
* pss
);
74 CommandLine
* command_line_
;
75 // Set on the UI thread (since extensions::ExtensionSystemFactory is
76 // non-threadsafe); accessed on both the UI and FILE threads in
77 // GetSyncableServiceForType.
78 extensions::ExtensionSystem
* extension_system_
;
79 scoped_refptr
<AutofillWebDataService
> web_data_service_
;
81 DISALLOW_COPY_AND_ASSIGN(ProfileSyncComponentsFactoryImpl
);
84 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__