| Index: chrome/browser/chromeos/login/parallel_authenticator.cc
|
| ===================================================================
|
| --- chrome/browser/chromeos/login/parallel_authenticator.cc (revision 154482)
|
| +++ chrome/browser/chromeos/login/parallel_authenticator.cc (working copy)
|
| @@ -19,6 +19,7 @@
|
| #include "chrome/browser/chromeos/login/login_status_consumer.h"
|
| #include "chrome/browser/chromeos/login/user_manager.h"
|
| #include "chrome/browser/chromeos/settings/cros_settings.h"
|
| +#include "chrome/browser/chromeos/settings/ownership_service.h"
|
| #include "chrome/common/chrome_notification_types.h"
|
| #include "chrome/common/chrome_switches.h"
|
| #include "chrome/common/net/gaia/gaia_auth_util.h"
|
| @@ -200,6 +201,9 @@
|
| using_oauth_(
|
| !CommandLine::ForCurrentProcess()->HasSwitch(
|
| switches::kSkipOAuthLogin)) {
|
| + // If not already owned, this is a no-op. If it is, this loads the owner's
|
| + // public key off of disk.
|
| + OwnershipService::GetSharedInstance()->StartLoadOwnerKeyAttempt();
|
| }
|
|
|
| void ParallelAuthenticator::AuthenticateToLogin(
|
| @@ -218,8 +222,11 @@
|
| login_token,
|
| login_captcha,
|
| !UserManager::Get()->IsKnownUser(canonicalized)));
|
| - // Reset the verified flag.
|
| - owner_is_verified_ = false;
|
| + {
|
| + // Reset the verified flag.
|
| + base::AutoLock for_this_block(owner_verified_lock_);
|
| + owner_is_verified_ = false;
|
| + }
|
|
|
| const bool create_if_missing = false;
|
| BrowserThread::PostTask(
|
| @@ -250,10 +257,12 @@
|
| password,
|
| HashPassword(password),
|
| !UserManager::Get()->IsKnownUser(canonicalized)));
|
| + {
|
| + // Reset the verified flag.
|
| + base::AutoLock for_this_block(owner_verified_lock_);
|
| + owner_is_verified_ = false;
|
| + }
|
|
|
| - // Reset the verified flag.
|
| - owner_is_verified_ = false;
|
| -
|
| const bool create_if_missing = false;
|
| BrowserThread::PostTask(
|
| BrowserThread::UI, FROM_HERE,
|
| @@ -406,6 +415,7 @@
|
| }
|
|
|
| bool ParallelAuthenticator::VerifyOwner() {
|
| + base::AutoLock for_this_block(owner_verified_lock_);
|
| if (owner_is_verified_)
|
| return true;
|
| // Check if policy data is fine and continue in safe mode if needed.
|
| @@ -420,19 +430,21 @@
|
| // First we have to make sure the current user's cert store is available.
|
| CrosLibrary::Get()->GetCertLibrary()->LoadKeyStore();
|
| // Now we can continue reading the private key.
|
| - DeviceSettingsService::Get()->SetUsername(current_state_->username);
|
| - DeviceSettingsService::Get()->GetOwnershipStatusAsync(
|
| - base::Bind(&ParallelAuthenticator::OnOwnershipChecked, this));
|
| + BrowserThread::PostTask(
|
| + BrowserThread::FILE, FROM_HERE,
|
| + base::Bind(&ParallelAuthenticator::FinishVerifyOwnerOnFileThread, this));
|
| return false;
|
| }
|
|
|
| -void ParallelAuthenticator::OnOwnershipChecked(
|
| - DeviceSettingsService::OwnershipStatus status,
|
| - bool is_owner) {
|
| +void ParallelAuthenticator::FinishVerifyOwnerOnFileThread() {
|
| + base::AutoLock for_this_block(owner_verified_lock_);
|
| // Now we can check if this user is the owner.
|
| - user_can_login_ = is_owner;
|
| + user_can_login_ =
|
| + OwnershipService::GetSharedInstance()->IsCurrentUserOwner();
|
| owner_is_verified_ = true;
|
| - Resolve();
|
| + BrowserThread::PostTask(
|
| + BrowserThread::UI, FROM_HERE,
|
| + base::Bind(&ParallelAuthenticator::Resolve, this));
|
| }
|
|
|
| void ParallelAuthenticator::RetryAuth(Profile* profile,
|
| @@ -791,6 +803,7 @@
|
|
|
| void ParallelAuthenticator::SetOwnerState(bool owner_check_finished,
|
| bool check_result) {
|
| + base::AutoLock for_this_block(owner_verified_lock_);
|
| owner_is_verified_ = owner_check_finished;
|
| user_can_login_ = check_result;
|
| }
|
|
|