Upstream version 6.35.121.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / sync / profile_sync_components_factory_impl.h
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.
4
5 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__
6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__
7
8 #include <string>
9
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"
14
15 class Profile;
16
17 namespace base {
18 class CommandLine;
19 }
20
21 namespace extensions {
22 class ExtensionSystem;
23 }
24
25 class ProfileSyncComponentsFactoryImpl : public ProfileSyncComponentsFactory {
26  public:
27   ProfileSyncComponentsFactoryImpl(Profile* profile,
28                                    base::CommandLine* command_line);
29   virtual ~ProfileSyncComponentsFactoryImpl();
30
31   virtual void RegisterDataTypes(ProfileSyncService* pss) OVERRIDE;
32
33   virtual browser_sync::DataTypeManager* CreateDataTypeManager(
34       const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>&
35           debug_info_listener,
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)
41           OVERRIDE;
42
43   virtual browser_sync::SyncBackendHost* CreateSyncBackendHost(
44       const std::string& name,
45       Profile* profile,
46       const base::WeakPtr<sync_driver::SyncPrefs>& sync_prefs) OVERRIDE;
47
48   virtual browser_sync::GenericChangeProcessor* CreateGenericChangeProcessor(
49       ProfileSyncService* profile_sync_service,
50       browser_sync::DataTypeErrorHandler* error_handler,
51       const base::WeakPtr<syncer::SyncableService>& local_service,
52       const base::WeakPtr<syncer::SyncMergeResult>& merge_result) OVERRIDE;
53
54   virtual browser_sync::SharedChangeProcessor*
55       CreateSharedChangeProcessor() OVERRIDE;
56
57   virtual base::WeakPtr<syncer::SyncableService> GetSyncableServiceForType(
58       syncer::ModelType type) OVERRIDE;
59
60   // Legacy datatypes that need to be converted to the SyncableService API.
61   virtual SyncComponents CreateBookmarkSyncComponents(
62       ProfileSyncService* profile_sync_service,
63       browser_sync::DataTypeErrorHandler* error_handler) OVERRIDE;
64   virtual SyncComponents CreateTypedUrlSyncComponents(
65       ProfileSyncService* profile_sync_service,
66       history::HistoryBackend* history_backend,
67       browser_sync::DataTypeErrorHandler* error_handler) OVERRIDE;
68   virtual SyncComponents CreateSessionSyncComponents(
69       ProfileSyncService* profile_sync_service,
70       browser_sync::DataTypeErrorHandler* error_handler) OVERRIDE;
71
72  private:
73   // Register data types which are enabled on desktop platforms only.
74   void RegisterDesktopDataTypes(syncer::ModelTypeSet disabled_types,
75                                 ProfileSyncService* pss);
76   // Register data types which are enabled on both desktop and mobile.
77   void RegisterCommonDataTypes(syncer::ModelTypeSet disabled_types,
78                                ProfileSyncService* pss);
79
80   Profile* profile_;
81   base::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_;
87
88   DISALLOW_COPY_AND_ASSIGN(ProfileSyncComponentsFactoryImpl);
89 };
90
91 #endif  // CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__