Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: chromeos/tpm_token_loader.cc

Issue 408853004: Remove nss_util.h dependency from FakeCryptohomeClient. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chromeos/tpm_token_loader.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 NotifyTPMTokenReady(); 177 NotifyTPMTokenReady();
178 return; 178 return;
179 } 179 }
180 case TPM_ENABLED: { 180 case TPM_ENABLED: {
181 DBusThreadManager::Get()->GetCryptohomeClient()->Pkcs11IsTpmTokenReady( 181 DBusThreadManager::Get()->GetCryptohomeClient()->Pkcs11IsTpmTokenReady(
182 base::Bind(&TPMTokenLoader::OnPkcs11IsTpmTokenReady, 182 base::Bind(&TPMTokenLoader::OnPkcs11IsTpmTokenReady,
183 weak_factory_.GetWeakPtr())); 183 weak_factory_.GetWeakPtr()));
184 return; 184 return;
185 } 185 }
186 case TPM_TOKEN_READY: { 186 case TPM_TOKEN_READY: {
187 // Retrieve token_name_ and user_pin_ here since they will never change 187 // Retrieve user_pin_ here since they will never change
188 // and CryptohomeClient calls are not thread safe. 188 // and CryptohomeClient calls are not thread safe.
189 DBusThreadManager::Get()->GetCryptohomeClient()->Pkcs11GetTpmTokenInfo( 189 DBusThreadManager::Get()->GetCryptohomeClient()->Pkcs11GetTpmTokenInfo(
190 base::Bind(&TPMTokenLoader::OnPkcs11GetTpmTokenInfo, 190 base::Bind(&TPMTokenLoader::OnPkcs11GetTpmTokenInfo,
191 weak_factory_.GetWeakPtr())); 191 weak_factory_.GetWeakPtr()));
192 return; 192 return;
193 } 193 }
194 case TPM_TOKEN_INFO_RECEIVED: { 194 case TPM_TOKEN_INFO_RECEIVED: {
195 crypto_task_runner_->PostTask( 195 crypto_task_runner_->PostTask(
196 FROM_HERE, 196 FROM_HERE,
197 base::Bind( 197 base::Bind(
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 const std::string& token_name, 256 const std::string& token_name,
257 const std::string& user_pin, 257 const std::string& user_pin,
258 int token_slot_id) { 258 int token_slot_id) {
259 VLOG(1) << "OnPkcs11GetTpmTokenInfo: " << token_name; 259 VLOG(1) << "OnPkcs11GetTpmTokenInfo: " << token_name;
260 260
261 if (call_status == DBUS_METHOD_CALL_FAILURE) { 261 if (call_status == DBUS_METHOD_CALL_FAILURE) {
262 RetryTokenInitializationLater(); 262 RetryTokenInitializationLater();
263 return; 263 return;
264 } 264 }
265 265
266 tpm_token_name_ = token_name;
267 tpm_token_slot_id_ = token_slot_id; 266 tpm_token_slot_id_ = token_slot_id;
268 tpm_user_pin_ = user_pin; 267 tpm_user_pin_ = user_pin;
269 tpm_token_state_ = TPM_TOKEN_INFO_RECEIVED; 268 tpm_token_state_ = TPM_TOKEN_INFO_RECEIVED;
270 269
271 ContinueTokenInitialization(); 270 ContinueTokenInitialization();
272 } 271 }
273 272
274 void TPMTokenLoader::OnTPMTokenInitialized(bool success) { 273 void TPMTokenLoader::OnTPMTokenInitialized(bool success) {
275 VLOG(1) << "OnTPMTokenInitialized: " << success; 274 VLOG(1) << "OnTPMTokenInitialized: " << success;
276 if (!success) { 275 if (!success) {
277 RetryTokenInitializationLater(); 276 RetryTokenInitializationLater();
278 return; 277 return;
279 } 278 }
280 tpm_token_state_ = TPM_TOKEN_INITIALIZED; 279 tpm_token_state_ = TPM_TOKEN_INITIALIZED;
281 ContinueTokenInitialization(); 280 ContinueTokenInitialization();
282 } 281 }
283 282
284 void TPMTokenLoader::NotifyTPMTokenReady() { 283 void TPMTokenLoader::NotifyTPMTokenReady() {
285 FOR_EACH_OBSERVER(Observer, observers_, OnTPMTokenReady()); 284 FOR_EACH_OBSERVER(Observer, observers_, OnTPMTokenReady());
286 } 285 }
287 286
288 void TPMTokenLoader::LoggedInStateChanged() { 287 void TPMTokenLoader::LoggedInStateChanged() {
289 VLOG(1) << "LoggedInStateChanged"; 288 VLOG(1) << "LoggedInStateChanged";
290 MaybeStartTokenInitialization(); 289 MaybeStartTokenInitialization();
291 } 290 }
292 291
293 } // namespace chromeos 292 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/tpm_token_loader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698