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

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

Issue 12079097: Introduce PrefRegistrySyncable, simplifying PrefServiceSyncable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add to PrefRegistrySyncable and PrefServiceSyncable to let sync know of pre-registered prefs. Created 7 years, 10 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/bookmarks/bookmark_model_factory.h" 7 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
8 #include "chrome/browser/extensions/api/storage/settings_frontend.h" 8 #include "chrome/browser/extensions/api/storage/settings_frontend.h"
9 #include "chrome/browser/extensions/app_notification_manager.h" 9 #include "chrome/browser/extensions/app_notification_manager.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
11 #include "chrome/browser/extensions/extension_system.h" 11 #include "chrome/browser/extensions/extension_system.h"
12 #include "chrome/browser/extensions/extension_system_factory.h" 12 #include "chrome/browser/extensions/extension_system_factory.h"
13 #include "chrome/browser/history/history_service.h" 13 #include "chrome/browser/history/history_service.h"
14 #include "chrome/browser/history/history_service_factory.h" 14 #include "chrome/browser/history/history_service_factory.h"
15 #include "chrome/browser/prefs/pref_model_associator.h" 15 #include "chrome/browser/prefs/pref_model_associator.h"
16 #include "chrome/browser/prefs/pref_service.h" 16 #include "chrome/browser/prefs/pref_service_syncable.h"
17 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/search_engines/template_url_service.h" 18 #include "chrome/browser/search_engines/template_url_service.h"
19 #include "chrome/browser/search_engines/template_url_service_factory.h" 19 #include "chrome/browser/search_engines/template_url_service_factory.h"
20 #include "chrome/browser/signin/signin_manager.h" 20 #include "chrome/browser/signin/signin_manager.h"
21 #include "chrome/browser/signin/signin_manager_factory.h" 21 #include "chrome/browser/signin/signin_manager_factory.h"
22 #include "chrome/browser/spellchecker/spellcheck_factory.h" 22 #include "chrome/browser/spellchecker/spellcheck_factory.h"
23 #include "chrome/browser/spellchecker/spellcheck_service.h" 23 #include "chrome/browser/spellchecker/spellcheck_service.h"
24 #include "chrome/browser/sync/glue/app_notification_data_type_controller.h" 24 #include "chrome/browser/sync/glue/app_notification_data_type_controller.h"
25 #include "chrome/browser/sync/glue/autofill_data_type_controller.h" 25 #include "chrome/browser/sync/glue/autofill_data_type_controller.h"
26 #include "chrome/browser/sync/glue/autofill_profile_data_type_controller.h" 26 #include "chrome/browser/sync/glue/autofill_profile_data_type_controller.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 return new SharedChangeProcessor(); 275 return new SharedChangeProcessor();
276 } 276 }
277 277
278 base::WeakPtr<syncer::SyncableService> ProfileSyncComponentsFactoryImpl:: 278 base::WeakPtr<syncer::SyncableService> ProfileSyncComponentsFactoryImpl::
279 GetSyncableServiceForType(syncer::ModelType type) { 279 GetSyncableServiceForType(syncer::ModelType type) {
280 if (!profile_) { // For tests. 280 if (!profile_) { // For tests.
281 return base::WeakPtr<syncer::SyncableService>(); 281 return base::WeakPtr<syncer::SyncableService>();
282 } 282 }
283 switch (type) { 283 switch (type) {
284 case syncer::PREFERENCES: 284 case syncer::PREFERENCES:
285 return profile_->GetPrefs()->GetSyncableService()->AsWeakPtr(); 285 return PrefServiceSyncable::FromProfile(
Mattias Nissler (ping if slow) 2013/02/06 17:53:33 non-scoring comment: This seems to be the non-test
Jói 2013/02/07 14:52:32 OK.
286 profile_)->GetSyncableService()->AsWeakPtr();
286 case syncer::AUTOFILL: 287 case syncer::AUTOFILL:
287 case syncer::AUTOFILL_PROFILE: { 288 case syncer::AUTOFILL_PROFILE: {
288 if (!web_data_service_.get()) 289 if (!web_data_service_.get())
289 return base::WeakPtr<syncer::SyncableService>(); 290 return base::WeakPtr<syncer::SyncableService>();
290 if (type == syncer::AUTOFILL) { 291 if (type == syncer::AUTOFILL) {
291 return web_data_service_->GetAutocompleteSyncableService()->AsWeakPtr(); 292 return web_data_service_->GetAutocompleteSyncableService()->AsWeakPtr();
292 } else { 293 } else {
293 return web_data_service_-> 294 return web_data_service_->
294 GetAutofillProfileSyncableService()->AsWeakPtr(); 295 GetAutofillProfileSyncableService()->AsWeakPtr();
295 } 296 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 ProfileSyncComponentsFactory::SyncComponents 393 ProfileSyncComponentsFactory::SyncComponents
393 ProfileSyncComponentsFactoryImpl::CreateSessionSyncComponents( 394 ProfileSyncComponentsFactoryImpl::CreateSessionSyncComponents(
394 ProfileSyncService* profile_sync_service, 395 ProfileSyncService* profile_sync_service,
395 DataTypeErrorHandler* error_handler) { 396 DataTypeErrorHandler* error_handler) {
396 SessionModelAssociator* model_associator = 397 SessionModelAssociator* model_associator =
397 new SessionModelAssociator(profile_sync_service, error_handler); 398 new SessionModelAssociator(profile_sync_service, error_handler);
398 SessionChangeProcessor* change_processor = 399 SessionChangeProcessor* change_processor =
399 new SessionChangeProcessor(error_handler, model_associator); 400 new SessionChangeProcessor(error_handler, model_associator);
400 return SyncComponents(model_associator, change_processor); 401 return SyncComponents(model_associator, change_processor);
401 } 402 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698