Commit 4180c8d1 authored by Jacob Dufault's avatar Jacob Dufault Committed by Commit Bot

Simplify usage of HonorDeviceDisablingDuringNormalOperation.

Bug: 784495
Change-Id: I16557453bd167e49b2deaeb99f1c1eb2bb80d1c7
Reviewed-on: https://chromium-review.googlesource.com/809630Reviewed-by: default avatarAlexander Alekseev <alemate@chromium.org>
Commit-Queue: Jacob Dufault <jdufault@chromium.org>
Cr-Commit-Position: refs/heads/master@{#522132}
parent 82c911c3
...@@ -1575,10 +1575,7 @@ void ExistingUserController::ContinueLoginIfDeviceNotDisabled( ...@@ -1575,10 +1575,7 @@ void ExistingUserController::ContinueLoginIfDeviceNotDisabled(
return; return;
} }
bool device_disabled = false; if (system::DeviceDisablingManager::IsDeviceDisabledDuringNormalOperation()) {
cros_settings_->GetBoolean(kDeviceDisabled, &device_disabled);
if (device_disabled && system::DeviceDisablingManager::
HonorDeviceDisablingDuringNormalOperation()) {
// If the device is disabled, bail out. A device disabled screen will be // If the device is disabled, bail out. A device disabled screen will be
// shown by the DeviceDisablingManager. // shown by the DeviceDisablingManager.
...@@ -1587,7 +1584,6 @@ void ExistingUserController::ContinueLoginIfDeviceNotDisabled( ...@@ -1587,7 +1584,6 @@ void ExistingUserController::ContinueLoginIfDeviceNotDisabled(
login_display_->SetUIEnabled(true); login_display_->SetUIEnabled(true);
return; return;
} }
// if ()
chromeos::DBusThreadManager::Get() chromeos::DBusThreadManager::Get()
->GetCryptohomeClient() ->GetCryptohomeClient()
......
...@@ -856,10 +856,7 @@ void LoginDisplayHostWebUI::StartAppLaunch(const std::string& app_id, ...@@ -856,10 +856,7 @@ void LoginDisplayHostWebUI::StartAppLaunch(const std::string& app_id,
return; return;
} }
bool device_disabled = false; if (system::DeviceDisablingManager::IsDeviceDisabledDuringNormalOperation()) {
CrosSettings::Get()->GetBoolean(kDeviceDisabled, &device_disabled);
if (device_disabled && system::DeviceDisablingManager::
HonorDeviceDisablingDuringNormalOperation()) {
// If the device is disabled, bail out. A device disabled screen will be // If the device is disabled, bail out. A device disabled screen will be
// shown by the DeviceDisablingManager. // shown by the DeviceDisablingManager.
return; return;
......
...@@ -1441,10 +1441,7 @@ void WizardController::AutoLaunchKioskApp() { ...@@ -1441,10 +1441,7 @@ void WizardController::AutoLaunchKioskApp() {
return; return;
} }
bool device_disabled = false; if (system::DeviceDisablingManager::IsDeviceDisabledDuringNormalOperation()) {
CrosSettings::Get()->GetBoolean(kDeviceDisabled, &device_disabled);
if (device_disabled && system::DeviceDisablingManager::
HonorDeviceDisablingDuringNormalOperation()) {
// If the device is disabled, bail out. A device disabled screen will be // If the device is disabled, bail out. A device disabled screen will be
// shown by the DeviceDisablingManager. // shown by the DeviceDisablingManager.
return; return;
......
...@@ -144,6 +144,17 @@ void DeviceDisablingManager::CheckWhetherDeviceDisabledDuringOOBE( ...@@ -144,6 +144,17 @@ void DeviceDisablingManager::CheckWhetherDeviceDisabledDuringOOBE(
callback.Run(true); callback.Run(true);
} }
// static
bool DeviceDisablingManager::IsDeviceDisabledDuringNormalOperation() {
bool device_disabled = false;
CrosSettings::Get()->GetBoolean(kDeviceDisabled, &device_disabled);
if (device_disabled && HonorDeviceDisablingDuringNormalOperation()) {
return true;
}
return false;
}
// static // static
bool DeviceDisablingManager::HonorDeviceDisablingDuringNormalOperation() { bool DeviceDisablingManager::HonorDeviceDisablingDuringNormalOperation() {
// Device disabling should be honored when the device is enterprise managed // Device disabling should be honored when the device is enterprise managed
......
...@@ -104,6 +104,10 @@ class DeviceDisablingManager { ...@@ -104,6 +104,10 @@ class DeviceDisablingManager {
void CheckWhetherDeviceDisabledDuringOOBE( void CheckWhetherDeviceDisabledDuringOOBE(
const DeviceDisabledCheckCallback& callback); const DeviceDisabledCheckCallback& callback);
// Returns true if trusted cros settings say the device is disabled and the
// device disabled setting should be honored.
static bool IsDeviceDisabledDuringNormalOperation();
// Whenever trusted cros settings indicate that the device is disabled, this // Whenever trusted cros settings indicate that the device is disabled, this
// method should be used to check whether the device disabling is to be // method should be used to check whether the device disabling is to be
// honored. If this method returns false, the device should not be disabled. // honored. If this method returns false, the device should not be disabled.
......
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