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

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

Issue 9834056: Moved WebDataService to ProfileKeyedService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: removed unchanged file Created 8 years, 8 months 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "build/build_config.h" 6 #include "build/build_config.h"
7 #include "chrome/browser/extensions/app_notification_manager.h" 7 #include "chrome/browser/extensions/app_notification_manager.h"
8 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/extensions/settings/settings_frontend.h" 9 #include "chrome/browser/extensions/settings/settings_frontend.h"
10 #include "chrome/browser/prefs/pref_model_associator.h" 10 #include "chrome/browser/prefs/pref_model_associator.h"
(...skipping 27 matching lines...) Expand all
38 #include "chrome/browser/sync/glue/theme_model_associator.h" 38 #include "chrome/browser/sync/glue/theme_model_associator.h"
39 #include "chrome/browser/sync/glue/typed_url_change_processor.h" 39 #include "chrome/browser/sync/glue/typed_url_change_processor.h"
40 #include "chrome/browser/sync/glue/typed_url_data_type_controller.h" 40 #include "chrome/browser/sync/glue/typed_url_data_type_controller.h"
41 #include "chrome/browser/sync/glue/typed_url_model_associator.h" 41 #include "chrome/browser/sync/glue/typed_url_model_associator.h"
42 #include "chrome/browser/sync/glue/ui_data_type_controller.h" 42 #include "chrome/browser/sync/glue/ui_data_type_controller.h"
43 #include "chrome/browser/sync/profile_sync_components_factory_impl.h" 43 #include "chrome/browser/sync/profile_sync_components_factory_impl.h"
44 #include "chrome/browser/sync/profile_sync_service.h" 44 #include "chrome/browser/sync/profile_sync_service.h"
45 #include "chrome/browser/webdata/autocomplete_syncable_service.h" 45 #include "chrome/browser/webdata/autocomplete_syncable_service.h"
46 #include "chrome/browser/webdata/autofill_profile_syncable_service.h" 46 #include "chrome/browser/webdata/autofill_profile_syncable_service.h"
47 #include "chrome/browser/webdata/web_data_service.h" 47 #include "chrome/browser/webdata/web_data_service.h"
48 #include "chrome/browser/webdata/web_data_service_factory.h"
48 #include "chrome/common/chrome_switches.h" 49 #include "chrome/common/chrome_switches.h"
49 #include "chrome/common/pref_names.h" 50 #include "chrome/common/pref_names.h"
50 #include "content/public/browser/browser_thread.h" 51 #include "content/public/browser/browser_thread.h"
51 52
52 using browser_sync::AppNotificationDataTypeController; 53 using browser_sync::AppNotificationDataTypeController;
53 using browser_sync::AutofillDataTypeController; 54 using browser_sync::AutofillDataTypeController;
54 using browser_sync::AutofillProfileDataTypeController; 55 using browser_sync::AutofillProfileDataTypeController;
55 using browser_sync::BookmarkChangeProcessor; 56 using browser_sync::BookmarkChangeProcessor;
56 using browser_sync::BookmarkDataTypeController; 57 using browser_sync::BookmarkDataTypeController;
57 using browser_sync::BookmarkModelAssociator; 58 using browser_sync::BookmarkModelAssociator;
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 base::WeakPtr<SyncableService> ProfileSyncComponentsFactoryImpl:: 217 base::WeakPtr<SyncableService> ProfileSyncComponentsFactoryImpl::
217 GetSyncableServiceForType(syncable::ModelType type) { 218 GetSyncableServiceForType(syncable::ModelType type) {
218 if (!profile_) { // For tests. 219 if (!profile_) { // For tests.
219 return base::WeakPtr<SyncableService>(); 220 return base::WeakPtr<SyncableService>();
220 } 221 }
221 switch (type) { 222 switch (type) {
222 case syncable::PREFERENCES: 223 case syncable::PREFERENCES:
223 return profile_->GetPrefs()->GetSyncableService()->AsWeakPtr(); 224 return profile_->GetPrefs()->GetSyncableService()->AsWeakPtr();
224 case syncable::AUTOFILL: 225 case syncable::AUTOFILL:
225 case syncable::AUTOFILL_PROFILE: { 226 case syncable::AUTOFILL_PROFILE: {
226 WebDataService* wds = 227 scoped_refptr<WebDataService> wds = WebDataServiceFactory::GetForProfile(
227 profile_->GetWebDataService(Profile::IMPLICIT_ACCESS); 228 profile_, Profile::IMPLICIT_ACCESS);
228 if (!wds) 229 if (!wds.get())
229 return base::WeakPtr<SyncableService>(); 230 return base::WeakPtr<SyncableService>();
230 if (type == syncable::AUTOFILL) 231 if (type == syncable::AUTOFILL)
231 return wds->GetAutocompleteSyncableService()->AsWeakPtr(); 232 return wds->GetAutocompleteSyncableService()->AsWeakPtr();
232 else 233 else
233 return wds->GetAutofillProfileSyncableService()->AsWeakPtr(); 234 return wds->GetAutofillProfileSyncableService()->AsWeakPtr();
234 } 235 }
235 case syncable::APPS: 236 case syncable::APPS:
236 case syncable::EXTENSIONS: 237 case syncable::EXTENSIONS:
237 return profile_->GetExtensionService()->AsWeakPtr(); 238 return profile_->GetExtensionService()->AsWeakPtr();
238 case syncable::SEARCH_ENGINES: 239 case syncable::SEARCH_ENGINES:
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 ProfileSyncComponentsFactory::SyncComponents 329 ProfileSyncComponentsFactory::SyncComponents
329 ProfileSyncComponentsFactoryImpl::CreateSessionSyncComponents( 330 ProfileSyncComponentsFactoryImpl::CreateSessionSyncComponents(
330 ProfileSyncService* profile_sync_service, 331 ProfileSyncService* profile_sync_service,
331 DataTypeErrorHandler* error_handler) { 332 DataTypeErrorHandler* error_handler) {
332 SessionModelAssociator* model_associator = 333 SessionModelAssociator* model_associator =
333 new SessionModelAssociator(profile_sync_service); 334 new SessionModelAssociator(profile_sync_service);
334 SessionChangeProcessor* change_processor = 335 SessionChangeProcessor* change_processor =
335 new SessionChangeProcessor(error_handler, model_associator); 336 new SessionChangeProcessor(error_handler, model_associator);
336 return SyncComponents(model_associator, change_processor); 337 return SyncComponents(model_associator, change_processor);
337 } 338 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698