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

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: 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..34dd77b091a6b773b637d547f99ffed720f1da2a 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(
@@ -129,7 +130,8 @@ void EnterpriseEnrollmentScreen::OnIssueAuthTokenSuccess(
registrar_.reset(new policy::CloudPolicySubsystem::ObserverRegistrar(
connector->cloud_policy_subsystem(), this));
-
+ LOG(ERROR) << "### Auth done!";
Mattias Nissler (ping if slow) 2011/04/19 12:15:25 Be sure to remove this or make it a VLOG() before
+ connector->cloud_policy_subsystem()->StopAfterTokenFetch(true);
// Push the credentials to the policy infrastructure. It'll start enrollment
// and notify us of progress through CloudPolicySubsystem::Observer.
connector->SetCredentials(user_, auth_token);
@@ -150,6 +152,7 @@ void EnterpriseEnrollmentScreen::OnPolicyStateChanged(
policy::CloudPolicySubsystem::PolicySubsystemState state,
policy::CloudPolicySubsystem::ErrorDetails error_details) {
+ LOG(ERROR) << "### State change : " << state;
Mattias Nissler (ping if slow) 2011/04/19 12:15:25 same here.
if (view()) {
switch (state) {
case policy::CloudPolicySubsystem::UNENROLLED:
@@ -165,6 +168,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,38 +225,45 @@ 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();
if (!view())
return;
+ LOG(ERROR) << "### Lock it!";
Mattias Nissler (ping if slow) 2011/04/19 12:15:25 And here!
+
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->cloud_policy_subsystem()->SendPolicyRequest();
Mattias Nissler (ping if slow) 2011/04/19 12:15:25 This should probably be connector->EnablePolicy(),
+ LOG(ERROR) << "### Locked!";
Mattias Nissler (ping if slow) 2011/04/19 12:15:25 And here.
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