Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / sync / profile_sync_components_factory_impl.h
blob0014e0ac9a55bff26dbae3ccb94f2ca126196675
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__
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/memory/weak_ptr.h"
13 #include "chrome/browser/sync/profile_sync_components_factory.h"
14 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
15 #include "google_apis/gaia/oauth2_token_service.h"
16 #include "sync/internal_api/public/base/model_type.h"
18 class Profile;
20 namespace base {
21 class CommandLine;
24 namespace extensions {
25 class ExtensionSystem;
28 class ProfileSyncComponentsFactoryImpl : public ProfileSyncComponentsFactory {
29 public:
30 // Constructs a ProfileSyncComponentsFactoryImpl.
32 // |sync_service_url| is the base URL of the sync server.
34 // |token_service| must outlive the ProfileSyncComponentsFactoryImpl.
36 // |url_request_context_getter| must outlive the
37 // ProfileSyncComponentsFactoryImpl.
38 ProfileSyncComponentsFactoryImpl(
39 Profile* profile,
40 base::CommandLine* command_line,
41 const GURL& sync_service_url,
42 OAuth2TokenService* token_service,
43 net::URLRequestContextGetter* url_request_context_getter);
44 ~ProfileSyncComponentsFactoryImpl() override;
46 void RegisterDataTypes(ProfileSyncService* pss) override;
48 sync_driver::DataTypeManager* CreateDataTypeManager(
49 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>&
50 debug_info_listener,
51 const sync_driver::DataTypeController::TypeMap* controllers,
52 const sync_driver::DataTypeEncryptionHandler* encryption_handler,
53 browser_sync::SyncBackendHost* backend,
54 sync_driver::DataTypeManagerObserver* observer) override;
56 browser_sync::SyncBackendHost* CreateSyncBackendHost(
57 const std::string& name,
58 Profile* profile,
59 invalidation::InvalidationService* invalidator,
60 const base::WeakPtr<sync_driver::SyncPrefs>& sync_prefs,
61 const base::FilePath& sync_folder) override;
63 scoped_ptr<sync_driver::LocalDeviceInfoProvider>
64 CreateLocalDeviceInfoProvider() override;
66 base::WeakPtr<syncer::SyncableService> GetSyncableServiceForType(
67 syncer::ModelType type) override;
68 scoped_ptr<syncer::AttachmentService> CreateAttachmentService(
69 scoped_ptr<syncer::AttachmentStoreForSync> attachment_store,
70 const syncer::UserShare& user_share,
71 const std::string& store_birthday,
72 syncer::ModelType model_type,
73 syncer::AttachmentService::Delegate* delegate) override;
75 // Legacy datatypes that need to be converted to the SyncableService API.
76 SyncComponents CreateBookmarkSyncComponents(
77 ProfileSyncService* profile_sync_service,
78 sync_driver::DataTypeErrorHandler* error_handler) override;
79 SyncComponents CreateTypedUrlSyncComponents(
80 ProfileSyncService* profile_sync_service,
81 history::HistoryBackend* history_backend,
82 sync_driver::DataTypeErrorHandler* error_handler) override;
84 private:
85 // Register data types which are enabled on desktop platforms only.
86 // |disabled_types| and |enabled_types| correspond only to those types
87 // being explicitly enabled/disabled by the command line.
88 void RegisterDesktopDataTypes(syncer::ModelTypeSet disabled_types,
89 syncer::ModelTypeSet enabled_types,
90 ProfileSyncService* pss);
91 // Register data types which are enabled on both desktop and mobile.
92 // |disabled_types| and |enabled_types| correspond only to those types
93 // being explicitly enabled/disabled by the command line.
94 void RegisterCommonDataTypes(syncer::ModelTypeSet disabled_types,
95 syncer::ModelTypeSet enabled_types,
96 ProfileSyncService* pss);
97 // Used to bind a callback to give to DataTypeControllers to disable
98 // data types.
99 sync_driver::DataTypeController::DisableTypeCallback
100 MakeDisableCallbackFor(syncer::ModelType type);
101 void DisableBrokenType(syncer::ModelType type,
102 const tracked_objects::Location& from_here,
103 const std::string& message);
105 Profile* profile_;
106 base::CommandLine* command_line_;
107 scoped_refptr<autofill::AutofillWebDataService> web_data_service_;
109 const GURL sync_service_url_;
110 OAuth2TokenService* const token_service_;
111 net::URLRequestContextGetter* const url_request_context_getter_;
113 base::WeakPtrFactory<ProfileSyncComponentsFactoryImpl> weak_factory_;
115 DISALLOW_COPY_AND_ASSIGN(ProfileSyncComponentsFactoryImpl);
118 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__