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 #include "components/browser_sync/profile_sync_components_factory_impl.h" | 5 #include "components/browser_sync/profile_sync_components_factory_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/debug/dump_without_crashing.h" | 9 #include "base/debug/dump_without_crashing.h" |
10 #include "base/feature_list.h" | 10 #include "base/feature_list.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "components/dom_distiller/core/dom_distiller_features.h" | 22 #include "components/dom_distiller/core/dom_distiller_features.h" |
23 #include "components/history/core/browser/history_delete_directives_data_type_co
ntroller.h" | 23 #include "components/history/core/browser/history_delete_directives_data_type_co
ntroller.h" |
24 #include "components/history/core/browser/typed_url_data_type_controller.h" | 24 #include "components/history/core/browser/typed_url_data_type_controller.h" |
25 #include "components/password_manager/core/browser/password_store.h" | 25 #include "components/password_manager/core/browser/password_store.h" |
26 #include "components/password_manager/sync/browser/password_data_type_controller
.h" | 26 #include "components/password_manager/sync/browser/password_data_type_controller
.h" |
27 #include "components/prefs/pref_service.h" | 27 #include "components/prefs/pref_service.h" |
28 #include "components/reading_list/core/reading_list_switches.h" | 28 #include "components/reading_list/core/reading_list_switches.h" |
29 #include "components/sync/base/report_unrecoverable_error.h" | 29 #include "components/sync/base/report_unrecoverable_error.h" |
30 #include "components/sync/device_info/device_info_data_type_controller.h" | 30 #include "components/sync/device_info/device_info_data_type_controller.h" |
31 #include "components/sync/device_info/local_device_info_provider_impl.h" | 31 #include "components/sync/device_info/local_device_info_provider_impl.h" |
| 32 #include "components/sync/driver/async_directory_type_controller.h" |
32 #include "components/sync/driver/data_type_manager_impl.h" | 33 #include "components/sync/driver/data_type_manager_impl.h" |
33 #include "components/sync/driver/glue/sync_backend_host_impl.h" | 34 #include "components/sync/driver/glue/sync_backend_host_impl.h" |
34 #include "components/sync/driver/model_type_controller.h" | 35 #include "components/sync/driver/model_type_controller.h" |
35 #include "components/sync/driver/non_ui_data_type_controller.h" | |
36 #include "components/sync/driver/proxy_data_type_controller.h" | 36 #include "components/sync/driver/proxy_data_type_controller.h" |
37 #include "components/sync/driver/sync_client.h" | 37 #include "components/sync/driver/sync_client.h" |
38 #include "components/sync/driver/sync_driver_switches.h" | 38 #include "components/sync/driver/sync_driver_switches.h" |
39 #include "components/sync/engine/attachments/attachment_downloader.h" | 39 #include "components/sync/engine/attachments/attachment_downloader.h" |
40 #include "components/sync/engine/attachments/attachment_uploader.h" | 40 #include "components/sync/engine/attachments/attachment_uploader.h" |
41 #include "components/sync/engine/sync_engine.h" | 41 #include "components/sync/engine/sync_engine.h" |
42 #include "components/sync/model/attachments/attachment_service.h" | 42 #include "components/sync/model/attachments/attachment_service.h" |
43 #include "components/sync_bookmarks/bookmark_change_processor.h" | 43 #include "components/sync_bookmarks/bookmark_change_processor.h" |
44 #include "components/sync_bookmarks/bookmark_data_type_controller.h" | 44 #include "components/sync_bookmarks/bookmark_data_type_controller.h" |
45 #include "components/sync_bookmarks/bookmark_model_associator.h" | 45 #include "components/sync_bookmarks/bookmark_model_associator.h" |
46 #include "components/sync_sessions/session_data_type_controller.h" | 46 #include "components/sync_sessions/session_data_type_controller.h" |
47 #include "google_apis/gaia/oauth2_token_service.h" | 47 #include "google_apis/gaia/oauth2_token_service.h" |
48 #include "google_apis/gaia/oauth2_token_service_request.h" | 48 #include "google_apis/gaia/oauth2_token_service_request.h" |
49 #include "net/url_request/url_request_context_getter.h" | 49 #include "net/url_request/url_request_context_getter.h" |
50 | 50 |
51 using bookmarks::BookmarkModel; | 51 using bookmarks::BookmarkModel; |
52 using sync_bookmarks::BookmarkChangeProcessor; | 52 using sync_bookmarks::BookmarkChangeProcessor; |
53 using sync_bookmarks::BookmarkDataTypeController; | 53 using sync_bookmarks::BookmarkDataTypeController; |
54 using sync_bookmarks::BookmarkModelAssociator; | 54 using sync_bookmarks::BookmarkModelAssociator; |
55 using syncer::DataTypeController; | 55 using syncer::DataTypeController; |
56 using syncer::DataTypeManager; | 56 using syncer::DataTypeManager; |
57 using syncer::DataTypeManagerImpl; | 57 using syncer::DataTypeManagerImpl; |
58 using syncer::DataTypeManagerObserver; | 58 using syncer::DataTypeManagerObserver; |
59 using syncer::DeviceInfoDataTypeController; | 59 using syncer::DeviceInfoDataTypeController; |
60 using syncer::ProxyDataTypeController; | 60 using syncer::ProxyDataTypeController; |
61 using syncer::ModelTypeController; | 61 using syncer::ModelTypeController; |
62 using syncer::NonUIDataTypeController; | 62 using syncer::AsyncDirectoryTypeController; |
63 using sync_sessions::SessionDataTypeController; | 63 using sync_sessions::SessionDataTypeController; |
64 | 64 |
65 namespace browser_sync { | 65 namespace browser_sync { |
66 | 66 |
67 namespace { | 67 namespace { |
68 | 68 |
69 syncer::ModelTypeSet GetDisabledTypesFromCommandLine( | 69 syncer::ModelTypeSet GetDisabledTypesFromCommandLine( |
70 const base::CommandLine& command_line) { | 70 const base::CommandLine& command_line) { |
71 syncer::ModelTypeSet disabled_types; | 71 syncer::ModelTypeSet disabled_types; |
72 std::string disabled_types_str = | 72 std::string disabled_types_str = |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 error_callback, sync_client_, | 233 error_callback, sync_client_, |
234 sync_service->GetLocalDeviceInfoProvider(), | 234 sync_service->GetLocalDeviceInfoProvider(), |
235 history_disabled_pref_)); | 235 history_disabled_pref_)); |
236 } | 236 } |
237 | 237 |
238 // Favicon sync is enabled by default. Register unless explicitly disabled. | 238 // Favicon sync is enabled by default. Register unless explicitly disabled. |
239 if (!disabled_types.Has(syncer::FAVICON_IMAGES) && | 239 if (!disabled_types.Has(syncer::FAVICON_IMAGES) && |
240 !disabled_types.Has(syncer::FAVICON_TRACKING) && !history_disabled) { | 240 !disabled_types.Has(syncer::FAVICON_TRACKING) && !history_disabled) { |
241 // crbug/384552. We disable error uploading for this data types for now. | 241 // crbug/384552. We disable error uploading for this data types for now. |
242 sync_service->RegisterDataTypeController( | 242 sync_service->RegisterDataTypeController( |
243 base::MakeUnique<NonUIDataTypeController>( | 243 base::MakeUnique<AsyncDirectoryTypeController>( |
244 syncer::FAVICON_IMAGES, base::Closure(), sync_client_, | 244 syncer::FAVICON_IMAGES, base::Closure(), sync_client_, |
245 syncer::GROUP_UI, ui_thread_)); | 245 syncer::GROUP_UI, ui_thread_)); |
246 sync_service->RegisterDataTypeController( | 246 sync_service->RegisterDataTypeController( |
247 base::MakeUnique<NonUIDataTypeController>( | 247 base::MakeUnique<AsyncDirectoryTypeController>( |
248 syncer::FAVICON_TRACKING, base::Closure(), sync_client_, | 248 syncer::FAVICON_TRACKING, base::Closure(), sync_client_, |
249 syncer::GROUP_UI, ui_thread_)); | 249 syncer::GROUP_UI, ui_thread_)); |
250 } | 250 } |
251 | 251 |
252 // Password sync is enabled by default. Register unless explicitly | 252 // Password sync is enabled by default. Register unless explicitly |
253 // disabled. | 253 // disabled. |
254 if (!disabled_types.Has(syncer::PASSWORDS)) { | 254 if (!disabled_types.Has(syncer::PASSWORDS)) { |
255 sync_service->RegisterDataTypeController( | 255 sync_service->RegisterDataTypeController( |
256 base::MakeUnique<PasswordDataTypeController>( | 256 base::MakeUnique<PasswordDataTypeController>( |
257 error_callback, sync_client_, | 257 error_callback, sync_client_, |
258 sync_client_->GetPasswordStateChangedCallback(), password_store_)); | 258 sync_client_->GetPasswordStateChangedCallback(), password_store_)); |
259 } | 259 } |
260 | 260 |
261 if (!disabled_types.Has(syncer::PREFERENCES)) { | 261 if (!disabled_types.Has(syncer::PREFERENCES)) { |
262 if (!override_prefs_controller_to_uss_for_test_) { | 262 if (!override_prefs_controller_to_uss_for_test_) { |
263 sync_service->RegisterDataTypeController( | 263 sync_service->RegisterDataTypeController( |
264 base::MakeUnique<NonUIDataTypeController>( | 264 base::MakeUnique<AsyncDirectoryTypeController>( |
265 syncer::PREFERENCES, error_callback, sync_client_, | 265 syncer::PREFERENCES, error_callback, sync_client_, |
266 syncer::GROUP_UI, ui_thread_)); | 266 syncer::GROUP_UI, ui_thread_)); |
267 } else { | 267 } else { |
268 sync_service->RegisterDataTypeController( | 268 sync_service->RegisterDataTypeController( |
269 base::MakeUnique<ModelTypeController>( | 269 base::MakeUnique<ModelTypeController>( |
270 syncer::PREFERENCES, error_callback, sync_client_, ui_thread_)); | 270 syncer::PREFERENCES, error_callback, sync_client_, ui_thread_)); |
271 } | 271 } |
272 } | 272 } |
273 | 273 |
274 if (!disabled_types.Has(syncer::PRIORITY_PREFERENCES)) { | 274 if (!disabled_types.Has(syncer::PRIORITY_PREFERENCES)) { |
275 sync_service->RegisterDataTypeController( | 275 sync_service->RegisterDataTypeController( |
276 base::MakeUnique<NonUIDataTypeController>( | 276 base::MakeUnique<AsyncDirectoryTypeController>( |
277 syncer::PRIORITY_PREFERENCES, error_callback, sync_client_, | 277 syncer::PRIORITY_PREFERENCES, error_callback, sync_client_, |
278 syncer::GROUP_UI, ui_thread_)); | 278 syncer::GROUP_UI, ui_thread_)); |
279 } | 279 } |
280 | 280 |
281 // Article sync is disabled by default. Register only if explicitly enabled. | 281 // Article sync is disabled by default. Register only if explicitly enabled. |
282 if (dom_distiller::IsEnableSyncArticlesSet()) { | 282 if (dom_distiller::IsEnableSyncArticlesSet()) { |
283 sync_service->RegisterDataTypeController( | 283 sync_service->RegisterDataTypeController( |
284 base::MakeUnique<NonUIDataTypeController>( | 284 base::MakeUnique<AsyncDirectoryTypeController>( |
285 syncer::ARTICLES, error_callback, sync_client_, syncer::GROUP_UI, | 285 syncer::ARTICLES, error_callback, sync_client_, syncer::GROUP_UI, |
286 ui_thread_)); | 286 ui_thread_)); |
287 } | 287 } |
288 | 288 |
289 // Reading list sync is enabled by default only on iOS. Register unless | 289 // Reading list sync is enabled by default only on iOS. Register unless |
290 // Reading List or Reading List Sync is explicitly disabled. | 290 // Reading List or Reading List Sync is explicitly disabled. |
291 if (!disabled_types.Has(syncer::READING_LIST) && | 291 if (!disabled_types.Has(syncer::READING_LIST) && |
292 reading_list::switches::IsReadingListEnabled()) { | 292 reading_list::switches::IsReadingListEnabled()) { |
293 sync_service->RegisterDataTypeController( | 293 sync_service->RegisterDataTypeController( |
294 base::MakeUnique<ModelTypeController>( | 294 base::MakeUnique<ModelTypeController>( |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 | 429 |
430 // static | 430 // static |
431 void ProfileSyncComponentsFactoryImpl::OverridePrefsForUssTest(bool use_uss) { | 431 void ProfileSyncComponentsFactoryImpl::OverridePrefsForUssTest(bool use_uss) { |
432 override_prefs_controller_to_uss_for_test_ = use_uss; | 432 override_prefs_controller_to_uss_for_test_ = use_uss; |
433 } | 433 } |
434 | 434 |
435 bool ProfileSyncComponentsFactoryImpl:: | 435 bool ProfileSyncComponentsFactoryImpl:: |
436 override_prefs_controller_to_uss_for_test_ = false; | 436 override_prefs_controller_to_uss_for_test_ = false; |
437 | 437 |
438 } // namespace browser_sync | 438 } // namespace browser_sync |
OLD | NEW |