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

Unified Diff: chrome/browser/chromeos/login/existing_user_controller.cc

Issue 10832035: Switch from SignedSettings to DeviceSettingsService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, remove blocking GetOwnershipStatus() Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/existing_user_controller.cc
diff --git a/chrome/browser/chromeos/login/existing_user_controller.cc b/chrome/browser/chromeos/login/existing_user_controller.cc
index 837d5fae579d478cb9c16f7aff6cc1ce25367ce9..3377a9ecb1535f9c27dbc2fc9a1e3759de9ffd80 100644
--- a/chrome/browser/chromeos/login/existing_user_controller.cc
+++ b/chrome/browser/chromeos/login/existing_user_controller.cc
@@ -335,22 +335,10 @@ void ExistingUserController::CompleteLoginInternal(std::string username,
std::string password) {
resume_login_callback_.Reset();
- if (!login_performer_.get()) {
- LoginPerformer::Delegate* delegate = this;
- if (login_performer_delegate_.get())
- delegate = login_performer_delegate_.get();
- // Only one instance of LoginPerformer should exist at a time.
- login_performer_.reset(new LoginPerformer(delegate));
- }
-
- // If the device is not owned yet, successfully logged in user will be owner.
- is_owner_login_ = OwnershipService::GetSharedInstance()->GetStatus(true) ==
- OwnershipService::OWNERSHIP_NONE;
-
- is_login_in_progress_ = true;
- login_performer_->CompleteLogin(username, password);
- accessibility::MaybeSpeak(
- l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNING_IN));
+ DeviceSettingsService::Get()->GetOwnershipStatusAsync(
+ base::Bind(&ExistingUserController::PerformLogin,
+ weak_factory_.GetWeakPtr(), username, password,
+ LoginPerformer::AUTH_MODE_EXTENSION));
}
void ExistingUserController::Login(const std::string& username,
@@ -360,10 +348,6 @@ void ExistingUserController::Login(const std::string& username,
// Disable clicking on other windows.
login_display_->SetUIEnabled(false);
- // If the device is not owned yet, successfully logged in user will be owner.
- is_owner_login_ = OwnershipService::GetSharedInstance()->GetStatus(true) ==
- OwnershipService::OWNERSHIP_NONE;
-
BootTimesLoader::Get()->RecordLoginAttempted();
if (last_login_attempt_username_ != username) {
@@ -375,6 +359,21 @@ void ExistingUserController::Login(const std::string& username,
}
num_login_attempts_++;
+ DeviceSettingsService::Get()->GetOwnershipStatusAsync(
+ base::Bind(&ExistingUserController::PerformLogin,
+ weak_factory_.GetWeakPtr(), username, password,
+ LoginPerformer::AUTH_MODE_INTERNAL));
+}
+
+void ExistingUserController::PerformLogin(
+ const std::string& username,
+ const std::string& password,
+ LoginPerformer::AuthorizationMode auth_mode,
+ DeviceSettingsService::OwnershipStatus ownership_status,
+ bool is_owner) {
+ // If the device is not owned yet, successfully logged in user will be owner.
+ is_owner_login_ = ownership_status == DeviceSettingsService::OWNERSHIP_NONE;
+
// Use the same LoginPerformer for subsequent login as it has state
// such as Authenticator instance.
if (!login_performer_.get() || num_login_attempts_ <= 1) {
Mattias Nissler (ping if slow) 2012/08/06 21:38:00 Nikita, are you OK with folding the common parts o
Nikita (slow) 2012/08/08 10:50:02 num_login_attempts_ is reset to 0 when new user st
@@ -385,8 +384,9 @@ void ExistingUserController::Login(const std::string& username,
login_performer_.reset(NULL);
login_performer_.reset(new LoginPerformer(delegate));
}
+
is_login_in_progress_ = true;
- login_performer_->Login(username, password);
+ login_performer_->PerformLogin(username, password, auth_mode);
accessibility::MaybeSpeak(
l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNING_IN));
}
@@ -463,18 +463,18 @@ void ExistingUserController::OnUserSelected(const std::string& username) {
void ExistingUserController::OnStartEnterpriseEnrollment() {
CommandLine* command_line = CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kEnableDevicePolicy)) {
- OwnershipService::GetSharedInstance()->GetStatusAsync(
+ DeviceSettingsService::Get()->GetOwnershipStatusAsync(
base::Bind(&ExistingUserController::OnEnrollmentOwnershipCheckCompleted,
weak_factory_.GetWeakPtr()));
}
}
void ExistingUserController::OnEnrollmentOwnershipCheckCompleted(
- OwnershipService::Status status,
+ DeviceSettingsService::OwnershipStatus status,
bool current_user_is_owner) {
- if (status == OwnershipService::OWNERSHIP_NONE) {
+ if (status == DeviceSettingsService::OWNERSHIP_NONE) {
ShowEnrollmentScreen(false, std::string());
- } else if (status == OwnershipService::OWNERSHIP_TAKEN) {
+ } else if (status == DeviceSettingsService::OWNERSHIP_TAKEN) {
// On a device that is already owned we might want to allow users to
// re-enroll if the policy information is invalid.
CrosSettingsProvider::TrustedStatus trusted_status =

Powered by Google App Engine
This is Rietveld 408576698