| OLD | NEW |
| 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 24 matching lines...) Expand all Loading... |
| 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 | 44 // static |
| 45 ProfileSyncServiceBase* ProfileSyncServiceBase::ForContext( | 45 ProfileSyncServiceBase* ProfileSyncServiceBase::FromBrowserContext( |
| 46 content::BrowserContext* context) { | 46 content::BrowserContext* context) { |
| 47 return ProfileSyncServiceFactory::GetForProfile( | 47 return ProfileSyncServiceFactory::GetForProfile( |
| 48 static_cast<Profile*>(context)); | 48 static_cast<Profile*>(context)); |
| 49 } | 49 } |
| 50 | 50 |
| 51 ProfileSyncServiceFactory::ProfileSyncServiceFactory() | 51 ProfileSyncServiceFactory::ProfileSyncServiceFactory() |
| 52 : ProfileKeyedServiceFactory("ProfileSyncService", | 52 : ProfileKeyedServiceFactory("ProfileSyncService", |
| 53 ProfileDependencyManager::GetInstance()) { | 53 ProfileDependencyManager::GetInstance()) { |
| 54 | 54 |
| 55 // The ProfileSyncService depends on various SyncableServices being around | 55 // The ProfileSyncService depends on various SyncableServices being around |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 102 |
| 103 pss->factory()->RegisterDataTypes(pss); | 103 pss->factory()->RegisterDataTypes(pss); |
| 104 pss->Initialize(); | 104 pss->Initialize(); |
| 105 return pss; | 105 return pss; |
| 106 } | 106 } |
| 107 | 107 |
| 108 // static | 108 // static |
| 109 bool ProfileSyncServiceFactory::HasProfileSyncService(Profile* profile) { | 109 bool ProfileSyncServiceFactory::HasProfileSyncService(Profile* profile) { |
| 110 return GetInstance()->GetServiceForProfile(profile, false) != NULL; | 110 return GetInstance()->GetServiceForProfile(profile, false) != NULL; |
| 111 } | 111 } |
| OLD | NEW |