| 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()->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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 | 104 |
| 109 pss->factory()->RegisterDataTypes(pss); | 105 pss->factory()->RegisterDataTypes(pss); |
| 110 pss->Initialize(); | 106 pss->Initialize(); |
| 111 return pss; | 107 return pss; |
| 112 } | 108 } |
| 113 | 109 |
| 114 // static | 110 // static |
| 115 bool ProfileSyncServiceFactory::HasProfileSyncService(Profile* profile) { | 111 bool ProfileSyncServiceFactory::HasProfileSyncService(Profile* profile) { |
| 116 return GetInstance()->GetServiceForProfile(profile, false) != NULL; | 112 return GetInstance()->GetServiceForProfile(profile, false) != NULL; |
| 117 } | 113 } |
| OLD | NEW |