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

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

Issue 220933003: Only perform forced re-enrollment in official builds. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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/auto_enrollment_controller.cc
diff --git a/chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.cc b/chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.cc
index 1c78f41876b1b92ab353ad757db90b8e4863e5d8..4addba0f9368ab7c5f6d93fe6db0bb2cbe6f08e4 100644
--- a/chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.cc
+++ b/chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.cc
@@ -49,6 +49,36 @@ int GetSanitizedArg(const std::string& switch_name) {
} // namespace
+const char AutoEnrollmentController::kForcedReEnrollmentAlways[] = "always";
+const char AutoEnrollmentController::kForcedReEnrollmentLegacy[] = "legacy";
+const char AutoEnrollmentController::kForcedReEnrollmentNever[] = "never";
+const char AutoEnrollmentController::kForcedReEnrollmentOfficialBuild[] =
+ "official";
+
+AutoEnrollmentController::Mode AutoEnrollmentController::GetMode() {
+ CommandLine* command_line = CommandLine::ForCurrentProcess();
+
+ if (!command_line->HasSwitch(switches::kEnterpriseEnableForcedReEnrollment))
+ return MODE_LEGACY_AUTO_ENROLLMENT;
+
+ std::string command_line_mode = command_line->GetSwitchValueASCII(
+ switches::kEnterpriseEnableForcedReEnrollment);
+ if (command_line_mode.empty() ||
Joao da Silva 2014/04/02 07:41:45 Why?
Mattias Nissler (ping if slow) 2014/04/02 07:45:00 Because that's the original behavior of the flag a
Joao da Silva 2014/04/02 07:48:05 Right, the flag could be used before without a val
Mattias Nissler (ping if slow) 2014/04/02 13:10:39 But in fact, it should only switch on FRE on offic
+ command_line_mode == kForcedReEnrollmentAlways) {
+ return MODE_FORCED_RE_ENROLLMENT;
+ } else if (command_line_mode == kForcedReEnrollmentOfficialBuild) {
+#if defined(OFFICIAL_BUILD)
+ return MODE_FORCED_RE_ENROLLMENT;
+#else
+ return MODE_NONE;
+#endif
+ } else if (command_line_mode == kForcedReEnrollmentLegacy) {
+ return MODE_LEGACY_AUTO_ENROLLMENT;
+ }
+
+ return MODE_NONE;
+}
+
AutoEnrollmentController::AutoEnrollmentController()
: state_(policy::AUTO_ENROLLMENT_STATE_IDLE),
weak_factory_(this) {}
@@ -63,12 +93,15 @@ void AutoEnrollmentController::Start() {
// Do not communicate auto-enrollment data to the server if
// 1. we are running integration or perf tests with telemetry.
// 2. modulus configuration is not present.
+ // 3. Auto-enrollment is disabled via the command line.
+
CommandLine* command_line = CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(chromeos::switches::kOobeSkipPostLogin) ||
(!command_line->HasSwitch(
chromeos::switches::kEnterpriseEnrollmentInitialModulus) &&
!command_line->HasSwitch(
- chromeos::switches::kEnterpriseEnrollmentModulusLimit))) {
+ chromeos::switches::kEnterpriseEnrollmentModulusLimit)) ||
+ GetMode() == MODE_NONE) {
VLOG(1) << "Auto-enrollment disabled.";
UpdateState(policy::AUTO_ENROLLMENT_STATE_NO_ENROLLMENT);
return;
@@ -106,9 +139,8 @@ AutoEnrollmentController::RegisterProgressCallback(
}
bool AutoEnrollmentController::ShouldEnrollSilently() {
- return !CommandLine::ForCurrentProcess()->HasSwitch(
- chromeos::switches::kEnterpriseEnableForcedReEnrollment) &&
- state_ == policy::AUTO_ENROLLMENT_STATE_TRIGGER_ENROLLMENT;
+ return state_ == policy::AUTO_ENROLLMENT_STATE_TRIGGER_ENROLLMENT &&
+ GetMode() == MODE_LEGACY_AUTO_ENROLLMENT;
}
void AutoEnrollmentController::OnOwnershipStatusCheckDone(
@@ -138,8 +170,7 @@ void AutoEnrollmentController::OnOwnershipStatusCheckDone(
bool retrieve_device_state = false;
std::string device_id;
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- chromeos::switches::kEnterpriseEnableForcedReEnrollment)) {
+ if (GetMode() == MODE_FORCED_RE_ENROLLMENT) {
retrieve_device_state = true;
device_id =
policy::DeviceCloudPolicyManagerChromeOS::GetCurrentDeviceStateKey();

Powered by Google App Engine
This is Rietveld 408576698