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

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

Issue 6882038: Move writing information to the lockbox after registering with the DM server. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fixed nits and rebase issues. 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_screen.cc
diff --git a/chrome/browser/chromeos/login/enterprise_enrollment_screen.cc b/chrome/browser/chromeos/login/enterprise_enrollment_screen.cc
index 48ed015b725d00ce1edc4b2b46241da470bc6723..97ea0ae5ca002967a6edcf0b0fa9b181ddad3689 100644
--- a/chrome/browser/chromeos/login/enterprise_enrollment_screen.cc
+++ b/chrome/browser/chromeos/login/enterprise_enrollment_screen.cc
@@ -100,7 +100,8 @@ bool EnterpriseEnrollmentScreen::GetInitialUser(std::string* user) {
void EnterpriseEnrollmentScreen::OnClientLoginSuccess(
const ClientLoginResult& result) {
- WriteInstallAttributesData(result);
+ auth_fetcher_->StartIssueAuthToken(
+ result.sid, result.lsid, GaiaConstants::kDeviceManagementService);
}
void EnterpriseEnrollmentScreen::OnClientLoginFailure(
@@ -165,6 +166,9 @@ void EnterpriseEnrollmentScreen::OnPolicyStateChanged(
case policy::CloudPolicySubsystem::NETWORK_ERROR:
view()->ShowNetworkEnrollmentError();
break;
+ case policy::CloudPolicySubsystem::TOKEN_FETCHED:
+ WriteInstallAttributesData();
+ return;
case policy::CloudPolicySubsystem::SUCCESS:
// Success!
registrar_.reset();
@@ -219,8 +223,7 @@ void EnterpriseEnrollmentScreen::HandleAuthError(
NOTREACHED() << error.state();
}
-void EnterpriseEnrollmentScreen::WriteInstallAttributesData(
- const ClientLoginResult& result) {
+void EnterpriseEnrollmentScreen::WriteInstallAttributesData() {
// Since this method is also called directly.
runnable_method_factory_.RevokeAll();
@@ -228,29 +231,34 @@ void EnterpriseEnrollmentScreen::WriteInstallAttributesData(
return;
switch (g_browser_process->browser_policy_connector()->LockDevice(user_)) {
- case policy::EnterpriseInstallAttributes::LOCK_SUCCESS:
- // Proceed with register and policy fetch.
- auth_fetcher_->StartIssueAuthToken(
- result.sid, result.lsid, GaiaConstants::kDeviceManagementService);
+ case policy::EnterpriseInstallAttributes::LOCK_SUCCESS: {
+ // Proceed with policy fetch.
+ policy::BrowserPolicyConnector* connector =
+ g_browser_process->browser_policy_connector();
+ connector->FetchPolicy();
return;
- case policy::EnterpriseInstallAttributes::LOCK_NOT_READY:
+ }
+ case policy::EnterpriseInstallAttributes::LOCK_NOT_READY: {
// InstallAttributes not ready yet, retry later.
LOG(WARNING) << "Install Attributes not ready yet will retry in "
<< kLockRetryIntervalMs << "ms.";
MessageLoop::current()->PostDelayedTask(
FROM_HERE,
runnable_method_factory_.NewRunnableMethod(
- &EnterpriseEnrollmentScreen::WriteInstallAttributesData, result),
+ &EnterpriseEnrollmentScreen::WriteInstallAttributesData),
kLockRetryIntervalMs);
return;
- case policy::EnterpriseInstallAttributes::LOCK_BACKEND_ERROR:
+ }
+ case policy::EnterpriseInstallAttributes::LOCK_BACKEND_ERROR: {
view()->ShowFatalEnrollmentError();
return;
- case policy::EnterpriseInstallAttributes::LOCK_WRONG_USER:
+ }
+ case policy::EnterpriseInstallAttributes::LOCK_WRONG_USER: {
LOG(ERROR) << "Enrollment can not proceed because the InstallAttrs "
<< "has been locked already!";
view()->ShowFatalEnrollmentError();
return;
+ }
}
NOTREACHED();

Powered by Google App Engine
This is Rietveld 408576698