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

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

Issue 2384153004: [Sync] Merge NBDTC and subclasses into ModelTypeController. (Closed)
Patch Set: Fix bad rebase. Created 4 years, 2 months 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
« no previous file with comments | « no previous file | components/sync/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
13 #include "build/build_config.h" 14 #include "build/build_config.h"
14 #include "components/autofill/core/browser/autofill_wallet_data_type_controller. h" 15 #include "components/autofill/core/browser/autofill_wallet_data_type_controller. h"
15 #include "components/autofill/core/browser/webdata/autofill_data_type_controller .h" 16 #include "components/autofill/core/browser/webdata/autofill_data_type_controller .h"
16 #include "components/autofill/core/browser/webdata/autofill_profile_data_type_co ntroller.h" 17 #include "components/autofill/core/browser/webdata/autofill_profile_data_type_co ntroller.h"
17 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" 18 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
18 #include "components/autofill/core/common/autofill_pref_names.h" 19 #include "components/autofill/core/common/autofill_pref_names.h"
19 #include "components/autofill/core/common/autofill_switches.h" 20 #include "components/autofill/core/common/autofill_switches.h"
20 #include "components/browser_sync/browser_sync_switches.h" 21 #include "components/browser_sync/browser_sync_switches.h"
21 #include "components/browser_sync/profile_sync_service.h" 22 #include "components/browser_sync/profile_sync_service.h"
22 #include "components/dom_distiller/core/dom_distiller_features.h" 23 #include "components/dom_distiller/core/dom_distiller_features.h"
23 #include "components/history/core/browser/history_delete_directives_data_type_co ntroller.h" 24 #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" 25 #include "components/history/core/browser/typed_url_data_type_controller.h"
25 #include "components/password_manager/core/browser/password_store.h" 26 #include "components/password_manager/core/browser/password_store.h"
26 #include "components/password_manager/sync/browser/password_data_type_controller .h" 27 #include "components/password_manager/sync/browser/password_data_type_controller .h"
27 #include "components/prefs/pref_service.h" 28 #include "components/prefs/pref_service.h"
28 #include "components/sync/core/attachments/attachment_downloader.h" 29 #include "components/sync/core/attachments/attachment_downloader.h"
29 #include "components/sync/core/attachments/attachment_service.h" 30 #include "components/sync/core/attachments/attachment_service.h"
30 #include "components/sync/core/attachments/attachment_service_impl.h" 31 #include "components/sync/core/attachments/attachment_service_impl.h"
31 #include "components/sync/core/attachments/attachment_uploader_impl.h" 32 #include "components/sync/core/attachments/attachment_uploader_impl.h"
32 #include "components/sync/device_info/device_info_data_type_controller.h" 33 #include "components/sync/device_info/device_info_data_type_controller.h"
33 #include "components/sync/device_info/local_device_info_provider_impl.h" 34 #include "components/sync/device_info/local_device_info_provider_impl.h"
34 #include "components/sync/driver/data_type_manager_impl.h" 35 #include "components/sync/driver/data_type_manager_impl.h"
35 #include "components/sync/driver/glue/chrome_report_unrecoverable_error.h" 36 #include "components/sync/driver/glue/chrome_report_unrecoverable_error.h"
36 #include "components/sync/driver/glue/sync_backend_host.h" 37 #include "components/sync/driver/glue/sync_backend_host.h"
37 #include "components/sync/driver/glue/sync_backend_host_impl.h" 38 #include "components/sync/driver/glue/sync_backend_host_impl.h"
39 #include "components/sync/driver/model_type_controller.h"
38 #include "components/sync/driver/proxy_data_type_controller.h" 40 #include "components/sync/driver/proxy_data_type_controller.h"
39 #include "components/sync/driver/sync_client.h" 41 #include "components/sync/driver/sync_client.h"
40 #include "components/sync/driver/sync_driver_switches.h" 42 #include "components/sync/driver/sync_driver_switches.h"
41 #include "components/sync/driver/ui_data_type_controller.h" 43 #include "components/sync/driver/ui_data_type_controller.h"
42 #include "components/sync/driver/ui_model_type_controller.h"
43 #include "components/sync_bookmarks/bookmark_change_processor.h" 44 #include "components/sync_bookmarks/bookmark_change_processor.h"
44 #include "components/sync_bookmarks/bookmark_data_type_controller.h" 45 #include "components/sync_bookmarks/bookmark_data_type_controller.h"
45 #include "components/sync_bookmarks/bookmark_model_associator.h" 46 #include "components/sync_bookmarks/bookmark_model_associator.h"
46 #include "components/sync_sessions/session_data_type_controller.h" 47 #include "components/sync_sessions/session_data_type_controller.h"
47 #include "google_apis/gaia/oauth2_token_service.h" 48 #include "google_apis/gaia/oauth2_token_service.h"
48 #include "google_apis/gaia/oauth2_token_service_request.h" 49 #include "google_apis/gaia/oauth2_token_service_request.h"
49 #include "net/url_request/url_request_context_getter.h" 50 #include "net/url_request/url_request_context_getter.h"
50 51
51 using bookmarks::BookmarkModel; 52 using bookmarks::BookmarkModel;
52 using sync_bookmarks::BookmarkChangeProcessor; 53 using sync_bookmarks::BookmarkChangeProcessor;
53 using sync_bookmarks::BookmarkDataTypeController; 54 using sync_bookmarks::BookmarkDataTypeController;
54 using sync_bookmarks::BookmarkModelAssociator; 55 using sync_bookmarks::BookmarkModelAssociator;
55 using syncer::DataTypeController; 56 using syncer::DataTypeController;
56 using syncer::DataTypeManager; 57 using syncer::DataTypeManager;
57 using syncer::DataTypeManagerImpl; 58 using syncer::DataTypeManagerImpl;
58 using syncer::DataTypeManagerObserver; 59 using syncer::DataTypeManagerObserver;
59 using syncer::DeviceInfoDataTypeController; 60 using syncer::DeviceInfoDataTypeController;
60 using syncer::ProxyDataTypeController; 61 using syncer::ProxyDataTypeController;
61 using syncer::UIDataTypeController; 62 using syncer::UIDataTypeController;
62 using syncer::UIModelTypeController; 63 using syncer::ModelTypeController;
63 using sync_sessions::SessionDataTypeController; 64 using sync_sessions::SessionDataTypeController;
64 65
65 namespace browser_sync { 66 namespace browser_sync {
66 67
67 namespace { 68 namespace {
68 69
69 syncer::ModelTypeSet GetDisabledTypesFromCommandLine( 70 syncer::ModelTypeSet GetDisabledTypesFromCommandLine(
70 const base::CommandLine& command_line) { 71 const base::CommandLine& command_line) {
71 syncer::ModelTypeSet disabled_types; 72 syncer::ModelTypeSet disabled_types;
72 std::string disabled_types_str = 73 std::string disabled_types_str =
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 syncer::ModelTypeSet disabled_types, 143 syncer::ModelTypeSet disabled_types,
143 syncer::ModelTypeSet enabled_types) { 144 syncer::ModelTypeSet enabled_types) {
144 base::Closure error_callback = 145 base::Closure error_callback =
145 base::Bind(&syncer::ChromeReportUnrecoverableError, channel_); 146 base::Bind(&syncer::ChromeReportUnrecoverableError, channel_);
146 147
147 // TODO(stanisc): can DEVICE_INFO be one of disabled datatypes? 148 // TODO(stanisc): can DEVICE_INFO be one of disabled datatypes?
148 if (base::FeatureList::IsEnabled(switches::kSyncUSSDeviceInfo)) { 149 if (base::FeatureList::IsEnabled(switches::kSyncUSSDeviceInfo)) {
149 // Use an error callback that always uploads a stacktrace if it can to help 150 // Use an error callback that always uploads a stacktrace if it can to help
150 // get USS as stable as possible. 151 // get USS as stable as possible.
151 sync_service->RegisterDataTypeController( 152 sync_service->RegisterDataTypeController(
152 base::MakeUnique<UIModelTypeController>( 153 base::MakeUnique<ModelTypeController>(
153 syncer::DEVICE_INFO, base::Bind(&base::debug::DumpWithoutCrashing), 154 syncer::DEVICE_INFO, base::Bind(&base::debug::DumpWithoutCrashing),
154 sync_client_)); 155 sync_client_, base::ThreadTaskRunnerHandle::Get()));
155 } else { 156 } else {
156 sync_service->RegisterDataTypeController( 157 sync_service->RegisterDataTypeController(
157 base::MakeUnique<DeviceInfoDataTypeController>( 158 base::MakeUnique<DeviceInfoDataTypeController>(
158 error_callback, sync_client_, 159 error_callback, sync_client_,
159 sync_service->GetLocalDeviceInfoProvider())); 160 sync_service->GetLocalDeviceInfoProvider()));
160 } 161 }
161 162
162 // Autofill sync is enabled by default. Register unless explicitly 163 // Autofill sync is enabled by default. Register unless explicitly
163 // disabled. 164 // disabled.
164 if (!disabled_types.Has(syncer::AUTOFILL)) { 165 if (!disabled_types.Has(syncer::AUTOFILL)) {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 } 258 }
258 259
259 if (!disabled_types.Has(syncer::PREFERENCES) && 260 if (!disabled_types.Has(syncer::PREFERENCES) &&
260 base::FeatureList::IsEnabled(kSyncPreferencesFeature)) { 261 base::FeatureList::IsEnabled(kSyncPreferencesFeature)) {
261 if (!override_prefs_controller_to_uss_for_test_) { 262 if (!override_prefs_controller_to_uss_for_test_) {
262 sync_service->RegisterDataTypeController( 263 sync_service->RegisterDataTypeController(
263 base::MakeUnique<UIDataTypeController>(syncer::PREFERENCES, 264 base::MakeUnique<UIDataTypeController>(syncer::PREFERENCES,
264 error_callback, sync_client_)); 265 error_callback, sync_client_));
265 } else { 266 } else {
266 sync_service->RegisterDataTypeController( 267 sync_service->RegisterDataTypeController(
267 base::MakeUnique<UIModelTypeController>( 268 base::MakeUnique<ModelTypeController>(
268 syncer::PREFERENCES, error_callback, sync_client_)); 269 syncer::PREFERENCES, error_callback, sync_client_,
270 base::ThreadTaskRunnerHandle::Get()));
269 } 271 }
270 } 272 }
271 273
272 if (!disabled_types.Has(syncer::PRIORITY_PREFERENCES)) { 274 if (!disabled_types.Has(syncer::PRIORITY_PREFERENCES)) {
273 sync_service->RegisterDataTypeController( 275 sync_service->RegisterDataTypeController(
274 base::MakeUnique<UIDataTypeController>(syncer::PRIORITY_PREFERENCES, 276 base::MakeUnique<UIDataTypeController>(syncer::PRIORITY_PREFERENCES,
275 error_callback, sync_client_)); 277 error_callback, sync_client_));
276 } 278 }
277 279
278 // Article sync is disabled by default. Register only if explicitly enabled. 280 // Article sync is disabled by default. Register only if explicitly enabled.
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 421
420 // static 422 // static
421 void ProfileSyncComponentsFactoryImpl::OverridePrefsForUssTest(bool use_uss) { 423 void ProfileSyncComponentsFactoryImpl::OverridePrefsForUssTest(bool use_uss) {
422 override_prefs_controller_to_uss_for_test_ = use_uss; 424 override_prefs_controller_to_uss_for_test_ = use_uss;
423 } 425 }
424 426
425 bool ProfileSyncComponentsFactoryImpl:: 427 bool ProfileSyncComponentsFactoryImpl::
426 override_prefs_controller_to_uss_for_test_ = false; 428 override_prefs_controller_to_uss_for_test_ = false;
427 429
428 } // namespace browser_sync 430 } // namespace browser_sync
OLDNEW
« no previous file with comments | « no previous file | components/sync/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698