OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/extensions/app_notification_manager.h" | 6 #include "chrome/browser/extensions/app_notification_manager.h" |
7 #include "chrome/browser/extensions/extension_service.h" | 7 #include "chrome/browser/extensions/extension_service.h" |
8 #include "chrome/browser/extensions/extension_settings_backend.h" | 8 #include "chrome/browser/extensions/extension_settings_backend.h" |
9 #include "chrome/browser/prefs/pref_model_associator.h" | 9 #include "chrome/browser/prefs/pref_model_associator.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 // enabled. | 159 // enabled. |
160 if (command_line_->HasSwitch(switches::kEnableSyncTabs)) { | 160 if (command_line_->HasSwitch(switches::kEnableSyncTabs)) { |
161 pss->RegisterDataTypeController( | 161 pss->RegisterDataTypeController( |
162 new SessionDataTypeController(this, profile_, pss)); | 162 new SessionDataTypeController(this, profile_, pss)); |
163 } | 163 } |
164 | 164 |
165 // Extension setting sync is disabled by default. Register only if | 165 // Extension setting sync is disabled by default. Register only if |
166 // explicitly enabled. | 166 // explicitly enabled. |
167 if (command_line_->HasSwitch(switches::kEnableSyncExtensionSettings)) { | 167 if (command_line_->HasSwitch(switches::kEnableSyncExtensionSettings)) { |
168 pss->RegisterDataTypeController( | 168 pss->RegisterDataTypeController( |
169 new ExtensionSettingDataTypeController(this, profile_, pss)); | 169 new ExtensionSettingDataTypeController( |
| 170 syncable::EXTENSION_SETTINGS, this, profile_, pss)); |
| 171 pss->RegisterDataTypeController( |
| 172 new ExtensionSettingDataTypeController( |
| 173 syncable::APP_SETTINGS, this, profile_, pss)); |
170 } | 174 } |
171 | 175 |
172 if (!command_line_->HasSwitch(switches::kDisableSyncAutofillProfile)) { | 176 if (!command_line_->HasSwitch(switches::kDisableSyncAutofillProfile)) { |
173 pss->RegisterDataTypeController( | 177 pss->RegisterDataTypeController( |
174 new AutofillProfileDataTypeController(this, profile_)); | 178 new AutofillProfileDataTypeController(this, profile_)); |
175 } | 179 } |
176 | 180 |
177 // Search Engine sync is disabled by default. Register only if explicitly | 181 // Search Engine sync is disabled by default. Register only if explicitly |
178 // enabled. | 182 // enabled. |
179 if (command_line_->HasSwitch(switches::kEnableSyncSearchEngines)) { | 183 if (command_line_->HasSwitch(switches::kEnableSyncSearchEngines)) { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 new BookmarkModelAssociator(bookmark_model, | 266 new BookmarkModelAssociator(bookmark_model, |
263 user_share, | 267 user_share, |
264 error_handler); | 268 error_handler); |
265 BookmarkChangeProcessor* change_processor = | 269 BookmarkChangeProcessor* change_processor = |
266 new BookmarkChangeProcessor(model_associator, | 270 new BookmarkChangeProcessor(model_associator, |
267 error_handler); | 271 error_handler); |
268 return SyncComponents(model_associator, change_processor); | 272 return SyncComponents(model_associator, change_processor); |
269 } | 273 } |
270 | 274 |
271 ProfileSyncFactory::SyncComponents | 275 ProfileSyncFactory::SyncComponents |
272 ProfileSyncFactoryImpl::CreateExtensionSettingSyncComponents( | 276 ProfileSyncFactoryImpl::CreateExtensionOrAppSettingSyncComponents( |
273 ExtensionSettingsBackend* extension_settings_backend, | 277 syncable::ModelType type, |
| 278 SyncableService* settings_service, |
274 ProfileSyncService* profile_sync_service, | 279 ProfileSyncService* profile_sync_service, |
275 UnrecoverableErrorHandler* error_handler) { | 280 UnrecoverableErrorHandler* error_handler) { |
276 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 281 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 282 DCHECK(type == syncable::EXTENSION_SETTINGS || |
| 283 type == syncable::APP_SETTINGS); |
277 sync_api::UserShare* user_share = profile_sync_service->GetUserShare(); | 284 sync_api::UserShare* user_share = profile_sync_service->GetUserShare(); |
278 GenericChangeProcessor* change_processor = | 285 GenericChangeProcessor* change_processor = |
279 new GenericChangeProcessor(error_handler, | 286 new GenericChangeProcessor(error_handler, |
280 extension_settings_backend->AsWeakPtr(), | 287 settings_service->AsWeakPtr(), |
281 user_share); | 288 user_share); |
282 browser_sync::SyncableServiceAdapter* sync_service_adapter = | 289 browser_sync::SyncableServiceAdapter* sync_service_adapter = |
283 new browser_sync::SyncableServiceAdapter(syncable::EXTENSION_SETTINGS, | 290 new browser_sync::SyncableServiceAdapter(type, |
284 extension_settings_backend, | 291 settings_service, |
285 change_processor); | 292 change_processor); |
286 return SyncComponents(sync_service_adapter, change_processor); | 293 return SyncComponents(sync_service_adapter, change_processor); |
287 } | 294 } |
288 | 295 |
289 ProfileSyncFactory::SyncComponents | 296 ProfileSyncFactory::SyncComponents |
290 ProfileSyncFactoryImpl::CreateExtensionSyncComponents( | 297 ProfileSyncFactoryImpl::CreateExtensionSyncComponents( |
291 ProfileSyncService* profile_sync_service, | 298 ProfileSyncService* profile_sync_service, |
292 UnrecoverableErrorHandler* error_handler) { | 299 UnrecoverableErrorHandler* error_handler) { |
293 base::WeakPtr<SyncableService> extension_sync_service = | 300 base::WeakPtr<SyncableService> extension_sync_service = |
294 profile_sync_service->profile()->GetExtensionService()->AsWeakPtr(); | 301 profile_sync_service->profile()->GetExtensionService()->AsWeakPtr(); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 GenericChangeProcessor* change_processor = | 412 GenericChangeProcessor* change_processor = |
406 new GenericChangeProcessor(error_handler, | 413 new GenericChangeProcessor(error_handler, |
407 notif_sync_service, | 414 notif_sync_service, |
408 user_share); | 415 user_share); |
409 SyncableServiceAdapter* sync_service_adapter = | 416 SyncableServiceAdapter* sync_service_adapter = |
410 new SyncableServiceAdapter(syncable::APP_NOTIFICATIONS, | 417 new SyncableServiceAdapter(syncable::APP_NOTIFICATIONS, |
411 notif_sync_service, | 418 notif_sync_service, |
412 change_processor); | 419 change_processor); |
413 return SyncComponents(sync_service_adapter, change_processor); | 420 return SyncComponents(sync_service_adapter, change_processor); |
414 } | 421 } |
OLD | NEW |