| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager_
factory.h" | 5 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager_
factory.h" |
| 6 | 6 |
| 7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager.
h" | 9 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager.
h" |
| 10 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 10 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 11 #include "chrome/browser/profiles/incognito_helpers.h" | 11 #include "chrome/browser/profiles/incognito_helpers.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 13 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 14 #include "components/user_manager/user.h" | 14 #include "components/user_manager/user.h" |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 PrefService* GetLocalState() { | 18 PrefService* GetLocalState() { |
| 19 return g_browser_process ? g_browser_process->local_state() : NULL; | 19 return g_browser_process ? g_browser_process->local_state() : NULL; |
| 20 } | 20 } |
| 21 | 21 |
| 22 } // namespace | 22 } // namespace |
| 23 | 23 |
| 24 // static | 24 // static |
| 25 EasyUnlockTpmKeyManagerFactory* EasyUnlockTpmKeyManagerFactory::GetInstance() { | 25 EasyUnlockTpmKeyManagerFactory* EasyUnlockTpmKeyManagerFactory::GetInstance() { |
| 26 return Singleton<EasyUnlockTpmKeyManagerFactory>::get(); | 26 return base::Singleton<EasyUnlockTpmKeyManagerFactory>::get(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 // static | 29 // static |
| 30 EasyUnlockTpmKeyManager* EasyUnlockTpmKeyManagerFactory::Get( | 30 EasyUnlockTpmKeyManager* EasyUnlockTpmKeyManagerFactory::Get( |
| 31 content::BrowserContext* browser_context) { | 31 content::BrowserContext* browser_context) { |
| 32 return static_cast<EasyUnlockTpmKeyManager*>( | 32 return static_cast<EasyUnlockTpmKeyManager*>( |
| 33 EasyUnlockTpmKeyManagerFactory::GetInstance() | 33 EasyUnlockTpmKeyManagerFactory::GetInstance() |
| 34 ->GetServiceForBrowserContext(browser_context, true)); | 34 ->GetServiceForBrowserContext(browser_context, true)); |
| 35 } | 35 } |
| 36 | 36 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 63 user = chromeos::ProfileHelper::Get()->GetUserByProfile(profile); | 63 user = chromeos::ProfileHelper::Get()->GetUserByProfile(profile); |
| 64 return new EasyUnlockTpmKeyManager( | 64 return new EasyUnlockTpmKeyManager( |
| 65 user ? user->email() : std::string(), | 65 user ? user->email() : std::string(), |
| 66 user ? user->username_hash() : std::string(), GetLocalState()); | 66 user ? user->username_hash() : std::string(), GetLocalState()); |
| 67 } | 67 } |
| 68 | 68 |
| 69 content::BrowserContext* EasyUnlockTpmKeyManagerFactory::GetBrowserContextToUse( | 69 content::BrowserContext* EasyUnlockTpmKeyManagerFactory::GetBrowserContextToUse( |
| 70 content::BrowserContext* context) const { | 70 content::BrowserContext* context) const { |
| 71 return chrome::GetBrowserContextRedirectedInIncognito(context); | 71 return chrome::GetBrowserContextRedirectedInIncognito(context); |
| 72 } | 72 } |
| OLD | NEW |