| 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/bookmarks/bookmark_model_factory.h" | 7 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 8 #include "chrome/browser/extensions/api/storage/settings_frontend.h" | 8 #include "chrome/browser/extensions/api/storage/settings_frontend.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/extensions/extension_system.h" | 10 #include "chrome/browser/extensions/extension_system.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 pss->RegisterDataTypeController( | 198 pss->RegisterDataTypeController( |
| 199 new ExtensionDataTypeController(syncer::EXTENSIONS, | 199 new ExtensionDataTypeController(syncer::EXTENSIONS, |
| 200 this, profile_, pss)); | 200 this, profile_, pss)); |
| 201 } | 201 } |
| 202 | 202 |
| 203 // Preference sync is enabled by default. Register unless explicitly | 203 // Preference sync is enabled by default. Register unless explicitly |
| 204 // disabled. | 204 // disabled. |
| 205 if (!command_line_->HasSwitch(switches::kDisableSyncPreferences)) { | 205 if (!command_line_->HasSwitch(switches::kDisableSyncPreferences)) { |
| 206 pss->RegisterDataTypeController( | 206 pss->RegisterDataTypeController( |
| 207 new UIDataTypeController(syncer::PREFERENCES, this, profile_, pss)); | 207 new UIDataTypeController(syncer::PREFERENCES, this, profile_, pss)); |
| 208 pss->RegisterDataTypeController( |
| 209 new UIDataTypeController(syncer::PRIORITY_PREFERENCES, |
| 210 this, profile_, pss)); |
| 208 } | 211 } |
| 209 | 212 |
| 210 #if defined(ENABLE_THEMES) | 213 #if defined(ENABLE_THEMES) |
| 211 // Theme sync is enabled by default. Register unless explicitly disabled. | 214 // Theme sync is enabled by default. Register unless explicitly disabled. |
| 212 if (!command_line_->HasSwitch(switches::kDisableSyncThemes)) { | 215 if (!command_line_->HasSwitch(switches::kDisableSyncThemes)) { |
| 213 pss->RegisterDataTypeController( | 216 pss->RegisterDataTypeController( |
| 214 new ThemeDataTypeController(this, profile_, pss)); | 217 new ThemeDataTypeController(this, profile_, pss)); |
| 215 } | 218 } |
| 216 #endif | 219 #endif |
| 217 | 220 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 } | 294 } |
| 292 | 295 |
| 293 base::WeakPtr<syncer::SyncableService> ProfileSyncComponentsFactoryImpl:: | 296 base::WeakPtr<syncer::SyncableService> ProfileSyncComponentsFactoryImpl:: |
| 294 GetSyncableServiceForType(syncer::ModelType type) { | 297 GetSyncableServiceForType(syncer::ModelType type) { |
| 295 if (!profile_) { // For tests. | 298 if (!profile_) { // For tests. |
| 296 return base::WeakPtr<syncer::SyncableService>(); | 299 return base::WeakPtr<syncer::SyncableService>(); |
| 297 } | 300 } |
| 298 switch (type) { | 301 switch (type) { |
| 299 case syncer::PREFERENCES: | 302 case syncer::PREFERENCES: |
| 300 return PrefServiceSyncable::FromProfile( | 303 return PrefServiceSyncable::FromProfile( |
| 301 profile_)->GetSyncableService()->AsWeakPtr(); | 304 profile_)->GetSyncableService(syncer::PREFERENCES)->AsWeakPtr(); |
| 305 case syncer::PRIORITY_PREFERENCES: |
| 306 return PrefServiceSyncable::FromProfile(profile_)->GetSyncableService( |
| 307 syncer::PRIORITY_PREFERENCES)->AsWeakPtr(); |
| 302 case syncer::AUTOFILL: | 308 case syncer::AUTOFILL: |
| 303 case syncer::AUTOFILL_PROFILE: { | 309 case syncer::AUTOFILL_PROFILE: { |
| 304 if (!web_data_service_.get()) | 310 if (!web_data_service_.get()) |
| 305 return base::WeakPtr<syncer::SyncableService>(); | 311 return base::WeakPtr<syncer::SyncableService>(); |
| 306 if (type == syncer::AUTOFILL) { | 312 if (type == syncer::AUTOFILL) { |
| 307 return web_data_service_->GetAutocompleteSyncableService()->AsWeakPtr(); | 313 return web_data_service_->GetAutocompleteSyncableService()->AsWeakPtr(); |
| 308 } else { | 314 } else { |
| 309 return web_data_service_-> | 315 return web_data_service_-> |
| 310 GetAutofillProfileSyncableService()->AsWeakPtr(); | 316 GetAutofillProfileSyncableService()->AsWeakPtr(); |
| 311 } | 317 } |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 ProfileSyncComponentsFactory::SyncComponents | 424 ProfileSyncComponentsFactory::SyncComponents |
| 419 ProfileSyncComponentsFactoryImpl::CreateSessionSyncComponents( | 425 ProfileSyncComponentsFactoryImpl::CreateSessionSyncComponents( |
| 420 ProfileSyncService* profile_sync_service, | 426 ProfileSyncService* profile_sync_service, |
| 421 DataTypeErrorHandler* error_handler) { | 427 DataTypeErrorHandler* error_handler) { |
| 422 SessionModelAssociator* model_associator = | 428 SessionModelAssociator* model_associator = |
| 423 new SessionModelAssociator(profile_sync_service, error_handler); | 429 new SessionModelAssociator(profile_sync_service, error_handler); |
| 424 SessionChangeProcessor* change_processor = | 430 SessionChangeProcessor* change_processor = |
| 425 new SessionChangeProcessor(error_handler, model_associator); | 431 new SessionChangeProcessor(error_handler, model_associator); |
| 426 return SyncComponents(model_associator, change_processor); | 432 return SyncComponents(model_associator, change_processor); |
| 427 } | 433 } |
| OLD | NEW |