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

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

Issue 6821075: Chrome-side lockbox bindings (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: CL RC1. Created 9 years, 8 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/enterprise_enrollment_view.cc
diff --git a/chrome/browser/chromeos/login/enterprise_enrollment_view.cc b/chrome/browser/chromeos/login/enterprise_enrollment_view.cc
index 44c7de5a9810528baeca7234cbffbbf6c6fab88c..1c807bf75e4308dba40044a84de62c459888a5b9 100644
--- a/chrome/browser/chromeos/login/enterprise_enrollment_view.cc
+++ b/chrome/browser/chromeos/login/enterprise_enrollment_view.cc
@@ -6,6 +6,8 @@
#include "base/json/json_writer.h"
#include "base/values.h"
+#include "chrome/browser/chromeos/cros/cros_library.h"
+#include "chrome/browser/chromeos/cros/cryptohome_library.h"
#include "chrome/browser/chromeos/login/enterprise_enrollment_screen.h"
#include "chrome/browser/chromeos/login/helper.h"
#include "chrome/browser/chromeos/login/rounded_rect_painter.h"
@@ -75,6 +77,7 @@ class EnrollmentDomView : public WebPageDomView,
}
private:
+
DISALLOW_COPY_AND_ASSIGN(EnrollmentDomView);
};
@@ -82,7 +85,8 @@ class EnrollmentDomView : public WebPageDomView,
EnterpriseEnrollmentView::EnterpriseEnrollmentView(
EnterpriseEnrollmentController* controller)
- : controller_(controller) {}
+ : controller_(controller),
+ editable_user_(true) {}
EnterpriseEnrollmentView::~EnterpriseEnrollmentView() {}
@@ -108,6 +112,41 @@ void EnterpriseEnrollmentView::Init() {
EnterpriseEnrollmentUI::SetController(enrollment_page_view_->tab_contents(),
this);
enrollment_page_view_->LoadURL(url);
+
+ // Check lockbox data and update the view if needed.
+ chromeos::CryptohomeLibrary* cryptohome =
+ chromeos::CrosLibrary::Get()->GetCryptohomeLibrary();
+ // TODO(pastarmovj): This is being done either on the eula screen or on first
+ // login so maybe we should do it already here? If not remove.
+ if (cryptohome) {
+ if (cryptohome->TpmIsEnabled() && !cryptohome->TpmIsBeingOwned()) {
+ if (cryptohome->TpmIsOwned())
+ cryptohome->TpmClearStoredPassword();
+ else
+ cryptohome->TpmCanAttemptOwnership();
+ }
+
+ if (cryptohome->InstallAttributesIsReady() &&
+ !cryptohome->InstallAttributesIsFirstInstall()) {
+ std::string value;
+ if (cryptohome->InstallAttributesGet("enterprise.owned", &value) &&
+ 0 == value.compare("true")) {
+ if (cryptohome->InstallAttributesGet("enterprise.user", &value)) {
+ DictionaryValue args;
+ args.SetString("user", value);
+ args.SetBoolean("editable_user", false);
+ editable_user_ = false;
+ UpdateGaiaLogin(args);
Will Drewry 2011/04/15 02:38:19 Is this only used during enrollment or will enterp
+ } else {
+ // TODO(pastarmovj): Put some new error message here!
+ ShowError(IDS_ENTERPRISE_ENROLLMENT_FATAL_ENROLLMENT_ERROR);
+ }
+ }
+ }
+ } else {
+ // TODO(pastarmovj): Put some new error message here!
+ ShowError(IDS_ENTERPRISE_ENROLLMENT_FATAL_ENROLLMENT_ERROR);
+ }
}
void EnterpriseEnrollmentView::ShowConfirmationScreen() {
@@ -122,7 +161,7 @@ void EnterpriseEnrollmentView::ShowAuthError(
const GoogleServiceAuthError& error) {
DictionaryValue args;
args.SetInteger("error", error.state());
- args.SetBoolean("editable_user", true);
+ args.SetBoolean("editable_user", editable_user_);
args.SetString("captchaUrl", error.captcha().image_url.spec());
UpdateGaiaLogin(args);
}
@@ -147,6 +186,7 @@ void EnterpriseEnrollmentView::OnAuthSubmitted(const std::string& user,
const std::string& password,
const std::string& captcha,
const std::string& access_code) {
+ user_ = user;
controller_->Authenticate(user, password, captcha, access_code);
}
@@ -172,7 +212,7 @@ void EnterpriseEnrollmentView::UpdateGaiaLogin(const DictionaryValue& args) {
void EnterpriseEnrollmentView::ShowError(int message_id) {
DictionaryValue args;
args.SetInteger("error", GoogleServiceAuthError::NONE);
- args.SetBoolean("editable_user", true);
+ args.SetBoolean("editable_user", editable_user_);
args.SetString("error_message", l10n_util::GetStringUTF16(message_id));
UpdateGaiaLogin(args);
}

Powered by Google App Engine
This is Rietveld 408576698