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

Unified Diff: chrome/browser/chromeos/login/enrollment/enrollment_screen.cc

Issue 2677563005: Chromad: Use DM server reply to determine enrollment type (Closed)
Patch Set: More comments Created 3 years, 10 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/enrollment/enrollment_screen.cc
diff --git a/chrome/browser/chromeos/login/enrollment/enrollment_screen.cc b/chrome/browser/chromeos/login/enrollment/enrollment_screen.cc
index 235d8c8052ded6d0d1cdfa48ab2b59a0dbe2139e..73db1d4a1a6535a1ad34bf252d5226fbcf5411c2 100644
--- a/chrome/browser/chromeos/login/enrollment/enrollment_screen.cc
+++ b/chrome/browser/chromeos/login/enrollment/enrollment_screen.cc
@@ -7,7 +7,6 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/callback.h"
-#include "base/command_line.h"
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
#include "base/timer/elapsed_timer.h"
@@ -21,7 +20,6 @@
#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
#include "chrome/browser/chromeos/policy/enrollment_status_chromeos.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
-#include "chromeos/chromeos_switches.h"
#include "chromeos/dbus/cryptohome_client.h"
#include "chromeos/dbus/dbus_method_call_status.h"
#include "chromeos/dbus/dbus_thread_manager.h"
@@ -144,7 +142,7 @@ bool EnrollmentScreen::AdvanceToNextAuth() {
void EnrollmentScreen::CreateEnrollmentHelper() {
if (!enrollment_helper_) {
enrollment_helper_ = EnterpriseEnrollmentHelper::Create(
- this, config_, enrolling_user_domain_);
+ this, this, config_, enrolling_user_domain_);
}
}
@@ -201,14 +199,13 @@ void EnrollmentScreen::OnLoginDone(const std::string& user,
LOG_IF(ERROR, auth_code.empty()) << "Auth code is empty.";
elapsed_timer_.reset(new base::ElapsedTimer());
enrolling_user_domain_ = gaia::ExtractDomainName(user);
- auth_code_ = auth_code;
- // TODO(rsorokin): Move ShowAdJoin after STEP_REGISTRATION
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- chromeos::switches::kEnableAd)) {
- actor_->ShowAdJoin();
- } else {
- OnAdJoined("");
- }
+ UMA(enrollment_failed_once_ ? policy::kMetricEnrollmentRestarted
+ : policy::kMetricEnrollmentStarted);
+
+ actor_->ShowEnrollmentSpinnerScreen();
+ CreateEnrollmentHelper();
+ enrollment_helper_->EnrollUsingAuthCode(
+ auth_code, shark_controller_ != nullptr /* fetch_additional_token */);
}
void EnrollmentScreen::OnRetry() {
@@ -254,16 +251,7 @@ void EnrollmentScreen::OnConfirmationClosed() {
}
void EnrollmentScreen::OnAdJoined(const std::string& realm) {
- if (!realm.empty()) {
- config_.management_realm = realm;
- }
- UMA(enrollment_failed_once_ ? policy::kMetricEnrollmentRestarted
- : policy::kMetricEnrollmentStarted);
-
- actor_->ShowEnrollmentSpinnerScreen();
- CreateEnrollmentHelper();
- enrollment_helper_->EnrollUsingAuthCode(
- auth_code_, shark_controller_ != NULL /* fetch_additional_token */);
+ std::move(on_joined_callback_).Run(realm);
}
void EnrollmentScreen::OnAuthError(const GoogleServiceAuthError& error) {
@@ -393,4 +381,9 @@ void EnrollmentScreen::RecordEnrollmentErrorMetrics() {
UMA_ENROLLMENT_TIME(kMetricEnrollmentTimeFailure, elapsed_timer_);
}
+void EnrollmentScreen::JoinDomain(OnDomainJoinedCallback on_joined_callback) {
+ on_joined_callback_ = std::move(on_joined_callback);
+ actor_->ShowAdJoin();
+}
+
} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698