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" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 BrowserContextDependencyManager::GetInstance()) { | 57 BrowserContextDependencyManager::GetInstance()) { |
58 } | 58 } |
59 | 59 |
60 EasyUnlockTpmKeyManagerFactory::~EasyUnlockTpmKeyManagerFactory() { | 60 EasyUnlockTpmKeyManagerFactory::~EasyUnlockTpmKeyManagerFactory() { |
61 } | 61 } |
62 | 62 |
63 KeyedService* EasyUnlockTpmKeyManagerFactory::BuildServiceInstanceFor( | 63 KeyedService* EasyUnlockTpmKeyManagerFactory::BuildServiceInstanceFor( |
64 content::BrowserContext* context) const { | 64 content::BrowserContext* context) const { |
65 Profile* profile = Profile::FromBrowserContext(context); | 65 Profile* profile = Profile::FromBrowserContext(context); |
66 const user_manager::User* user = NULL; | 66 const user_manager::User* user = NULL; |
| 67 if (chromeos::ProfileHelper::IsLockScreenAppProfile(profile)) |
| 68 return nullptr; |
67 if (!chromeos::ProfileHelper::IsSigninProfile(profile)) | 69 if (!chromeos::ProfileHelper::IsSigninProfile(profile)) |
68 user = chromeos::ProfileHelper::Get()->GetUserByProfile(profile); | 70 user = chromeos::ProfileHelper::Get()->GetUserByProfile(profile); |
69 return new EasyUnlockTpmKeyManager( | 71 return new EasyUnlockTpmKeyManager( |
70 user ? user->GetAccountId() : EmptyAccountId(), | 72 user ? user->GetAccountId() : EmptyAccountId(), |
71 user ? user->username_hash() : std::string(), GetLocalState()); | 73 user ? user->username_hash() : std::string(), GetLocalState()); |
72 } | 74 } |
73 | 75 |
74 content::BrowserContext* EasyUnlockTpmKeyManagerFactory::GetBrowserContextToUse( | 76 content::BrowserContext* EasyUnlockTpmKeyManagerFactory::GetBrowserContextToUse( |
75 content::BrowserContext* context) const { | 77 content::BrowserContext* context) const { |
76 return chrome::GetBrowserContextRedirectedInIncognito(context); | 78 return chrome::GetBrowserContextRedirectedInIncognito(context); |
77 } | 79 } |
OLD | NEW |