Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: components/browser_sync/profile_sync_components_factory_impl.cc

Issue 2511703004: [Sync] Remove UIDataTypeController (Closed)
Patch Set: Fix integration test issue. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/threading/thread_task_runner_handle.h"
14 #include "build/build_config.h" 13 #include "build/build_config.h"
15 #include "components/autofill/core/browser/autofill_wallet_data_type_controller. h" 14 #include "components/autofill/core/browser/autofill_wallet_data_type_controller. h"
16 #include "components/autofill/core/browser/webdata/autofill_data_type_controller .h" 15 #include "components/autofill/core/browser/webdata/autofill_data_type_controller .h"
17 #include "components/autofill/core/browser/webdata/autofill_profile_data_type_co ntroller.h" 16 #include "components/autofill/core/browser/webdata/autofill_profile_data_type_co ntroller.h"
18 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" 17 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
19 #include "components/autofill/core/common/autofill_pref_names.h" 18 #include "components/autofill/core/common/autofill_pref_names.h"
20 #include "components/autofill/core/common/autofill_switches.h" 19 #include "components/autofill/core/common/autofill_switches.h"
21 #include "components/browser_sync/browser_sync_switches.h" 20 #include "components/browser_sync/browser_sync_switches.h"
22 #include "components/browser_sync/profile_sync_service.h" 21 #include "components/browser_sync/profile_sync_service.h"
23 #include "components/dom_distiller/core/dom_distiller_features.h" 22 #include "components/dom_distiller/core/dom_distiller_features.h"
24 #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"
25 #include "components/history/core/browser/typed_url_data_type_controller.h" 24 #include "components/history/core/browser/typed_url_data_type_controller.h"
26 #include "components/password_manager/core/browser/password_store.h" 25 #include "components/password_manager/core/browser/password_store.h"
27 #include "components/password_manager/sync/browser/password_data_type_controller .h" 26 #include "components/password_manager/sync/browser/password_data_type_controller .h"
28 #include "components/prefs/pref_service.h" 27 #include "components/prefs/pref_service.h"
29 #include "components/sync/base/report_unrecoverable_error.h" 28 #include "components/sync/base/report_unrecoverable_error.h"
30 #include "components/sync/device_info/device_info_data_type_controller.h" 29 #include "components/sync/device_info/device_info_data_type_controller.h"
31 #include "components/sync/device_info/local_device_info_provider_impl.h" 30 #include "components/sync/device_info/local_device_info_provider_impl.h"
32 #include "components/sync/driver/data_type_manager_impl.h" 31 #include "components/sync/driver/data_type_manager_impl.h"
33 #include "components/sync/driver/glue/sync_backend_host.h" 32 #include "components/sync/driver/glue/sync_backend_host.h"
34 #include "components/sync/driver/glue/sync_backend_host_impl.h" 33 #include "components/sync/driver/glue/sync_backend_host_impl.h"
35 #include "components/sync/driver/model_type_controller.h" 34 #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/driver/ui_data_type_controller.h"
40 #include "components/sync/engine/attachments/attachment_downloader.h" 39 #include "components/sync/engine/attachments/attachment_downloader.h"
41 #include "components/sync/engine/attachments/attachment_uploader.h" 40 #include "components/sync/engine/attachments/attachment_uploader.h"
42 #include "components/sync/model/attachments/attachment_service.h" 41 #include "components/sync/model/attachments/attachment_service.h"
43 #include "components/sync_bookmarks/bookmark_change_processor.h" 42 #include "components/sync_bookmarks/bookmark_change_processor.h"
44 #include "components/sync_bookmarks/bookmark_data_type_controller.h" 43 #include "components/sync_bookmarks/bookmark_data_type_controller.h"
45 #include "components/sync_bookmarks/bookmark_model_associator.h" 44 #include "components/sync_bookmarks/bookmark_model_associator.h"
46 #include "components/sync_sessions/session_data_type_controller.h" 45 #include "components/sync_sessions/session_data_type_controller.h"
47 #include "google_apis/gaia/oauth2_token_service.h" 46 #include "google_apis/gaia/oauth2_token_service.h"
48 #include "google_apis/gaia/oauth2_token_service_request.h" 47 #include "google_apis/gaia/oauth2_token_service_request.h"
49 #include "net/url_request/url_request_context_getter.h" 48 #include "net/url_request/url_request_context_getter.h"
50 49
51 using bookmarks::BookmarkModel; 50 using bookmarks::BookmarkModel;
52 using sync_bookmarks::BookmarkChangeProcessor; 51 using sync_bookmarks::BookmarkChangeProcessor;
53 using sync_bookmarks::BookmarkDataTypeController; 52 using sync_bookmarks::BookmarkDataTypeController;
54 using sync_bookmarks::BookmarkModelAssociator; 53 using sync_bookmarks::BookmarkModelAssociator;
55 using syncer::DataTypeController; 54 using syncer::DataTypeController;
56 using syncer::DataTypeManager; 55 using syncer::DataTypeManager;
57 using syncer::DataTypeManagerImpl; 56 using syncer::DataTypeManagerImpl;
58 using syncer::DataTypeManagerObserver; 57 using syncer::DataTypeManagerObserver;
59 using syncer::DeviceInfoDataTypeController; 58 using syncer::DeviceInfoDataTypeController;
60 using syncer::ProxyDataTypeController; 59 using syncer::ProxyDataTypeController;
61 using syncer::UIDataTypeController; 60 using syncer::NonUIDataTypeController;
maxbogue 2016/11/21 21:44:23 Move below ModelTypeController.
pavely 2016/11/22 00:53:51 Done.
62 using syncer::ModelTypeController; 61 using syncer::ModelTypeController;
63 using sync_sessions::SessionDataTypeController; 62 using sync_sessions::SessionDataTypeController;
64 63
65 namespace browser_sync { 64 namespace browser_sync {
66 65
67 namespace { 66 namespace {
68 67
69 syncer::ModelTypeSet GetDisabledTypesFromCommandLine( 68 syncer::ModelTypeSet GetDisabledTypesFromCommandLine(
70 const base::CommandLine& command_line) { 69 const base::CommandLine& command_line) {
71 syncer::ModelTypeSet disabled_types; 70 syncer::ModelTypeSet disabled_types;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 base::Closure error_callback = 136 base::Closure error_callback =
138 base::Bind(&syncer::ReportUnrecoverableError, channel_); 137 base::Bind(&syncer::ReportUnrecoverableError, channel_);
139 138
140 // TODO(stanisc): can DEVICE_INFO be one of disabled datatypes? 139 // TODO(stanisc): can DEVICE_INFO be one of disabled datatypes?
141 if (base::FeatureList::IsEnabled(switches::kSyncUSSDeviceInfo)) { 140 if (base::FeatureList::IsEnabled(switches::kSyncUSSDeviceInfo)) {
142 // Use an error callback that always uploads a stacktrace if it can to help 141 // Use an error callback that always uploads a stacktrace if it can to help
143 // get USS as stable as possible. 142 // get USS as stable as possible.
144 sync_service->RegisterDataTypeController( 143 sync_service->RegisterDataTypeController(
145 base::MakeUnique<ModelTypeController>( 144 base::MakeUnique<ModelTypeController>(
146 syncer::DEVICE_INFO, base::Bind(&base::debug::DumpWithoutCrashing), 145 syncer::DEVICE_INFO, base::Bind(&base::debug::DumpWithoutCrashing),
147 sync_client_, base::ThreadTaskRunnerHandle::Get())); 146 sync_client_, ui_thread_));
148 } else { 147 } else {
149 sync_service->RegisterDataTypeController( 148 sync_service->RegisterDataTypeController(
150 base::MakeUnique<DeviceInfoDataTypeController>( 149 base::MakeUnique<DeviceInfoDataTypeController>(
151 error_callback, sync_client_, 150 error_callback, sync_client_,
152 sync_service->GetLocalDeviceInfoProvider())); 151 sync_service->GetLocalDeviceInfoProvider()));
153 } 152 }
154 153
155 // Autofill sync is enabled by default. Register unless explicitly 154 // Autofill sync is enabled by default. Register unless explicitly
156 // disabled. 155 // disabled.
157 if (!disabled_types.Has(syncer::AUTOFILL)) { 156 if (!disabled_types.Has(syncer::AUTOFILL)) {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 error_callback, sync_client_, 225 error_callback, sync_client_,
227 sync_service->GetLocalDeviceInfoProvider(), 226 sync_service->GetLocalDeviceInfoProvider(),
228 history_disabled_pref_)); 227 history_disabled_pref_));
229 } 228 }
230 229
231 // Favicon sync is enabled by default. Register unless explicitly disabled. 230 // Favicon sync is enabled by default. Register unless explicitly disabled.
232 if (!disabled_types.Has(syncer::FAVICON_IMAGES) && 231 if (!disabled_types.Has(syncer::FAVICON_IMAGES) &&
233 !disabled_types.Has(syncer::FAVICON_TRACKING) && !history_disabled) { 232 !disabled_types.Has(syncer::FAVICON_TRACKING) && !history_disabled) {
234 // crbug/384552. We disable error uploading for this data types for now. 233 // crbug/384552. We disable error uploading for this data types for now.
235 sync_service->RegisterDataTypeController( 234 sync_service->RegisterDataTypeController(
236 base::MakeUnique<UIDataTypeController>(syncer::FAVICON_IMAGES, 235 base::MakeUnique<NonUIDataTypeController>(
237 base::Closure(), sync_client_)); 236 syncer::FAVICON_IMAGES, base::Closure(), sync_client_,
237 syncer::GROUP_UI, ui_thread_));
238 sync_service->RegisterDataTypeController( 238 sync_service->RegisterDataTypeController(
239 base::MakeUnique<UIDataTypeController>(syncer::FAVICON_TRACKING, 239 base::MakeUnique<NonUIDataTypeController>(
240 base::Closure(), sync_client_)); 240 syncer::FAVICON_TRACKING, base::Closure(), sync_client_,
241 syncer::GROUP_UI, ui_thread_));
241 } 242 }
242 243
243 // Password sync is enabled by default. Register unless explicitly 244 // Password sync is enabled by default. Register unless explicitly
244 // disabled. 245 // disabled.
245 if (!disabled_types.Has(syncer::PASSWORDS)) { 246 if (!disabled_types.Has(syncer::PASSWORDS)) {
246 sync_service->RegisterDataTypeController( 247 sync_service->RegisterDataTypeController(
247 base::MakeUnique<PasswordDataTypeController>( 248 base::MakeUnique<PasswordDataTypeController>(
248 error_callback, sync_client_, 249 error_callback, sync_client_,
249 sync_client_->GetPasswordStateChangedCallback(), password_store_)); 250 sync_client_->GetPasswordStateChangedCallback(), password_store_));
250 } 251 }
251 252
252 if (!disabled_types.Has(syncer::PREFERENCES)) { 253 if (!disabled_types.Has(syncer::PREFERENCES)) {
253 if (!override_prefs_controller_to_uss_for_test_) { 254 if (!override_prefs_controller_to_uss_for_test_) {
254 sync_service->RegisterDataTypeController( 255 sync_service->RegisterDataTypeController(
255 base::MakeUnique<UIDataTypeController>(syncer::PREFERENCES, 256 base::MakeUnique<NonUIDataTypeController>(
256 error_callback, sync_client_)); 257 syncer::PREFERENCES, error_callback, sync_client_,
258 syncer::GROUP_UI, ui_thread_));
257 } else { 259 } else {
258 sync_service->RegisterDataTypeController( 260 sync_service->RegisterDataTypeController(
259 base::MakeUnique<ModelTypeController>( 261 base::MakeUnique<ModelTypeController>(
260 syncer::PREFERENCES, error_callback, sync_client_, 262 syncer::PREFERENCES, error_callback, sync_client_, ui_thread_));
261 base::ThreadTaskRunnerHandle::Get()));
262 } 263 }
263 } 264 }
264 265
265 if (!disabled_types.Has(syncer::PRIORITY_PREFERENCES)) { 266 if (!disabled_types.Has(syncer::PRIORITY_PREFERENCES)) {
266 sync_service->RegisterDataTypeController( 267 sync_service->RegisterDataTypeController(
267 base::MakeUnique<UIDataTypeController>(syncer::PRIORITY_PREFERENCES, 268 base::MakeUnique<NonUIDataTypeController>(
268 error_callback, sync_client_)); 269 syncer::PRIORITY_PREFERENCES, error_callback, sync_client_,
270 syncer::GROUP_UI, ui_thread_));
269 } 271 }
270 272
271 // Article sync is disabled by default. Register only if explicitly enabled. 273 // Article sync is disabled by default. Register only if explicitly enabled.
272 if (dom_distiller::IsEnableSyncArticlesSet()) { 274 if (dom_distiller::IsEnableSyncArticlesSet()) {
273 sync_service->RegisterDataTypeController( 275 sync_service->RegisterDataTypeController(
274 base::MakeUnique<UIDataTypeController>(syncer::ARTICLES, error_callback, 276 base::MakeUnique<NonUIDataTypeController>(
275 sync_client_)); 277 syncer::ARTICLES, error_callback, sync_client_, syncer::GROUP_UI,
278 ui_thread_));
276 } 279 }
277 // Reading list sync is disabled by default. Register only if explicitly 280 // Reading list sync is disabled by default. Register only if explicitly
278 // enabled. 281 // enabled.
279 if (enabled_types.Has(syncer::READING_LIST)) { 282 if (enabled_types.Has(syncer::READING_LIST)) {
280 sync_service->RegisterDataTypeController( 283 sync_service->RegisterDataTypeController(
281 base::MakeUnique<ModelTypeController>( 284 base::MakeUnique<ModelTypeController>(
282 syncer::READING_LIST, error_callback, sync_client_, 285 syncer::READING_LIST, error_callback, sync_client_, ui_thread_));
283 base::ThreadTaskRunnerHandle::Get()));
284 } 286 }
285 } 287 }
286 288
287 DataTypeManager* ProfileSyncComponentsFactoryImpl::CreateDataTypeManager( 289 DataTypeManager* ProfileSyncComponentsFactoryImpl::CreateDataTypeManager(
288 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& 290 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>&
289 debug_info_listener, 291 debug_info_listener,
290 const DataTypeController::TypeMap* controllers, 292 const DataTypeController::TypeMap* controllers,
291 const syncer::DataTypeEncryptionHandler* encryption_handler, 293 const syncer::DataTypeEncryptionHandler* encryption_handler,
292 syncer::SyncBackendHost* backend, 294 syncer::SyncBackendHost* backend,
293 DataTypeManagerObserver* observer) { 295 DataTypeManagerObserver* observer) {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 420
419 // static 421 // static
420 void ProfileSyncComponentsFactoryImpl::OverridePrefsForUssTest(bool use_uss) { 422 void ProfileSyncComponentsFactoryImpl::OverridePrefsForUssTest(bool use_uss) {
421 override_prefs_controller_to_uss_for_test_ = use_uss; 423 override_prefs_controller_to_uss_for_test_ = use_uss;
422 } 424 }
423 425
424 bool ProfileSyncComponentsFactoryImpl:: 426 bool ProfileSyncComponentsFactoryImpl::
425 override_prefs_controller_to_uss_for_test_ = false; 427 override_prefs_controller_to_uss_for_test_ = false;
426 428
427 } // namespace browser_sync 429 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698