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 "chromeos/tpm_token_loader.h" | 5 #include "chromeos/tpm_token_loader.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 if (!callback.is_null()) | 116 if (!callback.is_null()) |
117 tpm_ready_callback_list_.push_back(callback); | 117 tpm_ready_callback_list_.push_back(callback); |
118 return TPM_TOKEN_STATUS_UNDETERMINED; | 118 return TPM_TOKEN_STATUS_UNDETERMINED; |
119 } | 119 } |
120 | 120 |
121 bool TPMTokenLoader::IsTPMLoadingEnabled() const { | 121 bool TPMTokenLoader::IsTPMLoadingEnabled() const { |
122 // TPM loading is enabled on non-ChromeOS environments, e.g. when running | 122 // TPM loading is enabled on non-ChromeOS environments, e.g. when running |
123 // tests on Linux. | 123 // tests on Linux. |
124 // Treat TPM as disabled for guest users since they do not store certs. | 124 // Treat TPM as disabled for guest users since they do not store certs. |
125 return initialized_for_test_ || (base::SysInfo::IsRunningOnChromeOS() && | 125 return initialized_for_test_ || (base::SysInfo::IsRunningOnChromeOS() && |
126 LoginState::Get()->IsGuestSessionUser()); | 126 !LoginState::Get()->IsGuestSessionUser()); |
127 } | 127 } |
128 | 128 |
129 void TPMTokenLoader::MaybeStartTokenInitialization() { | 129 void TPMTokenLoader::MaybeStartTokenInitialization() { |
130 CHECK(thread_checker_.CalledOnValidThread()); | 130 CHECK(thread_checker_.CalledOnValidThread()); |
131 | 131 |
132 // This is the entry point to the TPM token initialization process, | 132 // This is the entry point to the TPM token initialization process, |
133 // which we should do at most once. | 133 // which we should do at most once. |
134 if (tpm_token_state_ != TPM_STATE_UNKNOWN || !crypto_task_runner_.get()) | 134 if (tpm_token_state_ != TPM_STATE_UNKNOWN || !crypto_task_runner_.get()) |
135 return; | 135 return; |
136 | 136 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 } | 294 } |
295 tpm_ready_callback_list_.clear(); | 295 tpm_ready_callback_list_.clear(); |
296 } | 296 } |
297 | 297 |
298 void TPMTokenLoader::LoggedInStateChanged() { | 298 void TPMTokenLoader::LoggedInStateChanged() { |
299 VLOG(1) << "LoggedInStateChanged"; | 299 VLOG(1) << "LoggedInStateChanged"; |
300 MaybeStartTokenInitialization(); | 300 MaybeStartTokenInitialization(); |
301 } | 301 } |
302 | 302 |
303 } // namespace chromeos | 303 } // namespace chromeos |
OLD | NEW |