Skip to content

Commit

Permalink
Webui starting negotiations with cryptohomed are delayed until the fi…
Browse files Browse the repository at this point in the history
…rst mount

BUG=chromium-os:20889
TEST=manual

Review URL: http://codereview.chromium.org/8208017

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105483 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
glotov@google.com committed Oct 14, 2011
1 parent 01fc0c8 commit ed4e40b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
13 changes: 9 additions & 4 deletions chrome/browser/chromeos/login/existing_user_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ void ExistingUserController::Init(const UserVector& users) {
LoginUtils::Get()->PrewarmAuthentication();
if (CrosLibrary::Get()->EnsureLoaded())
CrosLibrary::Get()->GetLoginLibrary()->EmitLoginPromptReady();
StartAutomaticFreeDiskSpaceControl();
}

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -170,6 +169,8 @@ void ExistingUserController::FixCaptivePortal() {

void ExistingUserController::CompleteLogin(const std::string& username,
const std::string& password) {
SetOwnerUserInCryptohome();

GaiaAuthConsumer::ClientLoginResult credentials;
if (!login_performer_.get()) {
LoginPerformer::Delegate* delegate = this;
Expand Down Expand Up @@ -229,6 +230,7 @@ void ExistingUserController::LoginAsGuest() {
SetStatusAreaEnabled(false);
// Disable clicking on other windows.
login_display_->SetUIEnabled(false);
SetOwnerUserInCryptohome();

// Check allow_guest in case this call is fired from key accelerator.
// Must not proceed without signature verification.
Expand Down Expand Up @@ -576,9 +578,9 @@ void ExistingUserController::ShowError(int error_id,
login_display_->ShowError(error_id, num_login_attempts_, help_topic_id);
}

void ExistingUserController::StartAutomaticFreeDiskSpaceControl() {
void ExistingUserController::SetOwnerUserInCryptohome() {
bool trusted_owner_available = user_settings_->RequestTrustedOwner(
base::Bind(&ExistingUserController::StartAutomaticFreeDiskSpaceControl,
base::Bind(&ExistingUserController::SetOwnerUserInCryptohome,
weak_factory_.GetWeakPtr()));
if (!trusted_owner_available) {
// Value of owner email is still not verified.
Expand All @@ -589,7 +591,10 @@ void ExistingUserController::StartAutomaticFreeDiskSpaceControl() {
CryptohomeLibrary* cryptohomed = CrosLibrary::Get()->GetCryptohomeLibrary();
cryptohomed->AsyncSetOwnerUser(
UserCrosSettingsProvider::cached_owner(), NULL);
cryptohomed->AsyncDoAutomaticFreeDiskSpaceControl(NULL);

// Do not invoke AsyncDoAutomaticFreeDiskSpaceControl(NULL) here
// so it does not delay the following mount. Cleanup will be
// started in Cryptohomed by timer.
}
}

Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/chromeos/login/existing_user_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ class ExistingUserController : public LoginDisplay::Delegate,
login_performer_delegate_.reset(d);
}

// Passes owner user to cryptohomed and initiates disk control control check.
// Passes owner user to cryptohomed. Called right before mounting a user.
// Subsequent disk space control checks are invoked by cryptohomed timer.
void StartAutomaticFreeDiskSpaceControl();
void SetOwnerUserInCryptohome();

// Used to execute login operations.
scoped_ptr<LoginPerformer> login_performer_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,6 @@ class ExistingUserControllerTest : public CrosInProcessBrowserTest {
EXPECT_CALL(*mock_cryptohome_library_, IsMounted())
.Times(AnyNumber())
.WillRepeatedly(Return(true));
EXPECT_CALL(*mock_cryptohome_library_,
AsyncDoAutomaticFreeDiskSpaceControl(_))
.Times(1)
.WillOnce(Return(true));
EXPECT_CALL(*mock_cryptohome_library_,
AsyncSetOwnerUser(_, _))
.Times(1)
.WillOnce(Return(true));
LoginUtils::Set(new MockLoginUtils(kUsername, kPassword));

mock_login_display_.reset(new MockLoginDisplay());
Expand Down

0 comments on commit ed4e40b

Please sign in to comment.