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

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

Issue 7562008: Add new version of enrollment screen supporting OAuth. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, fix nit. Created 9 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/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..48bc4729e0e516ce341768f0899b6b765fe8214a 100644
--- a/chrome/browser/chromeos/login/enterprise_enrollment_screen.cc
+++ b/chrome/browser/chromeos/login/enterprise_enrollment_screen.cc
@@ -11,7 +11,6 @@
#include "chrome/browser/chromeos/cros/cryptohome_library.h"
#include "chrome/browser/chromeos/login/enterprise_enrollment_screen_actor.h"
#include "chrome/browser/chromeos/login/screen_observer.h"
-#include "chrome/browser/policy/browser_policy_connector.h"
#include "chrome/browser/policy/enterprise_metrics.h"
#include "chrome/common/net/gaia/gaia_constants.h"
#include "chrome/common/net/gaia/google_service_auth_error.h"
@@ -85,6 +84,14 @@ void EnterpriseEnrollmentScreen::OnAuthSubmitted(
}
}
+void EnterpriseEnrollmentScreen::OnOAuthTokenAvailable(
+ const std::string& user,
+ const std::string& token) {
+ user_ = user;
+ RegisterForDevicePolicy(token,
+ policy::BrowserPolicyConnector::TOKEN_TYPE_OAUTH);
+}
+
void EnterpriseEnrollmentScreen::OnAuthCancelled() {
UMA_HISTOGRAM_ENUMERATION(policy::kMetricEnrollment,
policy::kMetricEnrollmentCancelled,
@@ -150,25 +157,8 @@ 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,
+ policy::BrowserPolicyConnector::TOKEN_TYPE_GAIA);
}
void EnterpriseEnrollmentScreen::OnIssueAuthTokenFailure(
@@ -323,4 +313,28 @@ void EnterpriseEnrollmentScreen::WriteInstallAttributesData() {
NOTREACHED();
}
+void EnterpriseEnrollmentScreen::RegisterForDevicePolicy(
+ const std::string& token,
+ policy::BrowserPolicyConnector::TokenType token_type) {
+ 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_, token, token_type);
+}
+
} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698