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

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

Issue 10910071: Extract abstract base to API directory for ProfileSyncService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge LKGR Created 8 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 | 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 "chrome/browser/sync/profile_sync_service_factory.h" 5 #include "chrome/browser/sync/profile_sync_service_factory.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "chrome/browser/autofill/personal_data_manager_factory.h" 9 #include "chrome/browser/autofill/personal_data_manager_factory.h"
10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 10 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
(...skipping 23 matching lines...) Expand all
34 // static 34 // static
35 ProfileSyncService* ProfileSyncServiceFactory::GetForProfile( 35 ProfileSyncService* ProfileSyncServiceFactory::GetForProfile(
36 Profile* profile) { 36 Profile* profile) {
37 if (!ProfileSyncService::IsSyncEnabled()) 37 if (!ProfileSyncService::IsSyncEnabled())
38 return NULL; 38 return NULL;
39 39
40 return static_cast<ProfileSyncService*>( 40 return static_cast<ProfileSyncService*>(
41 GetInstance()->GetServiceForProfile(profile, true)); 41 GetInstance()->GetServiceForProfile(profile, true));
42 } 42 }
43 43
44 // static
45 ProfileSyncServiceBase* ProfileSyncServiceBase::ForContext(
46 content::BrowserContext* context) {
47 return ProfileSyncServiceFactory::GetForProfile(
48 static_cast<Profile*>(context));
49 }
50
44 ProfileSyncServiceFactory::ProfileSyncServiceFactory() 51 ProfileSyncServiceFactory::ProfileSyncServiceFactory()
45 : ProfileKeyedServiceFactory("ProfileSyncService", 52 : ProfileKeyedServiceFactory("ProfileSyncService",
46 ProfileDependencyManager::GetInstance()) { 53 ProfileDependencyManager::GetInstance()) {
47 54
48 // The ProfileSyncService depends on various SyncableServices being around 55 // The ProfileSyncService depends on various SyncableServices being around
49 // when it is shut down. Specify those dependencies here to build the proper 56 // when it is shut down. Specify those dependencies here to build the proper
50 // destruction order. 57 // destruction order.
51 DependsOn(TemplateURLServiceFactory::GetInstance()); 58 DependsOn(TemplateURLServiceFactory::GetInstance());
52 DependsOn(PersonalDataManagerFactory::GetInstance()); 59 DependsOn(PersonalDataManagerFactory::GetInstance());
53 #if defined(ENABLE_THEMES) 60 #if defined(ENABLE_THEMES)
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 102
96 pss->factory()->RegisterDataTypes(pss); 103 pss->factory()->RegisterDataTypes(pss);
97 pss->Initialize(); 104 pss->Initialize();
98 return pss; 105 return pss;
99 } 106 }
100 107
101 // static 108 // static
102 bool ProfileSyncServiceFactory::HasProfileSyncService(Profile* profile) { 109 bool ProfileSyncServiceFactory::HasProfileSyncService(Profile* profile) {
103 return GetInstance()->GetServiceForProfile(profile, false) != NULL; 110 return GetInstance()->GetServiceForProfile(profile, false) != NULL;
104 } 111 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698