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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "build/build_config.h" | 6 #include "build/build_config.h" |
7 #include "chrome/browser/about_flags.h" | 7 #include "chrome/browser/about_flags.h" |
8 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 8 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/extensions/api/storage/settings_frontend.h" | 10 #include "chrome/browser/extensions/api/storage/settings_frontend.h" |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 // disabled. | 196 // disabled. |
197 if (!command_line_->HasSwitch(switches::kDisableSyncPasswords)) { | 197 if (!command_line_->HasSwitch(switches::kDisableSyncPasswords)) { |
198 pss->RegisterDataTypeController( | 198 pss->RegisterDataTypeController( |
199 new PasswordDataTypeController(this, profile_, pss)); | 199 new PasswordDataTypeController(this, profile_, pss)); |
200 } | 200 } |
201 // Article sync is disabled by default. Register only if explicitly enabled. | 201 // Article sync is disabled by default. Register only if explicitly enabled. |
202 if (command_line_->HasSwitch(switches::kEnableSyncArticles)) { | 202 if (command_line_->HasSwitch(switches::kEnableSyncArticles)) { |
203 pss->RegisterDataTypeController( | 203 pss->RegisterDataTypeController( |
204 new UIDataTypeController(syncer::ARTICLES, this, profile_, pss)); | 204 new UIDataTypeController(syncer::ARTICLES, this, profile_, pss)); |
205 } | 205 } |
| 206 |
| 207 #if defined(ENABLE_MANAGED_USERS) |
| 208 if (ManagedUserService::AreManagedUsersEnabled()) { |
| 209 if (profile_->IsManaged()) { |
| 210 pss->RegisterDataTypeController( |
| 211 new UIDataTypeController( |
| 212 syncer::MANAGED_USER_SETTINGS, this, profile_, pss)); |
| 213 } else { |
| 214 pss->RegisterDataTypeController( |
| 215 new UIDataTypeController( |
| 216 syncer::MANAGED_USERS, this, profile_, pss)); |
| 217 } |
| 218 } |
| 219 #endif |
206 } | 220 } |
207 | 221 |
208 void ProfileSyncComponentsFactoryImpl::RegisterDesktopDataTypes( | 222 void ProfileSyncComponentsFactoryImpl::RegisterDesktopDataTypes( |
209 ProfileSyncService* pss) { | 223 ProfileSyncService* pss) { |
210 // App sync is enabled by default. Register unless explicitly | 224 // App sync is enabled by default. Register unless explicitly |
211 // disabled. | 225 // disabled. |
212 if (!command_line_->HasSwitch(switches::kDisableSyncApps)) { | 226 if (!command_line_->HasSwitch(switches::kDisableSyncApps)) { |
213 pss->RegisterDataTypeController( | 227 pss->RegisterDataTypeController( |
214 new ExtensionDataTypeController(syncer::APPS, this, profile_, pss)); | 228 new ExtensionDataTypeController(syncer::APPS, this, profile_, pss)); |
215 } | 229 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 new UIDataTypeController( | 286 new UIDataTypeController( |
273 syncer::SYNCED_NOTIFICATIONS, this, profile_, pss)); | 287 syncer::SYNCED_NOTIFICATIONS, this, profile_, pss)); |
274 | 288 |
275 #if defined(OS_LINUX) || defined(OS_WIN) || defined(OS_CHROMEOS) | 289 #if defined(OS_LINUX) || defined(OS_WIN) || defined(OS_CHROMEOS) |
276 // Dictionary sync is enabled by default. | 290 // Dictionary sync is enabled by default. |
277 if (!command_line_->HasSwitch(switches::kDisableSyncDictionary)) { | 291 if (!command_line_->HasSwitch(switches::kDisableSyncDictionary)) { |
278 pss->RegisterDataTypeController( | 292 pss->RegisterDataTypeController( |
279 new UIDataTypeController(syncer::DICTIONARY, this, profile_, pss)); | 293 new UIDataTypeController(syncer::DICTIONARY, this, profile_, pss)); |
280 } | 294 } |
281 #endif | 295 #endif |
282 | |
283 #if defined(ENABLE_MANAGED_USERS) | |
284 if (ManagedUserService::AreManagedUsersEnabled()) { | |
285 if (profile_->IsManaged()) { | |
286 pss->RegisterDataTypeController( | |
287 new UIDataTypeController( | |
288 syncer::MANAGED_USER_SETTINGS, this, profile_, pss)); | |
289 } else { | |
290 pss->RegisterDataTypeController( | |
291 new UIDataTypeController( | |
292 syncer::MANAGED_USERS, this, profile_, pss)); | |
293 } | |
294 } | |
295 #endif | |
296 } | 296 } |
297 | 297 |
298 DataTypeManager* ProfileSyncComponentsFactoryImpl::CreateDataTypeManager( | 298 DataTypeManager* ProfileSyncComponentsFactoryImpl::CreateDataTypeManager( |
299 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& | 299 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& |
300 debug_info_listener, | 300 debug_info_listener, |
301 const DataTypeController::TypeMap* controllers, | 301 const DataTypeController::TypeMap* controllers, |
302 const browser_sync::DataTypeEncryptionHandler* encryption_handler, | 302 const browser_sync::DataTypeEncryptionHandler* encryption_handler, |
303 SyncBackendHost* backend, | 303 SyncBackendHost* backend, |
304 DataTypeManagerObserver* observer, | 304 DataTypeManagerObserver* observer, |
305 browser_sync::FailedDataTypesHandler* failed_data_types_handler) { | 305 browser_sync::FailedDataTypesHandler* failed_data_types_handler) { |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 ProfileSyncComponentsFactory::SyncComponents | 488 ProfileSyncComponentsFactory::SyncComponents |
489 ProfileSyncComponentsFactoryImpl::CreateSessionSyncComponents( | 489 ProfileSyncComponentsFactoryImpl::CreateSessionSyncComponents( |
490 ProfileSyncService* profile_sync_service, | 490 ProfileSyncService* profile_sync_service, |
491 DataTypeErrorHandler* error_handler) { | 491 DataTypeErrorHandler* error_handler) { |
492 SessionModelAssociator* model_associator = | 492 SessionModelAssociator* model_associator = |
493 new SessionModelAssociator(profile_sync_service, error_handler); | 493 new SessionModelAssociator(profile_sync_service, error_handler); |
494 SessionChangeProcessor* change_processor = | 494 SessionChangeProcessor* change_processor = |
495 new SessionChangeProcessor(error_handler, model_associator); | 495 new SessionChangeProcessor(error_handler, model_associator); |
496 return SyncComponents(model_associator, change_processor); | 496 return SyncComponents(model_associator, change_processor); |
497 } | 497 } |
OLD | NEW |