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

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

Issue 1326353002: Remove dependency of PrefSyncableService on Profile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pref_model_associator
Patch Set: Fixing ChromeOS and Linux compilation Created 5 years, 3 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "chrome/browser/sync/chrome_sync_client.h" 5 #include "chrome/browser/sync/chrome_sync_client.h"
6 6
7 #include "chrome/browser/autofill/personal_data_manager_factory.h" 7 #include "chrome/browser/autofill/personal_data_manager_factory.h"
8 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 8 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
9 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" 9 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h"
10 #include "chrome/browser/history/history_service_factory.h" 10 #include "chrome/browser/history/history_service_factory.h"
11 #include "chrome/browser/password_manager/password_store_factory.h" 11 #include "chrome/browser/password_manager/password_store_factory.h"
12 #include "chrome/browser/prefs/pref_service_syncable.h" 12 #include "chrome/browser/prefs/pref_service_syncable.h"
13 #include "chrome/browser/prefs/pref_service_syncable_util.h"
13 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/search_engines/template_url_service_factory.h" 15 #include "chrome/browser/search_engines/template_url_service_factory.h"
15 #include "chrome/browser/sync/profile_sync_components_factory_impl.h" 16 #include "chrome/browser/sync/profile_sync_components_factory_impl.h"
16 #include "chrome/browser/sync/profile_sync_service.h" 17 #include "chrome/browser/sync/profile_sync_service.h"
17 #include "chrome/browser/sync/profile_sync_service_factory.h" 18 #include "chrome/browser/sync/profile_sync_service_factory.h"
18 #include "chrome/browser/themes/theme_service.h" 19 #include "chrome/browser/themes/theme_service.h"
19 #include "chrome/browser/themes/theme_service_factory.h" 20 #include "chrome/browser/themes/theme_service_factory.h"
20 #include "chrome/browser/themes/theme_syncable_service.h" 21 #include "chrome/browser/themes/theme_syncable_service.h"
21 #include "chrome/browser/web_data_service_factory.h" 22 #include "chrome/browser/web_data_service_factory.h"
22 #include "components/autofill/core/browser/webdata/autocomplete_syncable_service .h" 23 #include "components/autofill/core/browser/webdata/autocomplete_syncable_service .h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 ChromeSyncClient::GetSyncableServiceForType(syncer::ModelType type) { 130 ChromeSyncClient::GetSyncableServiceForType(syncer::ModelType type) {
130 if (!profile_) { // For tests. 131 if (!profile_) { // For tests.
131 return base::WeakPtr<syncer::SyncableService>(); 132 return base::WeakPtr<syncer::SyncableService>();
132 } 133 }
133 switch (type) { 134 switch (type) {
134 case syncer::DEVICE_INFO: 135 case syncer::DEVICE_INFO:
135 return ProfileSyncServiceFactory::GetForProfile(profile_) 136 return ProfileSyncServiceFactory::GetForProfile(profile_)
136 ->GetDeviceInfoSyncableService() 137 ->GetDeviceInfoSyncableService()
137 ->AsWeakPtr(); 138 ->AsWeakPtr();
138 case syncer::PREFERENCES: 139 case syncer::PREFERENCES:
139 return PrefServiceSyncable::FromProfile( 140 return PrefServiceSyncableFromProfile(profile_)
140 profile_)->GetSyncableService(syncer::PREFERENCES)->AsWeakPtr(); 141 ->GetSyncableService(syncer::PREFERENCES)
142 ->AsWeakPtr();
141 case syncer::PRIORITY_PREFERENCES: 143 case syncer::PRIORITY_PREFERENCES:
142 return PrefServiceSyncable::FromProfile(profile_)->GetSyncableService( 144 return PrefServiceSyncableFromProfile(profile_)
143 syncer::PRIORITY_PREFERENCES)->AsWeakPtr(); 145 ->GetSyncableService(syncer::PRIORITY_PREFERENCES)
146 ->AsWeakPtr();
144 case syncer::AUTOFILL: 147 case syncer::AUTOFILL:
145 case syncer::AUTOFILL_PROFILE: 148 case syncer::AUTOFILL_PROFILE:
146 case syncer::AUTOFILL_WALLET_DATA: 149 case syncer::AUTOFILL_WALLET_DATA:
147 case syncer::AUTOFILL_WALLET_METADATA: { 150 case syncer::AUTOFILL_WALLET_METADATA: {
148 if (!web_data_service_) 151 if (!web_data_service_)
149 return base::WeakPtr<syncer::SyncableService>(); 152 return base::WeakPtr<syncer::SyncableService>();
150 if (type == syncer::AUTOFILL) { 153 if (type == syncer::AUTOFILL) {
151 return autofill::AutocompleteSyncableService::FromWebDataService( 154 return autofill::AutocompleteSyncableService::FromWebDataService(
152 web_data_service_.get())->AsWeakPtr(); 155 web_data_service_.get())->AsWeakPtr();
153 } else if (type == syncer::AUTOFILL_PROFILE) { 156 } else if (type == syncer::AUTOFILL_PROFILE) {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 return base::WeakPtr<syncer::SyncableService>(); 250 return base::WeakPtr<syncer::SyncableService>();
248 } 251 }
249 } 252 }
250 253
251 sync_driver::SyncApiComponentFactory* 254 sync_driver::SyncApiComponentFactory*
252 ChromeSyncClient::GetSyncApiComponentFactory() { 255 ChromeSyncClient::GetSyncApiComponentFactory() {
253 return component_factory_; 256 return component_factory_;
254 } 257 }
255 258
256 } // namespace browser_sync 259 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/profiles/off_the_record_profile_impl.cc ('k') | chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698