Commit 2c18a961 authored by Tony de Luna's avatar Tony de Luna Committed by Commit Bot

OOBE: Hide Guest Mode button if disabled by policy

This cl adds an observer that listens for guest mode policy changes
and show/hides the Guest Mode button.

This only affects the OOBE flow. Non-OOBE Lock screen already hides
Guest Mode button if policy is updated.

Bug:936600

Change-Id: I12f541d22b6877328c2d6351774e620e3c18e166
Reviewed-on: https://chromium-review.googlesource.com/c/1492953
Commit-Queue: Tony De Luna <tonydeluna@chromium.org>
Reviewed-by: default avatarAlexander Alekseev <alemate@chromium.org>
Cr-Commit-Position: refs/heads/master@{#636889}
parent 6c0606ad
......@@ -89,6 +89,7 @@
#include "chrome/browser/policy/profile_policy_connector_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/ash/login_screen_client.h"
#include "chrome/browser/ui/ash/tablet_mode_client.h"
#include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
#include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h"
......@@ -332,6 +333,12 @@ void WizardController::Init(OobeScreen first_screen) {
weak_factory_.GetWeakPtr()));
}
}
if (CrosSettings::IsInitialized()) {
guest_mode_policy_subscription_ = CrosSettings::Get()->AddSettingsObserver(
kAccountsPrefAllowGuest,
base::BindRepeating(&WizardController::OnGuestModePolicyUpdated,
weak_factory_.GetWeakPtr()));
}
// Use the saved screen preference from Local State.
const std::string screen_pref =
......@@ -1571,6 +1578,11 @@ void WizardController::OnAccessibilityStatusChanged(
}
}
void WizardController::OnGuestModePolicyUpdated() {
LoginScreenClient::Get()->login_screen()->SetShowGuestButtonInOobe(
user_manager::UserManager::Get()->IsGuestSessionAllowed());
}
void WizardController::AutoLaunchKioskApp() {
KioskAppManager::App app_data;
std::string app_id = KioskAppManager::Get()->GetAutoLaunchApp();
......
......@@ -279,6 +279,9 @@ class WizardController : public BaseScreenDelegate,
void OnAccessibilityStatusChanged(
const AccessibilityStatusEventDetails& details);
// Notification of Guest Mode policy changes.
void OnGuestModePolicyUpdated();
// Switches from one screen to another.
void SetCurrentScreen(BaseScreen* screen);
......@@ -421,6 +424,8 @@ class WizardController : public BaseScreenDelegate,
friend class WizardControllerSupervisionTransitionOobeTest;
std::unique_ptr<AccessibilityStatusSubscription> accessibility_subscription_;
std::unique_ptr<CrosSettings::ObserverSubscription>
guest_mode_policy_subscription_;
std::unique_ptr<SimpleGeolocationProvider> geolocation_provider_;
std::unique_ptr<TimeZoneProvider> timezone_provider_;
......
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