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/extension_service.h" | 6 #include "chrome/browser/extensions/extension_service.h" |
| 7 #include "chrome/browser/extensions/extension_settings.h" |
7 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
8 #include "chrome/browser/search_engines/template_url_service.h" | 9 #include "chrome/browser/search_engines/template_url_service.h" |
9 #include "chrome/browser/search_engines/template_url_service_factory.h" | 10 #include "chrome/browser/search_engines/template_url_service_factory.h" |
10 #include "chrome/browser/sync/api/syncable_service.h" | 11 #include "chrome/browser/sync/api/syncable_service.h" |
11 #include "chrome/browser/sync/glue/app_data_type_controller.h" | 12 #include "chrome/browser/sync/glue/app_data_type_controller.h" |
12 #include "chrome/browser/sync/glue/autofill_change_processor.h" | 13 #include "chrome/browser/sync/glue/autofill_change_processor.h" |
13 #include "chrome/browser/sync/glue/autofill_data_type_controller.h" | 14 #include "chrome/browser/sync/glue/autofill_data_type_controller.h" |
14 #include "chrome/browser/sync/glue/autofill_model_associator.h" | 15 #include "chrome/browser/sync/glue/autofill_model_associator.h" |
15 #include "chrome/browser/sync/glue/autofill_profile_data_type_controller.h" | 16 #include "chrome/browser/sync/glue/autofill_profile_data_type_controller.h" |
16 #include "chrome/browser/sync/glue/autofill_profile_syncable_service.h" | 17 #include "chrome/browser/sync/glue/autofill_profile_syncable_service.h" |
17 #include "chrome/browser/sync/glue/bookmark_change_processor.h" | 18 #include "chrome/browser/sync/glue/bookmark_change_processor.h" |
18 #include "chrome/browser/sync/glue/bookmark_data_type_controller.h" | 19 #include "chrome/browser/sync/glue/bookmark_data_type_controller.h" |
19 #include "chrome/browser/sync/glue/bookmark_model_associator.h" | 20 #include "chrome/browser/sync/glue/bookmark_model_associator.h" |
20 #include "chrome/browser/sync/glue/data_type_manager_impl.h" | 21 #include "chrome/browser/sync/glue/data_type_manager_impl.h" |
21 #include "chrome/browser/sync/glue/extension_data_type_controller.h" | 22 #include "chrome/browser/sync/glue/extension_data_type_controller.h" |
| 23 #include "chrome/browser/sync/glue/extension_setting_data_type_controller.h" |
22 #include "chrome/browser/sync/glue/generic_change_processor.h" | 24 #include "chrome/browser/sync/glue/generic_change_processor.h" |
23 #include "chrome/browser/sync/glue/password_change_processor.h" | 25 #include "chrome/browser/sync/glue/password_change_processor.h" |
24 #include "chrome/browser/sync/glue/password_data_type_controller.h" | 26 #include "chrome/browser/sync/glue/password_data_type_controller.h" |
25 #include "chrome/browser/sync/glue/password_model_associator.h" | 27 #include "chrome/browser/sync/glue/password_model_associator.h" |
26 #include "chrome/browser/sync/glue/preference_data_type_controller.h" | 28 #include "chrome/browser/sync/glue/preference_data_type_controller.h" |
27 #include "chrome/browser/sync/glue/search_engine_data_type_controller.h" | 29 #include "chrome/browser/sync/glue/search_engine_data_type_controller.h" |
28 #include "chrome/browser/sync/glue/session_change_processor.h" | 30 #include "chrome/browser/sync/glue/session_change_processor.h" |
29 #include "chrome/browser/sync/glue/session_data_type_controller.h" | 31 #include "chrome/browser/sync/glue/session_data_type_controller.h" |
30 #include "chrome/browser/sync/glue/session_model_associator.h" | 32 #include "chrome/browser/sync/glue/session_model_associator.h" |
31 #include "chrome/browser/sync/glue/syncable_service_adapter.h" | 33 #include "chrome/browser/sync/glue/syncable_service_adapter.h" |
32 #include "chrome/browser/sync/glue/sync_backend_host.h" | 34 #include "chrome/browser/sync/glue/sync_backend_host.h" |
33 #include "chrome/browser/sync/glue/theme_change_processor.h" | 35 #include "chrome/browser/sync/glue/theme_change_processor.h" |
34 #include "chrome/browser/sync/glue/theme_data_type_controller.h" | 36 #include "chrome/browser/sync/glue/theme_data_type_controller.h" |
35 #include "chrome/browser/sync/glue/theme_model_associator.h" | 37 #include "chrome/browser/sync/glue/theme_model_associator.h" |
36 #include "chrome/browser/sync/glue/typed_url_change_processor.h" | 38 #include "chrome/browser/sync/glue/typed_url_change_processor.h" |
37 #include "chrome/browser/sync/glue/typed_url_data_type_controller.h" | 39 #include "chrome/browser/sync/glue/typed_url_data_type_controller.h" |
38 #include "chrome/browser/sync/glue/typed_url_model_associator.h" | 40 #include "chrome/browser/sync/glue/typed_url_model_associator.h" |
39 #include "chrome/browser/sync/profile_sync_service.h" | 41 #include "chrome/browser/sync/profile_sync_service.h" |
40 #include "chrome/browser/sync/profile_sync_factory_impl.h" | 42 #include "chrome/browser/sync/profile_sync_factory_impl.h" |
41 #include "chrome/browser/sync/signin_manager.h" | 43 #include "chrome/browser/sync/signin_manager.h" |
42 #include "chrome/browser/webdata/web_data_service.h" | 44 #include "chrome/browser/webdata/web_data_service.h" |
43 #include "chrome/common/chrome_switches.h" | 45 #include "chrome/common/chrome_switches.h" |
44 #include "chrome/common/pref_names.h" | 46 #include "chrome/common/pref_names.h" |
| 47 #include "content/browser/browser_thread.h" |
45 | 48 |
46 using browser_sync::AppDataTypeController; | 49 using browser_sync::AppDataTypeController; |
47 using browser_sync::AutofillChangeProcessor; | 50 using browser_sync::AutofillChangeProcessor; |
48 using browser_sync::AutofillDataTypeController; | 51 using browser_sync::AutofillDataTypeController; |
49 using browser_sync::AutofillProfileDataTypeController; | 52 using browser_sync::AutofillProfileDataTypeController; |
50 using browser_sync::AutofillModelAssociator; | 53 using browser_sync::AutofillModelAssociator; |
51 using browser_sync::AutofillProfileSyncableService; | 54 using browser_sync::AutofillProfileSyncableService; |
52 using browser_sync::BookmarkChangeProcessor; | 55 using browser_sync::BookmarkChangeProcessor; |
53 using browser_sync::BookmarkDataTypeController; | 56 using browser_sync::BookmarkDataTypeController; |
54 using browser_sync::BookmarkModelAssociator; | 57 using browser_sync::BookmarkModelAssociator; |
55 using browser_sync::DataTypeController; | 58 using browser_sync::DataTypeController; |
56 using browser_sync::DataTypeManager; | 59 using browser_sync::DataTypeManager; |
57 using browser_sync::DataTypeManagerImpl; | 60 using browser_sync::DataTypeManagerImpl; |
58 using browser_sync::ExtensionDataTypeController; | 61 using browser_sync::ExtensionDataTypeController; |
| 62 using browser_sync::ExtensionSettingDataTypeController; |
59 using browser_sync::GenericChangeProcessor; | 63 using browser_sync::GenericChangeProcessor; |
60 using browser_sync::PasswordChangeProcessor; | 64 using browser_sync::PasswordChangeProcessor; |
61 using browser_sync::PasswordDataTypeController; | 65 using browser_sync::PasswordDataTypeController; |
62 using browser_sync::PasswordModelAssociator; | 66 using browser_sync::PasswordModelAssociator; |
63 using browser_sync::PreferenceDataTypeController; | 67 using browser_sync::PreferenceDataTypeController; |
64 using browser_sync::SearchEngineDataTypeController; | 68 using browser_sync::SearchEngineDataTypeController; |
65 using browser_sync::SessionChangeProcessor; | 69 using browser_sync::SessionChangeProcessor; |
66 using browser_sync::SessionDataTypeController; | 70 using browser_sync::SessionDataTypeController; |
67 using browser_sync::SessionModelAssociator; | 71 using browser_sync::SessionModelAssociator; |
68 using browser_sync::SyncableServiceAdapter; | 72 using browser_sync::SyncableServiceAdapter; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 new TypedUrlDataTypeController(this, profile_)); | 150 new TypedUrlDataTypeController(this, profile_)); |
147 } | 151 } |
148 | 152 |
149 // Session sync is disabled by default. Register only if explicitly | 153 // Session sync is disabled by default. Register only if explicitly |
150 // enabled. | 154 // enabled. |
151 if (command_line_->HasSwitch(switches::kEnableSyncTabs)) { | 155 if (command_line_->HasSwitch(switches::kEnableSyncTabs)) { |
152 pss->RegisterDataTypeController( | 156 pss->RegisterDataTypeController( |
153 new SessionDataTypeController(this, profile_, pss)); | 157 new SessionDataTypeController(this, profile_, pss)); |
154 } | 158 } |
155 | 159 |
| 160 // Extension setting sync is disabled by default. Register only if |
| 161 // explicitly enabled. |
| 162 if (command_line_->HasSwitch(switches::kEnableSyncExtensionSettings)) { |
| 163 pss->RegisterDataTypeController( |
| 164 new ExtensionSettingDataTypeController(this, profile_, pss)); |
| 165 } |
| 166 |
156 if (!command_line_->HasSwitch(switches::kDisableSyncAutofillProfile)) { | 167 if (!command_line_->HasSwitch(switches::kDisableSyncAutofillProfile)) { |
157 pss->RegisterDataTypeController( | 168 pss->RegisterDataTypeController( |
158 new AutofillProfileDataTypeController(this, profile_)); | 169 new AutofillProfileDataTypeController(this, profile_)); |
159 } | 170 } |
160 | 171 |
161 // Search Engine sync is disabled by default. Register only if explicitly | 172 // Search Engine sync is disabled by default. Register only if explicitly |
162 // enabled. | 173 // enabled. |
163 if (command_line_->HasSwitch(switches::kEnableSyncSearchEngines)) { | 174 if (command_line_->HasSwitch(switches::kEnableSyncSearchEngines)) { |
164 pss->RegisterDataTypeController( | 175 pss->RegisterDataTypeController( |
165 new SearchEngineDataTypeController(this, profile_, pss)); | 176 new SearchEngineDataTypeController(this, profile_, pss)); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 new BookmarkModelAssociator(bookmark_model, | 248 new BookmarkModelAssociator(bookmark_model, |
238 user_share, | 249 user_share, |
239 error_handler); | 250 error_handler); |
240 BookmarkChangeProcessor* change_processor = | 251 BookmarkChangeProcessor* change_processor = |
241 new BookmarkChangeProcessor(model_associator, | 252 new BookmarkChangeProcessor(model_associator, |
242 error_handler); | 253 error_handler); |
243 return SyncComponents(model_associator, change_processor); | 254 return SyncComponents(model_associator, change_processor); |
244 } | 255 } |
245 | 256 |
246 ProfileSyncFactory::SyncComponents | 257 ProfileSyncFactory::SyncComponents |
| 258 ProfileSyncFactoryImpl::CreateExtensionSettingSyncComponents( |
| 259 ExtensionSettings* extension_settings, |
| 260 ProfileSyncService* profile_sync_service, |
| 261 UnrecoverableErrorHandler* error_handler) { |
| 262 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 263 sync_api::UserShare* user_share = profile_sync_service->GetUserShare(); |
| 264 GenericChangeProcessor* change_processor = |
| 265 new GenericChangeProcessor(extension_settings, error_handler, user_share); |
| 266 browser_sync::SyncableServiceAdapter* sync_service_adapter = |
| 267 new browser_sync::SyncableServiceAdapter(syncable::EXTENSION_SETTINGS, |
| 268 extension_settings, |
| 269 change_processor); |
| 270 return SyncComponents(sync_service_adapter, change_processor); |
| 271 } |
| 272 |
| 273 ProfileSyncFactory::SyncComponents |
247 ProfileSyncFactoryImpl::CreateExtensionSyncComponents( | 274 ProfileSyncFactoryImpl::CreateExtensionSyncComponents( |
248 ProfileSyncService* profile_sync_service, | 275 ProfileSyncService* profile_sync_service, |
249 UnrecoverableErrorHandler* error_handler) { | 276 UnrecoverableErrorHandler* error_handler) { |
250 SyncableService* extension_sync_service = | 277 SyncableService* extension_sync_service = |
251 profile_sync_service->profile()->GetExtensionService(); | 278 profile_sync_service->profile()->GetExtensionService(); |
252 sync_api::UserShare* user_share = profile_sync_service->GetUserShare(); | 279 sync_api::UserShare* user_share = profile_sync_service->GetUserShare(); |
253 GenericChangeProcessor* change_processor = | 280 GenericChangeProcessor* change_processor = |
254 new GenericChangeProcessor(extension_sync_service, error_handler, | 281 new GenericChangeProcessor(extension_sync_service, error_handler, |
255 user_share); | 282 user_share); |
256 browser_sync::SyncableServiceAdapter* sync_service_adapter = | 283 browser_sync::SyncableServiceAdapter* sync_service_adapter = |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 DCHECK(se_sync_service); | 364 DCHECK(se_sync_service); |
338 sync_api::UserShare* user_share = profile_sync_service->GetUserShare(); | 365 sync_api::UserShare* user_share = profile_sync_service->GetUserShare(); |
339 GenericChangeProcessor* change_processor = | 366 GenericChangeProcessor* change_processor = |
340 new GenericChangeProcessor(se_sync_service, error_handler, user_share); | 367 new GenericChangeProcessor(se_sync_service, error_handler, user_share); |
341 SyncableServiceAdapter* sync_service_adapter = | 368 SyncableServiceAdapter* sync_service_adapter = |
342 new SyncableServiceAdapter(syncable::SEARCH_ENGINES, | 369 new SyncableServiceAdapter(syncable::SEARCH_ENGINES, |
343 se_sync_service, | 370 se_sync_service, |
344 change_processor); | 371 change_processor); |
345 return SyncComponents(sync_service_adapter, change_processor); | 372 return SyncComponents(sync_service_adapter, change_processor); |
346 } | 373 } |
OLD | NEW |