Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Side by Side Diff: chrome/browser/sync/profile_sync_factory_impl.cc

Issue 5159001: Rest of the autofill work. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Diff against the first part of the review. Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/profile.h" 7 #include "chrome/browser/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...) Expand 10 before | Expand all | Expand 10 after
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)) {
lipalani 2010/12/08 21:37:46 check for disable new autofill profile switch as w
158 pss->RegisterDataTypeController(new AutofillProfileDataTypeController(
159 this, profile_, pss));
160 }
149 return pss; 161 return pss;
150 } 162 }
151 163
152 DataTypeManager* ProfileSyncFactoryImpl::CreateDataTypeManager( 164 DataTypeManager* ProfileSyncFactoryImpl::CreateDataTypeManager(
153 SyncBackendHost* backend, 165 SyncBackendHost* backend,
154 const DataTypeController::TypeMap& controllers) { 166 const DataTypeController::TypeMap& controllers) {
155 return new DataTypeManagerImpl(backend, controllers); 167 return new DataTypeManagerImpl(backend, controllers);
156 } 168 }
157 169
158 ProfileSyncFactory::SyncComponents 170 ProfileSyncFactory::SyncComponents
159 ProfileSyncFactoryImpl::CreateAppSyncComponents( 171 ProfileSyncFactoryImpl::CreateAppSyncComponents(
160 ProfileSyncService* profile_sync_service, 172 ProfileSyncService* profile_sync_service,
161 UnrecoverableErrorHandler* error_handler) { 173 UnrecoverableErrorHandler* error_handler) {
162 browser_sync::ExtensionSyncTraits traits = browser_sync::GetAppSyncTraits(); 174 browser_sync::ExtensionSyncTraits traits = browser_sync::GetAppSyncTraits();
163 // For now we simply use extensions sync objects with the app sync 175 // For now we simply use extensions sync objects with the app sync
164 // traits. If apps become more than simply extensions, we may have 176 // traits. If apps become more than simply extensions, we may have
165 // to write our own apps model associator and/or change processor. 177 // to write our own apps model associator and/or change processor.
166 ExtensionModelAssociator* model_associator = 178 ExtensionModelAssociator* model_associator =
167 new ExtensionModelAssociator(traits, profile_sync_service); 179 new ExtensionModelAssociator(traits, profile_sync_service);
168 ExtensionChangeProcessor* change_processor = 180 ExtensionChangeProcessor* change_processor =
169 new ExtensionChangeProcessor(traits, error_handler); 181 new ExtensionChangeProcessor(traits, error_handler);
170 return SyncComponents(model_associator, change_processor); 182 return SyncComponents(model_associator, change_processor);
171 } 183 }
172 184
185
186
173 ProfileSyncFactory::SyncComponents 187 ProfileSyncFactory::SyncComponents
174 ProfileSyncFactoryImpl::CreateAutofillSyncComponents( 188 ProfileSyncFactoryImpl::CreateAutofillSyncComponents(
175 ProfileSyncService* profile_sync_service, 189 ProfileSyncService* profile_sync_service,
176 WebDatabase* web_database, 190 WebDatabase* web_database,
177 PersonalDataManager* personal_data, 191 PersonalDataManager* personal_data,
178 browser_sync::UnrecoverableErrorHandler* error_handler) { 192 browser_sync::UnrecoverableErrorHandler* error_handler) {
179 193
180 if (command_line_->HasSwitch(switches::kEnableNewAutofillDataType)) { 194 if (command_line_->HasSwitch(switches::kEnableNewAutofillDataType)) {
181 AutofillModelAssociator* model_associator = 195 AutofillModelAssociator* model_associator =
182 new AutofillModelAssociator(profile_sync_service, 196 new AutofillModelAssociator(profile_sync_service,
(...skipping 13 matching lines...) Expand all
196 AutofillChangeProcessor2* change_processor = 210 AutofillChangeProcessor2* change_processor =
197 new AutofillChangeProcessor2(model_associator, 211 new AutofillChangeProcessor2(model_associator,
198 web_database, 212 web_database,
199 personal_data, 213 personal_data,
200 error_handler); 214 error_handler);
201 return SyncComponents(model_associator, change_processor); 215 return SyncComponents(model_associator, change_processor);
202 } 216 }
203 } 217 }
204 218
205 ProfileSyncFactory::SyncComponents 219 ProfileSyncFactory::SyncComponents
220 ProfileSyncFactoryImpl::CreateAutofillProfileSyncComponents(
221 ProfileSyncService* profile_sync_service,
222 WebDatabase* web_database,
223 PersonalDataManager* personal_data,
224 browser_sync::UnrecoverableErrorHandler* error_handler) {
225
226 AutofillProfileModelAssociator* model_associator =
227 new AutofillProfileModelAssociator(profile_sync_service,
228 web_database,
229 personal_data);
230 AutofillProfileChangeProcessor* change_processor =
231 new AutofillProfileChangeProcessor(model_associator,
232 web_database,
233 personal_data,
234 error_handler);
235 return SyncComponents(model_associator, change_processor);
236 }
237
238 ProfileSyncFactory::SyncComponents
206 ProfileSyncFactoryImpl::CreateBookmarkSyncComponents( 239 ProfileSyncFactoryImpl::CreateBookmarkSyncComponents(
207 ProfileSyncService* profile_sync_service, 240 ProfileSyncService* profile_sync_service,
208 UnrecoverableErrorHandler* error_handler) { 241 UnrecoverableErrorHandler* error_handler) {
209 BookmarkModelAssociator* model_associator = 242 BookmarkModelAssociator* model_associator =
210 new BookmarkModelAssociator(profile_sync_service, 243 new BookmarkModelAssociator(profile_sync_service,
211 error_handler); 244 error_handler);
212 BookmarkChangeProcessor* change_processor = 245 BookmarkChangeProcessor* change_processor =
213 new BookmarkChangeProcessor(model_associator, 246 new BookmarkChangeProcessor(model_associator,
214 error_handler); 247 error_handler);
215 return SyncComponents(model_associator, change_processor); 248 return SyncComponents(model_associator, change_processor);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 ProfileSyncFactory::SyncComponents 317 ProfileSyncFactory::SyncComponents
285 ProfileSyncFactoryImpl::CreateSessionSyncComponents( 318 ProfileSyncFactoryImpl::CreateSessionSyncComponents(
286 ProfileSyncService* profile_sync_service, 319 ProfileSyncService* profile_sync_service,
287 UnrecoverableErrorHandler* error_handler) { 320 UnrecoverableErrorHandler* error_handler) {
288 SessionModelAssociator* model_associator = 321 SessionModelAssociator* model_associator =
289 new SessionModelAssociator(profile_sync_service); 322 new SessionModelAssociator(profile_sync_service);
290 SessionChangeProcessor* change_processor = 323 SessionChangeProcessor* change_processor =
291 new SessionChangeProcessor(error_handler, model_associator); 324 new SessionChangeProcessor(error_handler, model_associator);
292 return SyncComponents(model_associator, change_processor); 325 return SyncComponents(model_associator, change_processor);
293 } 326 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698