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