| 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/credential_cache_service_factory_win.h" | 5 #include "chrome/browser/sync/credential_cache_service_factory_win.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/win/windows_version.h" | 9 #include "base/win/windows_version.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/profiles/profile_dependency_manager.h" | 11 #include "chrome/browser/profiles/profile_dependency_manager.h" |
| 12 #include "chrome/browser/profiles/profile_manager.h" | 12 #include "chrome/browser/profiles/profile_manager.h" |
| 13 #include "chrome/browser/signin/signin_manager_factory.h" |
| 13 #include "chrome/browser/signin/token_service_factory.h" | 14 #include "chrome/browser/signin/token_service_factory.h" |
| 14 #include "chrome/browser/sync/credential_cache_service_win.h" | 15 #include "chrome/browser/sync/credential_cache_service_win.h" |
| 15 #include "chrome/browser/sync/profile_sync_service_factory.h" | 16 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 16 #include "chrome/common/chrome_paths_internal.h" | 17 #include "chrome/common/chrome_paths_internal.h" |
| 17 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
| 18 | 19 |
| 19 | 20 |
| 20 namespace syncer { | 21 namespace syncer { |
| 21 | 22 |
| 22 // static | 23 // static |
| 23 CredentialCacheServiceFactory* CredentialCacheServiceFactory::GetInstance() { | 24 CredentialCacheServiceFactory* CredentialCacheServiceFactory::GetInstance() { |
| 24 return Singleton<CredentialCacheServiceFactory>::get(); | 25 return Singleton<CredentialCacheServiceFactory>::get(); |
| 25 } | 26 } |
| 26 | 27 |
| 27 // static | 28 // static |
| 28 syncer::CredentialCacheService* CredentialCacheServiceFactory::GetForProfile( | 29 syncer::CredentialCacheService* CredentialCacheServiceFactory::GetForProfile( |
| 29 Profile* profile) { | 30 Profile* profile) { |
| 30 return static_cast<syncer::CredentialCacheService*>( | 31 return static_cast<syncer::CredentialCacheService*>( |
| 31 GetInstance()->GetServiceForProfile(profile, true)); | 32 GetInstance()->GetServiceForProfile(profile, true)); |
| 32 } | 33 } |
| 33 | 34 |
| 34 CredentialCacheServiceFactory::CredentialCacheServiceFactory() | 35 CredentialCacheServiceFactory::CredentialCacheServiceFactory() |
| 35 : ProfileKeyedServiceFactory("CredentialCacheService", | 36 : ProfileKeyedServiceFactory("CredentialCacheService", |
| 36 ProfileDependencyManager::GetInstance()) { | 37 ProfileDependencyManager::GetInstance()) { |
| 37 // TODO(rsimha): Uncomment this once it exists. | 38 // TODO(rsimha): Uncomment this once it exists. |
| 38 // DependsOn(PrefServiceFactory::GetInstance()); | 39 // DependsOn(PrefServiceFactory::GetInstance()); |
| 39 DependsOn(ProfileSyncServiceFactory::GetInstance()); | 40 DependsOn(ProfileSyncServiceFactory::GetInstance()); |
| 41 DependsOn(SigninManagerFactory::GetInstance()); |
| 40 DependsOn(TokenServiceFactory::GetInstance()); | 42 DependsOn(TokenServiceFactory::GetInstance()); |
| 41 } | 43 } |
| 42 | 44 |
| 43 CredentialCacheServiceFactory::~CredentialCacheServiceFactory() { | 45 CredentialCacheServiceFactory::~CredentialCacheServiceFactory() { |
| 44 } | 46 } |
| 45 | 47 |
| 46 // static | 48 // static |
| 47 bool CredentialCacheServiceFactory::IsDefaultProfile(Profile* profile) { | 49 bool CredentialCacheServiceFactory::IsDefaultProfile(Profile* profile) { |
| 48 DCHECK(profile); | 50 DCHECK(profile); |
| 49 FilePath default_user_data_dir; | 51 FilePath default_user_data_dir; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 63 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 65 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 64 if (base::win::GetVersion() >= base::win::VERSION_WIN8 && | 66 if (base::win::GetVersion() >= base::win::VERSION_WIN8 && |
| 65 IsDefaultProfile(profile) && | 67 IsDefaultProfile(profile) && |
| 66 command_line->HasSwitch(switches::kEnableSyncCredentialCaching)) { | 68 command_line->HasSwitch(switches::kEnableSyncCredentialCaching)) { |
| 67 return new syncer::CredentialCacheService(profile); | 69 return new syncer::CredentialCacheService(profile); |
| 68 } | 70 } |
| 69 return NULL; | 71 return NULL; |
| 70 } | 72 } |
| 71 | 73 |
| 72 } // namespace syncer | 74 } // namespace syncer |
| OLD | NEW |