Update CrOS OOBE throbber to MD throbber; delete old asset
[chromium-blink-merge.git] / chrome / browser / sync / profile_sync_components_factory_impl.h
blobbb086e87939bf3c1b624655a5724152229b2e2b5
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/chrome_sync_client.h"
14 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
15 #include "components/sync_driver/profile_sync_components_factory.h"
16 #include "google_apis/gaia/oauth2_token_service.h"
17 #include "sync/internal_api/public/base/model_type.h"
19 class Profile;
21 namespace base {
22 class CommandLine;
25 namespace extensions {
26 class ExtensionSystem;
29 class ProfileSyncComponentsFactoryImpl : public ProfileSyncComponentsFactory {
30 public:
31 // Constructs a ProfileSyncComponentsFactoryImpl.
33 // |sync_service_url| is the base URL of the sync server.
35 // |token_service| must outlive the ProfileSyncComponentsFactoryImpl.
37 // |url_request_context_getter| must outlive the
38 // ProfileSyncComponentsFactoryImpl.
39 ProfileSyncComponentsFactoryImpl(
40 Profile* profile,
41 base::CommandLine* command_line,
42 const GURL& sync_service_url,
43 OAuth2TokenService* token_service,
44 net::URLRequestContextGetter* url_request_context_getter);
45 ~ProfileSyncComponentsFactoryImpl() override;
47 void RegisterDataTypes(ProfileSyncService* pss) override;
49 sync_driver::DataTypeManager* CreateDataTypeManager(
50 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>&
51 debug_info_listener,
52 const sync_driver::DataTypeController::TypeMap* controllers,
53 const sync_driver::DataTypeEncryptionHandler* encryption_handler,
54 browser_sync::SyncBackendHost* backend,
55 sync_driver::DataTypeManagerObserver* observer) override;
57 browser_sync::SyncBackendHost* CreateSyncBackendHost(
58 const std::string& name,
59 Profile* profile,
60 invalidation::InvalidationService* invalidator,
61 const base::WeakPtr<sync_driver::SyncPrefs>& sync_prefs,
62 const base::FilePath& sync_folder) override;
64 scoped_ptr<sync_driver::LocalDeviceInfoProvider>
65 CreateLocalDeviceInfoProvider() override;
67 // TODO(zea): crbug.com/512768 Remove GetSyncableServiceForType from
68 // ProfileSyncComponentsFactory and have everything use the SyncClient
69 // instead.
70 base::WeakPtr<syncer::SyncableService> GetSyncableServiceForType(
71 syncer::ModelType type) override;
72 scoped_ptr<syncer::AttachmentService> CreateAttachmentService(
73 scoped_ptr<syncer::AttachmentStoreForSync> attachment_store,
74 const syncer::UserShare& user_share,
75 const std::string& store_birthday,
76 syncer::ModelType model_type,
77 syncer::AttachmentService::Delegate* delegate) override;
79 // Legacy datatypes that need to be converted to the SyncableService API.
80 SyncComponents CreateBookmarkSyncComponents(
81 ProfileSyncService* profile_sync_service,
82 sync_driver::DataTypeErrorHandler* error_handler) override;
83 SyncComponents CreateTypedUrlSyncComponents(
84 ProfileSyncService* profile_sync_service,
85 history::HistoryBackend* history_backend,
86 sync_driver::DataTypeErrorHandler* error_handler) override;
88 private:
89 // Register data types which are enabled on desktop platforms only.
90 // |disabled_types| and |enabled_types| correspond only to those types
91 // being explicitly enabled/disabled by the command line.
92 void RegisterDesktopDataTypes(syncer::ModelTypeSet disabled_types,
93 syncer::ModelTypeSet enabled_types,
94 ProfileSyncService* pss);
95 // Register data types which are enabled on both desktop and mobile.
96 // |disabled_types| and |enabled_types| correspond only to those types
97 // being explicitly enabled/disabled by the command line.
98 void RegisterCommonDataTypes(syncer::ModelTypeSet disabled_types,
99 syncer::ModelTypeSet enabled_types,
100 ProfileSyncService* pss);
101 // Used to bind a callback to give to DataTypeControllers to disable
102 // data types.
103 sync_driver::DataTypeController::DisableTypeCallback
104 MakeDisableCallbackFor(syncer::ModelType type);
105 void DisableBrokenType(syncer::ModelType type,
106 const tracked_objects::Location& from_here,
107 const std::string& message);
109 Profile* profile_;
110 base::CommandLine* command_line_;
111 scoped_refptr<autofill::AutofillWebDataService> web_data_service_;
113 const GURL sync_service_url_;
114 OAuth2TokenService* const token_service_;
115 net::URLRequestContextGetter* const url_request_context_getter_;
117 // Chrome specific implementation of SyncClient.
118 browser_sync::ChromeSyncClient chrome_sync_client_;
120 base::WeakPtrFactory<ProfileSyncComponentsFactoryImpl> weak_factory_;
122 DISALLOW_COPY_AND_ASSIGN(ProfileSyncComponentsFactoryImpl);
125 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__