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

Side by Side Diff: chrome/browser/signin/easy_unlock_service_signin_chromeos.cc

Issue 741593002: If easy sign-in is set up, allow TPMTokenLoader to start before login (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years 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
« no previous file with comments | « no previous file | chromeos/tpm/tpm_token_loader.h » ('j') | 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 "chrome/browser/signin/easy_unlock_service_signin_chromeos.h" 5 #include "chrome/browser/signin/easy_unlock_service_signin_chromeos.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "base/sys_info.h" 12 #include "base/sys_info.h"
13 #include "base/thread_task_runner_handle.h" 13 #include "base/thread_task_runner_handle.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h" 15 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h"
16 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_metrics.h" 16 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_metrics.h"
17 #include "chrome/browser/chromeos/login/session/user_session_manager.h" 17 #include "chrome/browser/chromeos/login/session/user_session_manager.h"
18 #include "chromeos/login/auth/user_context.h" 18 #include "chromeos/login/auth/user_context.h"
19 #include "chromeos/tpm/tpm_token_loader.h"
19 20
20 namespace { 21 namespace {
21 22
22 // The maximum allowed backoff interval when waiting for cryptohome to start. 23 // The maximum allowed backoff interval when waiting for cryptohome to start.
23 uint32 kMaxCryptohomeBackoffIntervalMs = 10000u; 24 uint32 kMaxCryptohomeBackoffIntervalMs = 10000u;
24 25
25 // If the data load fails, the initial interval after which the load will be 26 // If the data load fails, the initial interval after which the load will be
26 // retried. Further intervals will exponentially increas by factor 2. 27 // retried. Further intervals will exponentially increas by factor 2.
27 uint32 kInitialCryptohomeBackoffIntervalMs = 200u; 28 uint32 kInitialCryptohomeBackoffIntervalMs = 200u;
28 29
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 ResetScreenlockState(); 312 ResetScreenlockState();
312 ShowInitialUserState(); 313 ShowInitialUserState();
313 314
314 if (should_update_app_state) { 315 if (should_update_app_state) {
315 UpdateAppState(); 316 UpdateAppState();
316 } else { 317 } else {
317 NotifyUserUpdated(); 318 NotifyUserUpdated();
318 } 319 }
319 320
320 LoadCurrentUserDataIfNeeded(); 321 LoadCurrentUserDataIfNeeded();
322
323 // Start loading TPM system token.
324 // The system token will be needed to sign a nonce using TPM private key
325 // during the sign-in protocol.
326 EasyUnlockScreenlockStateHandler::HardlockState hardlock_state;
327 if (GetPersistedHardlockState(&hardlock_state) &&
328 hardlock_state != EasyUnlockScreenlockStateHandler::NO_PAIRING) {
329 chromeos::TPMTokenLoader::Get()->EnsureStarted();
330 }
321 } 331 }
322 332
323 void EasyUnlockServiceSignin::LoggedInStateChanged() { 333 void EasyUnlockServiceSignin::LoggedInStateChanged() {
324 if (!chromeos::LoginState::Get()->IsUserLoggedIn()) 334 if (!chromeos::LoginState::Get()->IsUserLoggedIn())
325 return; 335 return;
326 UnloadApp(); 336 UnloadApp();
327 } 337 }
328 338
329 void EasyUnlockServiceSignin::LoadCurrentUserDataIfNeeded() { 339 void EasyUnlockServiceSignin::LoadCurrentUserDataIfNeeded() {
330 // TODO(xiyuan): Revisit this when adding tests. 340 // TODO(xiyuan): Revisit this when adding tests.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 return NULL; 388 return NULL;
379 389
380 std::map<std::string, UserData*>::const_iterator it = 390 std::map<std::string, UserData*>::const_iterator it =
381 user_data_.find(user_id_); 391 user_data_.find(user_id_);
382 if (it == user_data_.end()) 392 if (it == user_data_.end())
383 return NULL; 393 return NULL;
384 if (it->second->state != USER_DATA_STATE_LOADED) 394 if (it->second->state != USER_DATA_STATE_LOADED)
385 return NULL; 395 return NULL;
386 return it->second; 396 return it->second;
387 } 397 }
OLDNEW
« no previous file with comments | « no previous file | chromeos/tpm/tpm_token_loader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698