| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__ | 5 #ifndef COMPONENTS_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__ |
| 6 #define COMPONENTS_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__ | 6 #define COMPONENTS_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 class PasswordStore; | 28 class PasswordStore; |
| 29 } | 29 } |
| 30 | 30 |
| 31 namespace net { | 31 namespace net { |
| 32 class URLRequestContextGetter; | 32 class URLRequestContextGetter; |
| 33 } | 33 } |
| 34 | 34 |
| 35 namespace browser_sync { | 35 namespace browser_sync { |
| 36 | 36 |
| 37 class ProfileSyncComponentsFactoryImpl | 37 class ProfileSyncComponentsFactoryImpl |
| 38 : public sync_driver::SyncApiComponentFactory { | 38 : public syncer::SyncApiComponentFactory { |
| 39 public: | 39 public: |
| 40 // Constructs a ProfileSyncComponentsFactoryImpl. | 40 // Constructs a ProfileSyncComponentsFactoryImpl. |
| 41 // | 41 // |
| 42 // |sync_service_url| is the base URL of the sync server. | 42 // |sync_service_url| is the base URL of the sync server. |
| 43 // | 43 // |
| 44 // |token_service| must outlive the ProfileSyncComponentsFactoryImpl. | 44 // |token_service| must outlive the ProfileSyncComponentsFactoryImpl. |
| 45 // | 45 // |
| 46 // |url_request_context_getter| must outlive the | 46 // |url_request_context_getter| must outlive the |
| 47 // ProfileSyncComponentsFactoryImpl. | 47 // ProfileSyncComponentsFactoryImpl. |
| 48 ProfileSyncComponentsFactoryImpl( | 48 ProfileSyncComponentsFactoryImpl( |
| 49 sync_driver::SyncClient* sync_client, | 49 syncer::SyncClient* sync_client, |
| 50 version_info::Channel channel, | 50 version_info::Channel channel, |
| 51 const std::string& version, | 51 const std::string& version, |
| 52 bool is_tablet, | 52 bool is_tablet, |
| 53 const base::CommandLine& command_line, | 53 const base::CommandLine& command_line, |
| 54 const char* history_disabled_pref, | 54 const char* history_disabled_pref, |
| 55 const GURL& sync_service_url, | 55 const GURL& sync_service_url, |
| 56 const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread, | 56 const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread, |
| 57 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread, | 57 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread, |
| 58 OAuth2TokenService* token_service, | 58 OAuth2TokenService* token_service, |
| 59 net::URLRequestContextGetter* url_request_context_getter, | 59 net::URLRequestContextGetter* url_request_context_getter, |
| 60 const scoped_refptr<autofill::AutofillWebDataService>& web_data_service, | 60 const scoped_refptr<autofill::AutofillWebDataService>& web_data_service, |
| 61 const scoped_refptr<password_manager::PasswordStore>& password_store); | 61 const scoped_refptr<password_manager::PasswordStore>& password_store); |
| 62 ~ProfileSyncComponentsFactoryImpl() override; | 62 ~ProfileSyncComponentsFactoryImpl() override; |
| 63 | 63 |
| 64 // SyncApiComponentFactory implementation: | 64 // SyncApiComponentFactory implementation: |
| 65 void RegisterDataTypes( | 65 void RegisterDataTypes( |
| 66 sync_driver::SyncService* sync_service, | 66 syncer::SyncService* sync_service, |
| 67 const RegisterDataTypesMethod& register_platform_types_method) override; | 67 const RegisterDataTypesMethod& register_platform_types_method) override; |
| 68 sync_driver::DataTypeManager* CreateDataTypeManager( | 68 syncer::DataTypeManager* CreateDataTypeManager( |
| 69 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& | 69 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& |
| 70 debug_info_listener, | 70 debug_info_listener, |
| 71 const sync_driver::DataTypeController::TypeMap* controllers, | 71 const syncer::DataTypeController::TypeMap* controllers, |
| 72 const sync_driver::DataTypeEncryptionHandler* encryption_handler, | 72 const syncer::DataTypeEncryptionHandler* encryption_handler, |
| 73 SyncBackendHost* backend, | 73 syncer::SyncBackendHost* backend, |
| 74 sync_driver::DataTypeManagerObserver* observer) override; | 74 syncer::DataTypeManagerObserver* observer) override; |
| 75 SyncBackendHost* CreateSyncBackendHost( | 75 syncer::SyncBackendHost* CreateSyncBackendHost( |
| 76 const std::string& name, | 76 const std::string& name, |
| 77 invalidation::InvalidationService* invalidator, | 77 invalidation::InvalidationService* invalidator, |
| 78 const base::WeakPtr<sync_driver::SyncPrefs>& sync_prefs, | 78 const base::WeakPtr<syncer::SyncPrefs>& sync_prefs, |
| 79 const base::FilePath& sync_folder) override; | 79 const base::FilePath& sync_folder) override; |
| 80 std::unique_ptr<sync_driver::LocalDeviceInfoProvider> | 80 std::unique_ptr<syncer::LocalDeviceInfoProvider> |
| 81 CreateLocalDeviceInfoProvider() override; | 81 CreateLocalDeviceInfoProvider() override; |
| 82 std::unique_ptr<syncer::AttachmentService> CreateAttachmentService( | 82 std::unique_ptr<syncer::AttachmentService> CreateAttachmentService( |
| 83 std::unique_ptr<syncer::AttachmentStoreForSync> attachment_store, | 83 std::unique_ptr<syncer::AttachmentStoreForSync> attachment_store, |
| 84 const syncer::UserShare& user_share, | 84 const syncer::UserShare& user_share, |
| 85 const std::string& store_birthday, | 85 const std::string& store_birthday, |
| 86 syncer::ModelType model_type, | 86 syncer::ModelType model_type, |
| 87 syncer::AttachmentService::Delegate* delegate) override; | 87 syncer::AttachmentService::Delegate* delegate) override; |
| 88 sync_driver::SyncApiComponentFactory::SyncComponents | 88 syncer::SyncApiComponentFactory::SyncComponents CreateBookmarkSyncComponents( |
| 89 CreateBookmarkSyncComponents( | 89 syncer::SyncService* sync_service, |
| 90 sync_driver::SyncService* sync_service, | |
| 91 std::unique_ptr<syncer::DataTypeErrorHandler> error_handler) override; | 90 std::unique_ptr<syncer::DataTypeErrorHandler> error_handler) override; |
| 92 | 91 |
| 93 // Sets a bit that determines whether PREFERENCES should be registered with a | 92 // Sets a bit that determines whether PREFERENCES should be registered with a |
| 94 // ModelTypeController for testing purposes. | 93 // ModelTypeController for testing purposes. |
| 95 static void OverridePrefsForUssTest(bool use_uss); | 94 static void OverridePrefsForUssTest(bool use_uss); |
| 96 | 95 |
| 97 private: | 96 private: |
| 98 // Register data types which are enabled on both desktop and mobile. | 97 // Register data types which are enabled on both desktop and mobile. |
| 99 // |disabled_types| and |enabled_types| correspond only to those types | 98 // |disabled_types| and |enabled_types| correspond only to those types |
| 100 // being explicitly enabled/disabled by the command line. | 99 // being explicitly enabled/disabled by the command line. |
| 101 void RegisterCommonDataTypes(sync_driver::SyncService* sync_service, | 100 void RegisterCommonDataTypes(syncer::SyncService* sync_service, |
| 102 syncer::ModelTypeSet disabled_types, | 101 syncer::ModelTypeSet disabled_types, |
| 103 syncer::ModelTypeSet enabled_types); | 102 syncer::ModelTypeSet enabled_types); |
| 104 | 103 |
| 105 void DisableBrokenType(syncer::ModelType type, | 104 void DisableBrokenType(syncer::ModelType type, |
| 106 const tracked_objects::Location& from_here, | 105 const tracked_objects::Location& from_here, |
| 107 const std::string& message); | 106 const std::string& message); |
| 108 | 107 |
| 109 // Client/platform specific members. | 108 // Client/platform specific members. |
| 110 sync_driver::SyncClient* const sync_client_; | 109 syncer::SyncClient* const sync_client_; |
| 111 const version_info::Channel channel_; | 110 const version_info::Channel channel_; |
| 112 const std::string version_; | 111 const std::string version_; |
| 113 const bool is_tablet_; | 112 const bool is_tablet_; |
| 114 const base::CommandLine command_line_; | 113 const base::CommandLine command_line_; |
| 115 const char* history_disabled_pref_; | 114 const char* history_disabled_pref_; |
| 116 const GURL sync_service_url_; | 115 const GURL sync_service_url_; |
| 117 const scoped_refptr<base::SingleThreadTaskRunner> ui_thread_; | 116 const scoped_refptr<base::SingleThreadTaskRunner> ui_thread_; |
| 118 const scoped_refptr<base::SingleThreadTaskRunner> db_thread_; | 117 const scoped_refptr<base::SingleThreadTaskRunner> db_thread_; |
| 119 OAuth2TokenService* const token_service_; | 118 OAuth2TokenService* const token_service_; |
| 120 net::URLRequestContextGetter* const url_request_context_getter_; | 119 net::URLRequestContextGetter* const url_request_context_getter_; |
| 121 const scoped_refptr<autofill::AutofillWebDataService> web_data_service_; | 120 const scoped_refptr<autofill::AutofillWebDataService> web_data_service_; |
| 122 const scoped_refptr<password_manager::PasswordStore> password_store_; | 121 const scoped_refptr<password_manager::PasswordStore> password_store_; |
| 123 | 122 |
| 124 base::WeakPtrFactory<ProfileSyncComponentsFactoryImpl> weak_factory_; | 123 base::WeakPtrFactory<ProfileSyncComponentsFactoryImpl> weak_factory_; |
| 125 | 124 |
| 126 // Whether to override PREFERENCES to use USS. | 125 // Whether to override PREFERENCES to use USS. |
| 127 static bool override_prefs_controller_to_uss_for_test_; | 126 static bool override_prefs_controller_to_uss_for_test_; |
| 128 | 127 |
| 129 DISALLOW_COPY_AND_ASSIGN(ProfileSyncComponentsFactoryImpl); | 128 DISALLOW_COPY_AND_ASSIGN(ProfileSyncComponentsFactoryImpl); |
| 130 }; | 129 }; |
| 131 | 130 |
| 132 } // namespace browser_sync | 131 } // namespace browser_sync |
| 133 | 132 |
| 134 #endif // COMPONENTS_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__ | 133 #endif // COMPONENTS_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__ |
| OLD | NEW |