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/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
8 #include "chrome/browser/sync/api/syncable_service.h" | 8 #include "chrome/browser/sync/api/syncable_service.h" |
9 #include "chrome/browser/sync/glue/app_change_processor.h" | |
10 #include "chrome/browser/sync/glue/app_data_type_controller.h" | 9 #include "chrome/browser/sync/glue/app_data_type_controller.h" |
11 #include "chrome/browser/sync/glue/app_model_associator.h" | |
12 #include "chrome/browser/sync/glue/autofill_change_processor.h" | 10 #include "chrome/browser/sync/glue/autofill_change_processor.h" |
13 #include "chrome/browser/sync/glue/autofill_data_type_controller.h" | 11 #include "chrome/browser/sync/glue/autofill_data_type_controller.h" |
14 #include "chrome/browser/sync/glue/autofill_model_associator.h" | 12 #include "chrome/browser/sync/glue/autofill_model_associator.h" |
15 #include "chrome/browser/sync/glue/autofill_profile_change_processor.h" | 13 #include "chrome/browser/sync/glue/autofill_profile_change_processor.h" |
16 #include "chrome/browser/sync/glue/autofill_profile_data_type_controller.h" | 14 #include "chrome/browser/sync/glue/autofill_profile_data_type_controller.h" |
17 #include "chrome/browser/sync/glue/autofill_profile_model_associator.h" | 15 #include "chrome/browser/sync/glue/autofill_profile_model_associator.h" |
18 #include "chrome/browser/sync/glue/bookmark_change_processor.h" | 16 #include "chrome/browser/sync/glue/bookmark_change_processor.h" |
19 #include "chrome/browser/sync/glue/bookmark_data_type_controller.h" | 17 #include "chrome/browser/sync/glue/bookmark_data_type_controller.h" |
20 #include "chrome/browser/sync/glue/bookmark_model_associator.h" | 18 #include "chrome/browser/sync/glue/bookmark_model_associator.h" |
21 #include "chrome/browser/sync/glue/data_type_manager_impl.h" | 19 #include "chrome/browser/sync/glue/data_type_manager_impl.h" |
22 #include "chrome/browser/sync/glue/extension_change_processor.h" | |
23 #include "chrome/browser/sync/glue/extension_data_type_controller.h" | 20 #include "chrome/browser/sync/glue/extension_data_type_controller.h" |
24 #include "chrome/browser/sync/glue/extension_model_associator.h" | |
25 #include "chrome/browser/sync/glue/extension_sync_traits.h" | |
26 #include "chrome/browser/sync/glue/generic_change_processor.h" | 21 #include "chrome/browser/sync/glue/generic_change_processor.h" |
27 #include "chrome/browser/sync/glue/password_change_processor.h" | 22 #include "chrome/browser/sync/glue/password_change_processor.h" |
28 #include "chrome/browser/sync/glue/password_data_type_controller.h" | 23 #include "chrome/browser/sync/glue/password_data_type_controller.h" |
29 #include "chrome/browser/sync/glue/password_model_associator.h" | 24 #include "chrome/browser/sync/glue/password_model_associator.h" |
30 #include "chrome/browser/sync/glue/preference_data_type_controller.h" | 25 #include "chrome/browser/sync/glue/preference_data_type_controller.h" |
31 #include "chrome/browser/sync/glue/session_change_processor.h" | 26 #include "chrome/browser/sync/glue/session_change_processor.h" |
32 #include "chrome/browser/sync/glue/session_data_type_controller.h" | 27 #include "chrome/browser/sync/glue/session_data_type_controller.h" |
33 #include "chrome/browser/sync/glue/session_model_associator.h" | 28 #include "chrome/browser/sync/glue/session_model_associator.h" |
34 #include "chrome/browser/sync/glue/syncable_service_adapter.h" | 29 #include "chrome/browser/sync/glue/syncable_service_adapter.h" |
35 #include "chrome/browser/sync/glue/sync_backend_host.h" | 30 #include "chrome/browser/sync/glue/sync_backend_host.h" |
36 #include "chrome/browser/sync/glue/theme_change_processor.h" | 31 #include "chrome/browser/sync/glue/theme_change_processor.h" |
37 #include "chrome/browser/sync/glue/theme_data_type_controller.h" | 32 #include "chrome/browser/sync/glue/theme_data_type_controller.h" |
38 #include "chrome/browser/sync/glue/theme_model_associator.h" | 33 #include "chrome/browser/sync/glue/theme_model_associator.h" |
39 #include "chrome/browser/sync/glue/typed_url_change_processor.h" | 34 #include "chrome/browser/sync/glue/typed_url_change_processor.h" |
40 #include "chrome/browser/sync/glue/typed_url_data_type_controller.h" | 35 #include "chrome/browser/sync/glue/typed_url_data_type_controller.h" |
41 #include "chrome/browser/sync/glue/typed_url_model_associator.h" | 36 #include "chrome/browser/sync/glue/typed_url_model_associator.h" |
42 #include "chrome/browser/sync/profile_sync_service.h" | 37 #include "chrome/browser/sync/profile_sync_service.h" |
43 #include "chrome/browser/sync/profile_sync_factory_impl.h" | 38 #include "chrome/browser/sync/profile_sync_factory_impl.h" |
44 #include "chrome/browser/sync/signin_manager.h" | 39 #include "chrome/browser/sync/signin_manager.h" |
45 #include "chrome/browser/webdata/web_data_service.h" | 40 #include "chrome/browser/webdata/web_data_service.h" |
46 #include "chrome/common/chrome_switches.h" | 41 #include "chrome/common/chrome_switches.h" |
47 | 42 |
48 using browser_sync::AppChangeProcessor; | |
49 using browser_sync::AppDataTypeController; | 43 using browser_sync::AppDataTypeController; |
50 using browser_sync::AppModelAssociator; | |
51 using browser_sync::AutofillChangeProcessor; | 44 using browser_sync::AutofillChangeProcessor; |
52 using browser_sync::AutofillProfileChangeProcessor; | 45 using browser_sync::AutofillProfileChangeProcessor; |
53 using browser_sync::AutofillDataTypeController; | 46 using browser_sync::AutofillDataTypeController; |
54 using browser_sync::AutofillProfileDataTypeController; | 47 using browser_sync::AutofillProfileDataTypeController; |
55 using browser_sync::AutofillModelAssociator; | 48 using browser_sync::AutofillModelAssociator; |
56 using browser_sync::AutofillProfileModelAssociator; | 49 using browser_sync::AutofillProfileModelAssociator; |
57 using browser_sync::BookmarkChangeProcessor; | 50 using browser_sync::BookmarkChangeProcessor; |
58 using browser_sync::BookmarkDataTypeController; | 51 using browser_sync::BookmarkDataTypeController; |
59 using browser_sync::BookmarkModelAssociator; | 52 using browser_sync::BookmarkModelAssociator; |
60 using browser_sync::DataTypeController; | 53 using browser_sync::DataTypeController; |
61 using browser_sync::DataTypeManager; | 54 using browser_sync::DataTypeManager; |
62 using browser_sync::DataTypeManagerImpl; | 55 using browser_sync::DataTypeManagerImpl; |
63 using browser_sync::ExtensionChangeProcessor; | |
64 using browser_sync::ExtensionDataTypeController; | 56 using browser_sync::ExtensionDataTypeController; |
65 using browser_sync::ExtensionModelAssociator; | |
66 using browser_sync::GenericChangeProcessor; | 57 using browser_sync::GenericChangeProcessor; |
67 using browser_sync::PasswordChangeProcessor; | 58 using browser_sync::PasswordChangeProcessor; |
68 using browser_sync::PasswordDataTypeController; | 59 using browser_sync::PasswordDataTypeController; |
69 using browser_sync::PasswordModelAssociator; | 60 using browser_sync::PasswordModelAssociator; |
70 using browser_sync::PreferenceDataTypeController; | 61 using browser_sync::PreferenceDataTypeController; |
71 using browser_sync::SessionChangeProcessor; | 62 using browser_sync::SessionChangeProcessor; |
72 using browser_sync::SessionDataTypeController; | 63 using browser_sync::SessionDataTypeController; |
73 using browser_sync::SessionModelAssociator; | 64 using browser_sync::SessionModelAssociator; |
74 using browser_sync::SyncBackendHost; | 65 using browser_sync::SyncBackendHost; |
75 using browser_sync::ThemeChangeProcessor; | 66 using browser_sync::ThemeChangeProcessor; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 DataTypeManager* ProfileSyncFactoryImpl::CreateDataTypeManager( | 157 DataTypeManager* ProfileSyncFactoryImpl::CreateDataTypeManager( |
167 SyncBackendHost* backend, | 158 SyncBackendHost* backend, |
168 const DataTypeController::TypeMap& controllers) { | 159 const DataTypeController::TypeMap& controllers) { |
169 return new DataTypeManagerImpl(backend, controllers); | 160 return new DataTypeManagerImpl(backend, controllers); |
170 } | 161 } |
171 | 162 |
172 ProfileSyncFactory::SyncComponents | 163 ProfileSyncFactory::SyncComponents |
173 ProfileSyncFactoryImpl::CreateAppSyncComponents( | 164 ProfileSyncFactoryImpl::CreateAppSyncComponents( |
174 ProfileSyncService* profile_sync_service, | 165 ProfileSyncService* profile_sync_service, |
175 UnrecoverableErrorHandler* error_handler) { | 166 UnrecoverableErrorHandler* error_handler) { |
176 // For now we simply use extensions sync objects with the app sync | 167 SyncableService* app_sync_service = |
177 // traits. If apps become more than simply extensions, we may have | |
178 // to write our own apps model associator and/or change processor. | |
179 ExtensionServiceInterface* extension_service = | |
180 profile_sync_service->profile()->GetExtensionService(); | 168 profile_sync_service->profile()->GetExtensionService(); |
181 sync_api::UserShare* user_share = profile_sync_service->GetUserShare(); | 169 sync_api::UserShare* user_share = profile_sync_service->GetUserShare(); |
182 AppModelAssociator* model_associator = | 170 GenericChangeProcessor* change_processor = |
183 new AppModelAssociator(extension_service, user_share); | 171 new GenericChangeProcessor(app_sync_service, error_handler, user_share); |
184 AppChangeProcessor* change_processor = | 172 browser_sync::SyncableServiceAdapter* sync_service_adapter = |
185 new AppChangeProcessor(error_handler); | 173 new browser_sync::SyncableServiceAdapter(syncable::APPS, |
186 return SyncComponents(model_associator, change_processor); | 174 app_sync_service, |
| 175 change_processor); |
| 176 return SyncComponents(sync_service_adapter, change_processor); |
187 } | 177 } |
188 | 178 |
189 ProfileSyncFactory::SyncComponents | 179 ProfileSyncFactory::SyncComponents |
190 ProfileSyncFactoryImpl::CreateAutofillSyncComponents( | 180 ProfileSyncFactoryImpl::CreateAutofillSyncComponents( |
191 ProfileSyncService* profile_sync_service, | 181 ProfileSyncService* profile_sync_service, |
192 WebDatabase* web_database, | 182 WebDatabase* web_database, |
193 PersonalDataManager* personal_data, | 183 PersonalDataManager* personal_data, |
194 browser_sync::UnrecoverableErrorHandler* error_handler) { | 184 browser_sync::UnrecoverableErrorHandler* error_handler) { |
195 | 185 |
196 AutofillModelAssociator* model_associator = | 186 AutofillModelAssociator* model_associator = |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 BookmarkChangeProcessor* change_processor = | 228 BookmarkChangeProcessor* change_processor = |
239 new BookmarkChangeProcessor(model_associator, | 229 new BookmarkChangeProcessor(model_associator, |
240 error_handler); | 230 error_handler); |
241 return SyncComponents(model_associator, change_processor); | 231 return SyncComponents(model_associator, change_processor); |
242 } | 232 } |
243 | 233 |
244 ProfileSyncFactory::SyncComponents | 234 ProfileSyncFactory::SyncComponents |
245 ProfileSyncFactoryImpl::CreateExtensionSyncComponents( | 235 ProfileSyncFactoryImpl::CreateExtensionSyncComponents( |
246 ProfileSyncService* profile_sync_service, | 236 ProfileSyncService* profile_sync_service, |
247 UnrecoverableErrorHandler* error_handler) { | 237 UnrecoverableErrorHandler* error_handler) { |
248 ExtensionServiceInterface* extension_service = | 238 SyncableService* extension_sync_service = |
249 profile_sync_service->profile()->GetExtensionService(); | 239 profile_sync_service->profile()->GetExtensionService(); |
250 sync_api::UserShare* user_share = profile_sync_service->GetUserShare(); | 240 sync_api::UserShare* user_share = profile_sync_service->GetUserShare(); |
251 ExtensionModelAssociator* model_associator = | 241 GenericChangeProcessor* change_processor = |
252 new ExtensionModelAssociator(extension_service, user_share); | 242 new GenericChangeProcessor(extension_sync_service, error_handler, |
253 ExtensionChangeProcessor* change_processor = | 243 user_share); |
254 new ExtensionChangeProcessor(error_handler); | 244 browser_sync::SyncableServiceAdapter* sync_service_adapter = |
255 return SyncComponents(model_associator, change_processor); | 245 new browser_sync::SyncableServiceAdapter(syncable::EXTENSIONS, |
| 246 extension_sync_service, |
| 247 change_processor); |
| 248 return SyncComponents(sync_service_adapter, change_processor); |
256 } | 249 } |
257 | 250 |
258 ProfileSyncFactory::SyncComponents | 251 ProfileSyncFactory::SyncComponents |
259 ProfileSyncFactoryImpl::CreatePasswordSyncComponents( | 252 ProfileSyncFactoryImpl::CreatePasswordSyncComponents( |
260 ProfileSyncService* profile_sync_service, | 253 ProfileSyncService* profile_sync_service, |
261 PasswordStore* password_store, | 254 PasswordStore* password_store, |
262 UnrecoverableErrorHandler* error_handler) { | 255 UnrecoverableErrorHandler* error_handler) { |
263 PasswordModelAssociator* model_associator = | 256 PasswordModelAssociator* model_associator = |
264 new PasswordModelAssociator(profile_sync_service, | 257 new PasswordModelAssociator(profile_sync_service, |
265 password_store); | 258 password_store); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 ProfileSyncFactory::SyncComponents | 308 ProfileSyncFactory::SyncComponents |
316 ProfileSyncFactoryImpl::CreateSessionSyncComponents( | 309 ProfileSyncFactoryImpl::CreateSessionSyncComponents( |
317 ProfileSyncService* profile_sync_service, | 310 ProfileSyncService* profile_sync_service, |
318 UnrecoverableErrorHandler* error_handler) { | 311 UnrecoverableErrorHandler* error_handler) { |
319 SessionModelAssociator* model_associator = | 312 SessionModelAssociator* model_associator = |
320 new SessionModelAssociator(profile_sync_service); | 313 new SessionModelAssociator(profile_sync_service); |
321 SessionChangeProcessor* change_processor = | 314 SessionChangeProcessor* change_processor = |
322 new SessionChangeProcessor(error_handler, model_associator); | 315 new SessionChangeProcessor(error_handler, model_associator); |
323 return SyncComponents(model_associator, change_processor); | 316 return SyncComponents(model_associator, change_processor); |
324 } | 317 } |
OLD | NEW |