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 "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 10 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
(...skipping 21 matching lines...) Expand all Loading... | |
32 ProfileSyncServiceFactory* ProfileSyncServiceFactory::GetInstance() { | 32 ProfileSyncServiceFactory* ProfileSyncServiceFactory::GetInstance() { |
33 return Singleton<ProfileSyncServiceFactory>::get(); | 33 return Singleton<ProfileSyncServiceFactory>::get(); |
34 } | 34 } |
35 | 35 |
36 // static | 36 // static |
37 ProfileSyncService* ProfileSyncServiceFactory::GetForProfile( | 37 ProfileSyncService* ProfileSyncServiceFactory::GetForProfile( |
38 Profile* profile) { | 38 Profile* profile) { |
39 if (!ProfileSyncService::IsSyncEnabled()) | 39 if (!ProfileSyncService::IsSyncEnabled()) |
40 return NULL; | 40 return NULL; |
41 | 41 |
42 // Do not start sync on the import process. | |
tapted
2013/04/24 08:08:35
Could these checks still be required for Linux?
gab
2013/04/24 20:24:59
No, I got rid of the import process entirely, on L
| |
43 if (ProfileManager::IsImportProcess(*CommandLine::ForCurrentProcess())) | |
44 return NULL; | |
45 | |
46 return static_cast<ProfileSyncService*>( | 42 return static_cast<ProfileSyncService*>( |
47 GetInstance()->GetServiceForProfile(profile, true)); | 43 GetInstance()->GetServiceForProfile(profile, true)); |
48 } | 44 } |
49 | 45 |
50 ProfileSyncServiceFactory::ProfileSyncServiceFactory() | 46 ProfileSyncServiceFactory::ProfileSyncServiceFactory() |
51 : ProfileKeyedServiceFactory("ProfileSyncService", | 47 : ProfileKeyedServiceFactory("ProfileSyncService", |
52 ProfileDependencyManager::GetInstance()) { | 48 ProfileDependencyManager::GetInstance()) { |
53 | 49 |
54 // The ProfileSyncService depends on various SyncableServices being around | 50 // The ProfileSyncService depends on various SyncableServices being around |
55 // when it is shut down. Specify those dependencies here to build the proper | 51 // when it is shut down. Specify those dependencies here to build the proper |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
106 | 102 |
107 pss->factory()->RegisterDataTypes(pss); | 103 pss->factory()->RegisterDataTypes(pss); |
108 pss->Initialize(); | 104 pss->Initialize(); |
109 return pss; | 105 return pss; |
110 } | 106 } |
111 | 107 |
112 // static | 108 // static |
113 bool ProfileSyncServiceFactory::HasProfileSyncService(Profile* profile) { | 109 bool ProfileSyncServiceFactory::HasProfileSyncService(Profile* profile) { |
114 return GetInstance()->GetServiceForProfile(profile, false) != NULL; | 110 return GetInstance()->GetServiceForProfile(profile, false) != NULL; |
115 } | 111 } |
OLD | NEW |