OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/defaults.h" | 6 #include "chrome/browser/defaults.h" |
7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
8 #include "chrome/browser/sync/glue/app_data_type_controller.h" | 8 #include "chrome/browser/sync/glue/app_data_type_controller.h" |
9 #include "chrome/browser/sync/glue/autofill_change_processor.h" | 9 #include "chrome/browser/sync/glue/autofill_change_processor.h" |
10 #include "chrome/browser/sync/glue/autofill_change_processor2.h" | 10 #include "chrome/browser/sync/glue/autofill_change_processor2.h" |
| 11 #include "chrome/browser/sync/glue/autofill_profile_change_processor.h" |
11 #include "chrome/browser/sync/glue/autofill_data_type_controller.h" | 12 #include "chrome/browser/sync/glue/autofill_data_type_controller.h" |
| 13 #include "chrome/browser/sync/glue/autofill_profile_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_model_associator2.h" | 15 #include "chrome/browser/sync/glue/autofill_model_associator2.h" |
| 16 #include "chrome/browser/sync/glue/autofill_profile_model_associator.h" |
14 #include "chrome/browser/sync/glue/bookmark_change_processor.h" | 17 #include "chrome/browser/sync/glue/bookmark_change_processor.h" |
15 #include "chrome/browser/sync/glue/bookmark_data_type_controller.h" | 18 #include "chrome/browser/sync/glue/bookmark_data_type_controller.h" |
16 #include "chrome/browser/sync/glue/bookmark_model_associator.h" | 19 #include "chrome/browser/sync/glue/bookmark_model_associator.h" |
17 #include "chrome/browser/sync/glue/data_type_manager_impl.h" | 20 #include "chrome/browser/sync/glue/data_type_manager_impl.h" |
18 #include "chrome/browser/sync/glue/extension_change_processor.h" | 21 #include "chrome/browser/sync/glue/extension_change_processor.h" |
19 #include "chrome/browser/sync/glue/extension_data_type_controller.h" | 22 #include "chrome/browser/sync/glue/extension_data_type_controller.h" |
20 #include "chrome/browser/sync/glue/extension_model_associator.h" | 23 #include "chrome/browser/sync/glue/extension_model_associator.h" |
21 #include "chrome/browser/sync/glue/extension_sync_traits.h" | 24 #include "chrome/browser/sync/glue/extension_sync_traits.h" |
22 #include "chrome/browser/sync/glue/password_change_processor.h" | 25 #include "chrome/browser/sync/glue/password_change_processor.h" |
23 #include "chrome/browser/sync/glue/password_data_type_controller.h" | 26 #include "chrome/browser/sync/glue/password_data_type_controller.h" |
24 #include "chrome/browser/sync/glue/password_model_associator.h" | 27 #include "chrome/browser/sync/glue/password_model_associator.h" |
25 #include "chrome/browser/sync/glue/preference_change_processor.h" | 28 #include "chrome/browser/sync/glue/preference_change_processor.h" |
26 #include "chrome/browser/sync/glue/preference_data_type_controller.h" | 29 #include "chrome/browser/sync/glue/preference_data_type_controller.h" |
27 #include "chrome/browser/sync/glue/preference_model_associator.h" | 30 #include "chrome/browser/sync/glue/preference_model_associator.h" |
28 #include "chrome/browser/sync/glue/session_change_processor.h" | 31 #include "chrome/browser/sync/glue/session_change_processor.h" |
29 #include "chrome/browser/sync/glue/session_data_type_controller.h" | 32 #include "chrome/browser/sync/glue/session_data_type_controller.h" |
30 #include "chrome/browser/sync/glue/session_model_associator.h" | 33 #include "chrome/browser/sync/glue/session_model_associator.h" |
31 #include "chrome/browser/sync/glue/sync_backend_host.h" | 34 #include "chrome/browser/sync/glue/sync_backend_host.h" |
32 #include "chrome/browser/sync/glue/theme_change_processor.h" | 35 #include "chrome/browser/sync/glue/theme_change_processor.h" |
33 #include "chrome/browser/sync/glue/theme_data_type_controller.h" | 36 #include "chrome/browser/sync/glue/theme_data_type_controller.h" |
34 #include "chrome/browser/sync/glue/theme_model_associator.h" | 37 #include "chrome/browser/sync/glue/theme_model_associator.h" |
35 #include "chrome/browser/sync/glue/typed_url_change_processor.h" | 38 #include "chrome/browser/sync/glue/typed_url_change_processor.h" |
36 #include "chrome/browser/sync/glue/typed_url_data_type_controller.h" | 39 #include "chrome/browser/sync/glue/typed_url_data_type_controller.h" |
37 #include "chrome/browser/sync/glue/typed_url_model_associator.h" | 40 #include "chrome/browser/sync/glue/typed_url_model_associator.h" |
38 #include "chrome/browser/sync/profile_sync_service.h" | 41 #include "chrome/browser/sync/profile_sync_service.h" |
39 #include "chrome/browser/sync/profile_sync_factory_impl.h" | 42 #include "chrome/browser/sync/profile_sync_factory_impl.h" |
40 #include "chrome/browser/webdata/web_data_service.h" | 43 #include "chrome/browser/webdata/web_data_service.h" |
41 #include "chrome/common/chrome_switches.h" | 44 #include "chrome/common/chrome_switches.h" |
| 45 #include "chrome/common/pref_names.h" |
42 | 46 |
43 using browser_sync::AppDataTypeController; | 47 using browser_sync::AppDataTypeController; |
44 using browser_sync::AutofillChangeProcessor; | 48 using browser_sync::AutofillChangeProcessor; |
45 using browser_sync::AutofillChangeProcessor2; | 49 using browser_sync::AutofillChangeProcessor2; |
| 50 using browser_sync::AutofillProfileChangeProcessor; |
46 using browser_sync::AutofillDataTypeController; | 51 using browser_sync::AutofillDataTypeController; |
| 52 using browser_sync::AutofillProfileDataTypeController; |
47 using browser_sync::AutofillModelAssociator; | 53 using browser_sync::AutofillModelAssociator; |
48 using browser_sync::AutofillModelAssociator2; | 54 using browser_sync::AutofillModelAssociator2; |
| 55 using browser_sync::AutofillProfileModelAssociator; |
49 using browser_sync::BookmarkChangeProcessor; | 56 using browser_sync::BookmarkChangeProcessor; |
50 using browser_sync::BookmarkDataTypeController; | 57 using browser_sync::BookmarkDataTypeController; |
51 using browser_sync::BookmarkModelAssociator; | 58 using browser_sync::BookmarkModelAssociator; |
52 using browser_sync::DataTypeController; | 59 using browser_sync::DataTypeController; |
53 using browser_sync::DataTypeManager; | 60 using browser_sync::DataTypeManager; |
54 using browser_sync::DataTypeManagerImpl; | 61 using browser_sync::DataTypeManagerImpl; |
55 using browser_sync::ExtensionChangeProcessor; | 62 using browser_sync::ExtensionChangeProcessor; |
56 using browser_sync::ExtensionDataTypeController; | 63 using browser_sync::ExtensionDataTypeController; |
57 using browser_sync::ExtensionModelAssociator; | 64 using browser_sync::ExtensionModelAssociator; |
58 using browser_sync::PasswordChangeProcessor; | 65 using browser_sync::PasswordChangeProcessor; |
(...skipping 80 matching lines...) Loading... |
139 pss->RegisterDataTypeController( | 146 pss->RegisterDataTypeController( |
140 new TypedUrlDataTypeController(this, profile_, pss)); | 147 new TypedUrlDataTypeController(this, profile_, pss)); |
141 } | 148 } |
142 | 149 |
143 // Session sync is disabled by default. Register only if explicitly | 150 // Session sync is disabled by default. Register only if explicitly |
144 // enabled. | 151 // enabled. |
145 if (command_line_->HasSwitch(switches::kEnableSyncSessions)) { | 152 if (command_line_->HasSwitch(switches::kEnableSyncSessions)) { |
146 pss->RegisterDataTypeController( | 153 pss->RegisterDataTypeController( |
147 new SessionDataTypeController(this, pss)); | 154 new SessionDataTypeController(this, pss)); |
148 } | 155 } |
| 156 |
| 157 if (!command_line_->HasSwitch(switches::kDisableSyncAutofillProfile) && |
| 158 command_line_->HasSwitch(switches::kEnableSyncNewAutofill)) { |
| 159 pss->RegisterDataTypeController(new AutofillProfileDataTypeController( |
| 160 this, profile_, pss)); |
| 161 } |
149 return pss; | 162 return pss; |
150 } | 163 } |
151 | 164 |
152 DataTypeManager* ProfileSyncFactoryImpl::CreateDataTypeManager( | 165 DataTypeManager* ProfileSyncFactoryImpl::CreateDataTypeManager( |
153 SyncBackendHost* backend, | 166 SyncBackendHost* backend, |
154 const DataTypeController::TypeMap& controllers) { | 167 const DataTypeController::TypeMap& controllers) { |
155 return new DataTypeManagerImpl(backend, controllers); | 168 return new DataTypeManagerImpl(backend, controllers); |
156 } | 169 } |
157 | 170 |
158 ProfileSyncFactory::SyncComponents | 171 ProfileSyncFactory::SyncComponents |
(...skipping 37 matching lines...) Loading... |
196 AutofillChangeProcessor2* change_processor = | 209 AutofillChangeProcessor2* change_processor = |
197 new AutofillChangeProcessor2(model_associator, | 210 new AutofillChangeProcessor2(model_associator, |
198 web_database, | 211 web_database, |
199 personal_data, | 212 personal_data, |
200 error_handler); | 213 error_handler); |
201 return SyncComponents(model_associator, change_processor); | 214 return SyncComponents(model_associator, change_processor); |
202 } | 215 } |
203 } | 216 } |
204 | 217 |
205 ProfileSyncFactory::SyncComponents | 218 ProfileSyncFactory::SyncComponents |
| 219 ProfileSyncFactoryImpl::CreateAutofillProfileSyncComponents( |
| 220 ProfileSyncService* profile_sync_service, |
| 221 WebDatabase* web_database, |
| 222 PersonalDataManager* personal_data, |
| 223 browser_sync::UnrecoverableErrorHandler* error_handler) { |
| 224 |
| 225 AutofillProfileModelAssociator* model_associator = |
| 226 new AutofillProfileModelAssociator(profile_sync_service, |
| 227 web_database, |
| 228 personal_data); |
| 229 AutofillProfileChangeProcessor* change_processor = |
| 230 new AutofillProfileChangeProcessor(model_associator, |
| 231 web_database, |
| 232 personal_data, |
| 233 error_handler); |
| 234 return SyncComponents(model_associator, change_processor); |
| 235 } |
| 236 |
| 237 ProfileSyncFactory::SyncComponents |
206 ProfileSyncFactoryImpl::CreateBookmarkSyncComponents( | 238 ProfileSyncFactoryImpl::CreateBookmarkSyncComponents( |
207 ProfileSyncService* profile_sync_service, | 239 ProfileSyncService* profile_sync_service, |
208 UnrecoverableErrorHandler* error_handler) { | 240 UnrecoverableErrorHandler* error_handler) { |
209 BookmarkModelAssociator* model_associator = | 241 BookmarkModelAssociator* model_associator = |
210 new BookmarkModelAssociator(profile_sync_service, | 242 new BookmarkModelAssociator(profile_sync_service, |
211 error_handler); | 243 error_handler); |
212 BookmarkChangeProcessor* change_processor = | 244 BookmarkChangeProcessor* change_processor = |
213 new BookmarkChangeProcessor(model_associator, | 245 new BookmarkChangeProcessor(model_associator, |
214 error_handler); | 246 error_handler); |
215 return SyncComponents(model_associator, change_processor); | 247 return SyncComponents(model_associator, change_processor); |
(...skipping 68 matching lines...) Loading... |
284 ProfileSyncFactory::SyncComponents | 316 ProfileSyncFactory::SyncComponents |
285 ProfileSyncFactoryImpl::CreateSessionSyncComponents( | 317 ProfileSyncFactoryImpl::CreateSessionSyncComponents( |
286 ProfileSyncService* profile_sync_service, | 318 ProfileSyncService* profile_sync_service, |
287 UnrecoverableErrorHandler* error_handler) { | 319 UnrecoverableErrorHandler* error_handler) { |
288 SessionModelAssociator* model_associator = | 320 SessionModelAssociator* model_associator = |
289 new SessionModelAssociator(profile_sync_service); | 321 new SessionModelAssociator(profile_sync_service); |
290 SessionChangeProcessor* change_processor = | 322 SessionChangeProcessor* change_processor = |
291 new SessionChangeProcessor(error_handler, model_associator); | 323 new SessionChangeProcessor(error_handler, model_associator); |
292 return SyncComponents(model_associator, change_processor); | 324 return SyncComponents(model_associator, change_processor); |
293 } | 325 } |
OLD | NEW |