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/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
8 #include "base/win/windows_version.h" | 9 #include "base/win/windows_version.h" |
9 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/profiles/profile_dependency_manager.h" | 11 #include "chrome/browser/profiles/profile_dependency_manager.h" |
11 #include "chrome/browser/profiles/profile_manager.h" | 12 #include "chrome/browser/profiles/profile_manager.h" |
12 #include "chrome/browser/signin/token_service_factory.h" | 13 #include "chrome/browser/signin/token_service_factory.h" |
13 #include "chrome/browser/sync/credential_cache_service_win.h" | 14 #include "chrome/browser/sync/credential_cache_service_win.h" |
14 #include "chrome/browser/sync/profile_sync_service_factory.h" | 15 #include "chrome/browser/sync/profile_sync_service_factory.h" |
15 #include "chrome/common/chrome_paths_internal.h" | 16 #include "chrome/common/chrome_paths_internal.h" |
| 17 #include "chrome/common/chrome_switches.h" |
16 | 18 |
17 | 19 |
18 namespace syncer { | 20 namespace syncer { |
19 | 21 |
20 // static | 22 // static |
21 CredentialCacheServiceFactory* CredentialCacheServiceFactory::GetInstance() { | 23 CredentialCacheServiceFactory* CredentialCacheServiceFactory::GetInstance() { |
22 return Singleton<CredentialCacheServiceFactory>::get(); | 24 return Singleton<CredentialCacheServiceFactory>::get(); |
23 } | 25 } |
24 | 26 |
25 // static | 27 // static |
(...skipping 24 matching lines...) Expand all Loading... |
50 ProfileManager::GetDefaultProfileDir(default_user_data_dir); | 52 ProfileManager::GetDefaultProfileDir(default_user_data_dir); |
51 } | 53 } |
52 | 54 |
53 bool CredentialCacheServiceFactory::ServiceIsCreatedWithProfile() { | 55 bool CredentialCacheServiceFactory::ServiceIsCreatedWithProfile() { |
54 return true; | 56 return true; |
55 } | 57 } |
56 | 58 |
57 ProfileKeyedService* CredentialCacheServiceFactory::BuildServiceInstanceFor( | 59 ProfileKeyedService* CredentialCacheServiceFactory::BuildServiceInstanceFor( |
58 Profile* profile) const { | 60 Profile* profile) const { |
59 // Only instantiate a CredentialCacheService object if we are running in the | 61 // Only instantiate a CredentialCacheService object if we are running in the |
60 // default profile on Windows 8. | 62 // default profile on Windows 8, and if credential caching is enabled. |
| 63 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
61 if (base::win::GetVersion() >= base::win::VERSION_WIN8 && | 64 if (base::win::GetVersion() >= base::win::VERSION_WIN8 && |
62 IsDefaultProfile(profile)) { | 65 IsDefaultProfile(profile) && |
| 66 command_line->HasSwitch(switches::kEnableSyncCredentialCaching)) { |
63 return new syncer::CredentialCacheService(profile); | 67 return new syncer::CredentialCacheService(profile); |
64 } | 68 } |
65 return NULL; | 69 return NULL; |
66 } | 70 } |
67 | 71 |
68 } // namespace syncer | 72 } // namespace syncer |
OLD | NEW |