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 #include "chrome/common/pref_names.h" | 42 #include "chrome/common/pref_names.h" |
48 | 43 |
49 using browser_sync::AppChangeProcessor; | |
50 using browser_sync::AppDataTypeController; | 44 using browser_sync::AppDataTypeController; |
51 using browser_sync::AppModelAssociator; | |
52 using browser_sync::AutofillChangeProcessor; | 45 using browser_sync::AutofillChangeProcessor; |
53 using browser_sync::AutofillProfileChangeProcessor; | 46 using browser_sync::AutofillProfileChangeProcessor; |
54 using browser_sync::AutofillDataTypeController; | 47 using browser_sync::AutofillDataTypeController; |
55 using browser_sync::AutofillProfileDataTypeController; | 48 using browser_sync::AutofillProfileDataTypeController; |
56 using browser_sync::AutofillModelAssociator; | 49 using browser_sync::AutofillModelAssociator; |
57 using browser_sync::AutofillProfileModelAssociator; | 50 using browser_sync::AutofillProfileModelAssociator; |
58 using browser_sync::BookmarkChangeProcessor; | 51 using browser_sync::BookmarkChangeProcessor; |
59 using browser_sync::BookmarkDataTypeController; | 52 using browser_sync::BookmarkDataTypeController; |
60 using browser_sync::BookmarkModelAssociator; | 53 using browser_sync::BookmarkModelAssociator; |
61 using browser_sync::DataTypeController; | 54 using browser_sync::DataTypeController; |
62 using browser_sync::DataTypeManager; | 55 using browser_sync::DataTypeManager; |
63 using browser_sync::DataTypeManagerImpl; | 56 using browser_sync::DataTypeManagerImpl; |
64 using browser_sync::ExtensionChangeProcessor; | |
65 using browser_sync::ExtensionDataTypeController; | 57 using browser_sync::ExtensionDataTypeController; |
66 using browser_sync::ExtensionModelAssociator; | |
67 using browser_sync::GenericChangeProcessor; | 58 using browser_sync::GenericChangeProcessor; |
68 using browser_sync::PasswordChangeProcessor; | 59 using browser_sync::PasswordChangeProcessor; |
69 using browser_sync::PasswordDataTypeController; | 60 using browser_sync::PasswordDataTypeController; |
70 using browser_sync::PasswordModelAssociator; | 61 using browser_sync::PasswordModelAssociator; |
71 using browser_sync::PreferenceDataTypeController; | 62 using browser_sync::PreferenceDataTypeController; |
72 using browser_sync::SessionChangeProcessor; | 63 using browser_sync::SessionChangeProcessor; |
73 using browser_sync::SessionDataTypeController; | 64 using browser_sync::SessionDataTypeController; |
74 using browser_sync::SessionModelAssociator; | 65 using browser_sync::SessionModelAssociator; |
75 using browser_sync::SyncBackendHost; | 66 using browser_sync::SyncBackendHost; |
76 using browser_sync::ThemeChangeProcessor; | 67 using browser_sync::ThemeChangeProcessor; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 DataTypeManager* ProfileSyncFactoryImpl::CreateDataTypeManager( | 159 DataTypeManager* ProfileSyncFactoryImpl::CreateDataTypeManager( |
169 SyncBackendHost* backend, | 160 SyncBackendHost* backend, |
170 const DataTypeController::TypeMap& controllers) { | 161 const DataTypeController::TypeMap& controllers) { |
171 return new DataTypeManagerImpl(backend, controllers); | 162 return new DataTypeManagerImpl(backend, controllers); |
172 } | 163 } |
173 | 164 |
174 ProfileSyncFactory::SyncComponents | 165 ProfileSyncFactory::SyncComponents |
175 ProfileSyncFactoryImpl::CreateAppSyncComponents( | 166 ProfileSyncFactoryImpl::CreateAppSyncComponents( |
176 ProfileSyncService* profile_sync_service, | 167 ProfileSyncService* profile_sync_service, |
177 UnrecoverableErrorHandler* error_handler) { | 168 UnrecoverableErrorHandler* error_handler) { |
178 // For now we simply use extensions sync objects with the app sync | 169 SyncableService* app_sync_service = |
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 = | |
182 profile_sync_service->profile()->GetExtensionService(); | 170 profile_sync_service->profile()->GetExtensionService(); |
183 sync_api::UserShare* user_share = profile_sync_service->GetUserShare(); | 171 sync_api::UserShare* user_share = profile_sync_service->GetUserShare(); |
184 AppModelAssociator* model_associator = | 172 GenericChangeProcessor* change_processor = |
185 new AppModelAssociator(extension_service, user_share); | 173 new GenericChangeProcessor(app_sync_service, error_handler, user_share); |
186 AppChangeProcessor* change_processor = | 174 browser_sync::SyncableServiceAdapter* sync_service_adapter = |
187 new AppChangeProcessor(error_handler); | 175 new browser_sync::SyncableServiceAdapter(syncable::APPS, |
188 return SyncComponents(model_associator, change_processor); | 176 app_sync_service, |
| 177 change_processor); |
| 178 return SyncComponents(sync_service_adapter, change_processor); |
189 } | 179 } |
190 | 180 |
191 ProfileSyncFactory::SyncComponents | 181 ProfileSyncFactory::SyncComponents |
192 ProfileSyncFactoryImpl::CreateAutofillSyncComponents( | 182 ProfileSyncFactoryImpl::CreateAutofillSyncComponents( |
193 ProfileSyncService* profile_sync_service, | 183 ProfileSyncService* profile_sync_service, |
194 WebDatabase* web_database, | 184 WebDatabase* web_database, |
195 PersonalDataManager* personal_data, | 185 PersonalDataManager* personal_data, |
196 browser_sync::UnrecoverableErrorHandler* error_handler) { | 186 browser_sync::UnrecoverableErrorHandler* error_handler) { |
197 | 187 |
198 AutofillModelAssociator* model_associator = | 188 AutofillModelAssociator* model_associator = |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 BookmarkChangeProcessor* change_processor = | 230 BookmarkChangeProcessor* change_processor = |
241 new BookmarkChangeProcessor(model_associator, | 231 new BookmarkChangeProcessor(model_associator, |
242 error_handler); | 232 error_handler); |
243 return SyncComponents(model_associator, change_processor); | 233 return SyncComponents(model_associator, change_processor); |
244 } | 234 } |
245 | 235 |
246 ProfileSyncFactory::SyncComponents | 236 ProfileSyncFactory::SyncComponents |
247 ProfileSyncFactoryImpl::CreateExtensionSyncComponents( | 237 ProfileSyncFactoryImpl::CreateExtensionSyncComponents( |
248 ProfileSyncService* profile_sync_service, | 238 ProfileSyncService* profile_sync_service, |
249 UnrecoverableErrorHandler* error_handler) { | 239 UnrecoverableErrorHandler* error_handler) { |
250 ExtensionServiceInterface* extension_service = | 240 SyncableService* extension_sync_service = |
251 profile_sync_service->profile()->GetExtensionService(); | 241 profile_sync_service->profile()->GetExtensionService(); |
252 sync_api::UserShare* user_share = profile_sync_service->GetUserShare(); | 242 sync_api::UserShare* user_share = profile_sync_service->GetUserShare(); |
253 ExtensionModelAssociator* model_associator = | 243 GenericChangeProcessor* change_processor = |
254 new ExtensionModelAssociator(extension_service, user_share); | 244 new GenericChangeProcessor(extension_sync_service, error_handler, |
255 ExtensionChangeProcessor* change_processor = | 245 user_share); |
256 new ExtensionChangeProcessor(error_handler); | 246 browser_sync::SyncableServiceAdapter* sync_service_adapter = |
257 return SyncComponents(model_associator, change_processor); | 247 new browser_sync::SyncableServiceAdapter(syncable::EXTENSIONS, |
| 248 extension_sync_service, |
| 249 change_processor); |
| 250 return SyncComponents(sync_service_adapter, change_processor); |
258 } | 251 } |
259 | 252 |
260 ProfileSyncFactory::SyncComponents | 253 ProfileSyncFactory::SyncComponents |
261 ProfileSyncFactoryImpl::CreatePasswordSyncComponents( | 254 ProfileSyncFactoryImpl::CreatePasswordSyncComponents( |
262 ProfileSyncService* profile_sync_service, | 255 ProfileSyncService* profile_sync_service, |
263 PasswordStore* password_store, | 256 PasswordStore* password_store, |
264 UnrecoverableErrorHandler* error_handler) { | 257 UnrecoverableErrorHandler* error_handler) { |
265 PasswordModelAssociator* model_associator = | 258 PasswordModelAssociator* model_associator = |
266 new PasswordModelAssociator(profile_sync_service, | 259 new PasswordModelAssociator(profile_sync_service, |
267 password_store); | 260 password_store); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 ProfileSyncFactory::SyncComponents | 310 ProfileSyncFactory::SyncComponents |
318 ProfileSyncFactoryImpl::CreateSessionSyncComponents( | 311 ProfileSyncFactoryImpl::CreateSessionSyncComponents( |
319 ProfileSyncService* profile_sync_service, | 312 ProfileSyncService* profile_sync_service, |
320 UnrecoverableErrorHandler* error_handler) { | 313 UnrecoverableErrorHandler* error_handler) { |
321 SessionModelAssociator* model_associator = | 314 SessionModelAssociator* model_associator = |
322 new SessionModelAssociator(profile_sync_service); | 315 new SessionModelAssociator(profile_sync_service); |
323 SessionChangeProcessor* change_processor = | 316 SessionChangeProcessor* change_processor = |
324 new SessionChangeProcessor(error_handler, model_associator); | 317 new SessionChangeProcessor(error_handler, model_associator); |
325 return SyncComponents(model_associator, change_processor); | 318 return SyncComponents(model_associator, change_processor); |
326 } | 319 } |
OLD | NEW |