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 "chrome/browser/webdata/web_data_service.h"
18 namespace extensions
{
19 class ExtensionSystem
;
22 class ProfileSyncComponentsFactoryImpl
: public ProfileSyncComponentsFactory
{
24 ProfileSyncComponentsFactoryImpl(Profile
* profile
,
25 CommandLine
* command_line
);
26 virtual ~ProfileSyncComponentsFactoryImpl();
28 virtual void RegisterDataTypes(ProfileSyncService
* pss
) OVERRIDE
;
30 virtual browser_sync::DataTypeManager
* CreateDataTypeManager(
31 const syncer::WeakHandle
<syncer::DataTypeDebugInfoListener
>&
33 browser_sync::SyncBackendHost
* backend
,
34 const browser_sync::DataTypeController::TypeMap
* controllers
,
35 browser_sync::DataTypeManagerObserver
* observer
) OVERRIDE
;
37 virtual browser_sync::GenericChangeProcessor
* CreateGenericChangeProcessor(
38 ProfileSyncService
* profile_sync_service
,
39 browser_sync::DataTypeErrorHandler
* error_handler
,
40 const base::WeakPtr
<syncer::SyncableService
>& local_service
) OVERRIDE
;
42 virtual browser_sync::SharedChangeProcessor
*
43 CreateSharedChangeProcessor() OVERRIDE
;
45 virtual base::WeakPtr
<syncer::SyncableService
> GetSyncableServiceForType(
46 syncer::ModelType type
) OVERRIDE
;
48 // Legacy datatypes that need to be converted to the SyncableService API.
49 virtual SyncComponents
CreateBookmarkSyncComponents(
50 ProfileSyncService
* profile_sync_service
,
51 browser_sync::DataTypeErrorHandler
* error_handler
) OVERRIDE
;
52 virtual SyncComponents
CreatePasswordSyncComponents(
53 ProfileSyncService
* profile_sync_service
,
54 PasswordStore
* password_store
,
55 browser_sync::DataTypeErrorHandler
* error_handler
) OVERRIDE
;
56 virtual SyncComponents
CreateTypedUrlSyncComponents(
57 ProfileSyncService
* profile_sync_service
,
58 history::HistoryBackend
* history_backend
,
59 browser_sync::DataTypeErrorHandler
* error_handler
) OVERRIDE
;
60 virtual SyncComponents
CreateSessionSyncComponents(
61 ProfileSyncService
* profile_sync_service
,
62 browser_sync::DataTypeErrorHandler
* error_handler
) OVERRIDE
;
65 // Register data types which are enabled on desktop platforms only.
66 void RegisterDesktopDataTypes(ProfileSyncService
* pss
);
67 // Register data types which are enabled on both desktop and mobile.
68 void RegisterCommonDataTypes(ProfileSyncService
* pss
);
71 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
<WebDataService
> web_data_service_
;
78 DISALLOW_COPY_AND_ASSIGN(ProfileSyncComponentsFactoryImpl
);
81 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__