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

Unified Diff: chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc

Issue 2544773002: Fetch policy from Active Directory at the end of enrollment (Closed)
Patch Set: Convert CHECK_EQ(true, ...) to CHECK(...) Created 4 years 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/policy/enrollment_handler_chromeos.cc
diff --git a/chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc b/chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc
index 3338b0d42dd4db4edfe558703e15990b91a3ecec..02c3c067a6cfe0d33a8ca7adfc8cbcf6d0083132 100644
--- a/chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc
+++ b/chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc
@@ -25,6 +25,8 @@
#include "chrome/browser/profiles/profile.h"
#include "chromeos/attestation/attestation_flow.h"
#include "chromeos/chromeos_switches.h"
+#include "chromeos/dbus/auth_policy_client.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
#include "google_apis/gaia/gaia_auth_util.h"
#include "google_apis/gaia/gaia_urls.h"
#include "net/http/http_status_code.h"
@@ -250,6 +252,7 @@ void EnrollmentHandlerChromeOS::OnStoreError(CloudPolicyStore* store) {
// enterprise-managed.
return;
}
+ LOG(ERROR) << "Error in device policy store.";
ReportResult(EnrollmentStatus::ForStoreError(store_->status(),
store_->validation_status()));
}
@@ -488,14 +491,38 @@ void EnrollmentHandlerChromeOS::HandleStoreRobotAuthTokenResult(bool result) {
return;
}
+ SetStep(STEP_STORE_POLICY);
if (device_mode_ == policy::DEVICE_MODE_ENTERPRISE_AD) {
- ReportResult(EnrollmentStatus::ForStatus(EnrollmentStatus::STATUS_SUCCESS));
+ CHECK(install_attributes_->IsActiveDirectoryManaged());
+ // Update device settings so that in case of Active Directory unsigned
+ // policy is accepted.
+ chromeos::DeviceSettingsService::Get()->SetDeviceMode(
+ install_attributes_->GetMode());
+ chromeos::DBusThreadManager::Get()
+ ->GetAuthPolicyClient()
+ ->RefreshDevicePolicy(base::Bind(
+ &EnrollmentHandlerChromeOS::HandleActiveDirectoryPolicyRefreshed,
+ weak_ptr_factory_.GetWeakPtr()));
} else {
- SetStep(STEP_STORE_POLICY);
store_->InstallInitialPolicy(*policy_);
}
}
+void EnrollmentHandlerChromeOS::HandleActiveDirectoryPolicyRefreshed(
+ bool success) {
+ DCHECK_EQ(STEP_STORE_POLICY, enrollment_step_);
+
+ if (!success) {
+ LOG(ERROR) << "Failed to load Active Directory policy.";
+ ReportResult(EnrollmentStatus::ForStatus(
+ EnrollmentStatus::STATUS_ACTIVE_DIRECTORY_POLICY_FETCH_FAILED));
+ return;
+ }
+
+ // After that, the enrollment flow continues in one of the OnStore* observers.
+ store_->Load();
+}
+
void EnrollmentHandlerChromeOS::Stop() {
if (client_.get())
client_->RemoveObserver(this);

Powered by Google App Engine
This is Rietveld 408576698