Commit ac371d7a authored by tnagel's avatar tnagel Committed by Commit bot

Restart browser after Chromad enrollment

The current factoring of BrowserPolicyConnectorChromeOS only allows to
swap out the device policy provider at initialization time, not at run
time.  As a consequence, we end up with the wrong device policy provider
after Chromad enrollment.  A browser restart is the easiest way to fix
this.

BUG=681817

Review-Url: https://codereview.chromium.org/2842163002
Cr-Commit-Position: refs/heads/master@{#468592}
parent 3483d15c
......@@ -20,6 +20,7 @@
#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 "chrome/browser/lifetime/application_lifetime.h"
#include "chromeos/dbus/cryptohome_client.h"
#include "chromeos/dbus/dbus_method_call_status.h"
#include "chromeos/dbus/dbus_thread_manager.h"
......@@ -248,6 +249,16 @@ void EnrollmentScreen::OnCancel() {
void EnrollmentScreen::OnConfirmationClosed() {
ClearAuth(base::Bind(&EnrollmentScreen::Finish, base::Unretained(this),
ScreenExitCode::ENTERPRISE_ENROLLMENT_COMPLETED));
// Restart browser to switch from DeviceCloudPolicyManagerChromeOS to
// DeviceActiveDirectoryPolicyManager.
if (g_browser_process->platform_part()
->browser_policy_connector_chromeos()
->IsActiveDirectoryManaged()) {
// TODO(tnagel): Refactor BrowserPolicyConnectorChromeOS so that device
// policy providers are only registered after enrollment has finished and
// thus the correct one can be picked without restarting the browser.
chrome::AttemptRestart();
}
}
void EnrollmentScreen::OnAdJoined(const std::string& realm) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment