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. | |
43 if (ProfileManager::IsImportProcess(*CommandLine::ForCurrentProcess())) | |
44 return NULL; | |
45 | |
46 return static_cast<ProfileSyncService*>( | 42 return static_cast<ProfileSyncService*>( |
47 GetInstance()->GetServiceForBrowserContext(profile, true)); | 43 GetInstance()->GetServiceForBrowserContext(profile, true)); |
48 } | 44 } |
49 | 45 |
50 ProfileSyncServiceFactory::ProfileSyncServiceFactory() | 46 ProfileSyncServiceFactory::ProfileSyncServiceFactory() |
51 : BrowserContextKeyedServiceFactory( | 47 : BrowserContextKeyedServiceFactory( |
52 "ProfileSyncService", | 48 "ProfileSyncService", |
53 BrowserContextDependencyManager::GetInstance()) { | 49 BrowserContextDependencyManager::GetInstance()) { |
54 | 50 |
55 // The ProfileSyncService depends on various SyncableServices being around | 51 // The ProfileSyncService depends on various SyncableServices being around |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 105 |
110 pss->factory()->RegisterDataTypes(pss); | 106 pss->factory()->RegisterDataTypes(pss); |
111 pss->Initialize(); | 107 pss->Initialize(); |
112 return pss; | 108 return pss; |
113 } | 109 } |
114 | 110 |
115 // static | 111 // static |
116 bool ProfileSyncServiceFactory::HasProfileSyncService(Profile* profile) { | 112 bool ProfileSyncServiceFactory::HasProfileSyncService(Profile* profile) { |
117 return GetInstance()->GetServiceForBrowserContext(profile, false) != NULL; | 113 return GetInstance()->GetServiceForBrowserContext(profile, false) != NULL; |
118 } | 114 } |
OLD | NEW |