| 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 4bee026dc31dbb5a3632b66012bbc6f6625e611e..51126115e9cf353db2bbf7f3afd72c5129ad6132 100644
|
| --- a/chrome/browser/chromeos/login/enterprise_enrollment_screen.cc
|
| +++ b/chrome/browser/chromeos/login/enterprise_enrollment_screen.cc
|
| @@ -85,6 +85,13 @@ void EnterpriseEnrollmentScreen::OnAuthSubmitted(
|
| }
|
| }
|
|
|
| +void EnterpriseEnrollmentScreen::OnOAuthTokenAvailable(
|
| + const std::string& user,
|
| + const std::string& token) {
|
| + user_ = user;
|
| + RegisterForDevicePolicy("", token);
|
| +}
|
| +
|
| void EnterpriseEnrollmentScreen::OnAuthCancelled() {
|
| UMA_HISTOGRAM_ENUMERATION(policy::kMetricEnrollment,
|
| policy::kMetricEnrollmentCancelled,
|
| @@ -150,25 +157,7 @@ void EnterpriseEnrollmentScreen::OnIssueAuthTokenSuccess(
|
|
|
| scoped_ptr<GaiaAuthFetcher> auth_fetcher(auth_fetcher_.release());
|
|
|
| - policy::BrowserPolicyConnector* connector =
|
| - g_browser_process->browser_policy_connector();
|
| - if (!connector->device_cloud_policy_subsystem()) {
|
| - NOTREACHED() << "Cloud policy subsystem not initialized.";
|
| - UMA_HISTOGRAM_ENUMERATION(policy::kMetricEnrollment,
|
| - policy::kMetricEnrollmentOtherFailed,
|
| - policy::kMetricEnrollmentSize);
|
| - if (is_showing_)
|
| - actor_->ShowFatalEnrollmentError();
|
| - return;
|
| - }
|
| -
|
| - connector->ScheduleServiceInitialization(0);
|
| - registrar_.reset(new policy::CloudPolicySubsystem::ObserverRegistrar(
|
| - connector->device_cloud_policy_subsystem(), this));
|
| -
|
| - // Push the credentials to the policy infrastructure. It'll start enrollment
|
| - // and notify us of progress through CloudPolicySubsystem::Observer.
|
| - connector->SetDeviceCredentials(user_, auth_token);
|
| + RegisterForDevicePolicy(auth_token, "");
|
| }
|
|
|
| void EnterpriseEnrollmentScreen::OnIssueAuthTokenFailure(
|
| @@ -323,4 +312,28 @@ void EnterpriseEnrollmentScreen::WriteInstallAttributesData() {
|
| NOTREACHED();
|
| }
|
|
|
| +void EnterpriseEnrollmentScreen::RegisterForDevicePolicy(
|
| + const std::string& gaia_auth_token,
|
| + const std::string& oauth_token) {
|
| + policy::BrowserPolicyConnector* connector =
|
| + g_browser_process->browser_policy_connector();
|
| + if (!connector->device_cloud_policy_subsystem()) {
|
| + NOTREACHED() << "Cloud policy subsystem not initialized.";
|
| + UMA_HISTOGRAM_ENUMERATION(policy::kMetricEnrollment,
|
| + policy::kMetricEnrollmentOtherFailed,
|
| + policy::kMetricEnrollmentSize);
|
| + if (is_showing_)
|
| + actor_->ShowFatalEnrollmentError();
|
| + return;
|
| + }
|
| +
|
| + connector->ScheduleServiceInitialization(0);
|
| + registrar_.reset(new policy::CloudPolicySubsystem::ObserverRegistrar(
|
| + connector->device_cloud_policy_subsystem(), this));
|
| +
|
| + // Push the credentials to the policy infrastructure. It'll start enrollment
|
| + // and notify us of progress through CloudPolicySubsystem::Observer.
|
| + connector->SetDeviceCredentials(user_, gaia_auth_token, oauth_token);
|
| +}
|
| +
|
| } // namespace chromeos
|
|
|