Commit 38a46620 authored by Henrique Ferreiro's avatar Henrique Ferreiro Committed by Chromium LUCI CQ

Make KioskAppManager::AutoLoginState an enum class

This CL is part of the Chrome OS source code directory migration:
https://docs.google.com/document/d/1g-98HpzA8XcoGBWUv1gQNr4rbnD5yfvbtYZyPDDbkaE.

Bug: 1101837, 1164001
Change-Id: Ife8f40d30569e2eff4b6c6c97e7efe2d58ff1c77
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2640415
Commit-Queue: Henrique Ferreiro <hferreiro@igalia.com>
Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#845864}
parent d65bef81
...@@ -185,7 +185,7 @@ std::string KioskAppManager::GetAutoLaunchApp() const { ...@@ -185,7 +185,7 @@ std::string KioskAppManager::GetAutoLaunchApp() const {
void KioskAppManager::SetAutoLaunchApp(const std::string& app_id, void KioskAppManager::SetAutoLaunchApp(const std::string& app_id,
OwnerSettingsServiceChromeOS* service) { OwnerSettingsServiceChromeOS* service) {
SetAutoLoginState(AUTOLOGIN_REQUESTED); SetAutoLoginState(AutoLoginState::kRequested);
// Clean first, so the proper change callbacks are triggered even // Clean first, so the proper change callbacks are triggered even
// if we are only changing AutoLoginState here. // if we are only changing AutoLoginState here.
if (!auto_launch_app_id_.empty()) { if (!auto_launch_app_id_.empty()) {
...@@ -405,7 +405,8 @@ void KioskAppManager::OnReadImmutableAttributes( ...@@ -405,7 +405,8 @@ void KioskAppManager::OnReadImmutableAttributes(
} }
void KioskAppManager::SetEnableAutoLaunch(bool value) { void KioskAppManager::SetEnableAutoLaunch(bool value) {
SetAutoLoginState(value ? AUTOLOGIN_APPROVED : AUTOLOGIN_REJECTED); SetAutoLoginState(value ? AutoLoginState::kApproved
: AutoLoginState::kRejected);
} }
bool KioskAppManager::IsAutoLaunchRequested() const { bool KioskAppManager::IsAutoLaunchRequested() const {
...@@ -419,7 +420,7 @@ bool KioskAppManager::IsAutoLaunchRequested() const { ...@@ -419,7 +420,7 @@ bool KioskAppManager::IsAutoLaunchRequested() const {
if (connector->IsEnterpriseManaged()) if (connector->IsEnterpriseManaged())
return false; return false;
return GetAutoLoginState() == AUTOLOGIN_REQUESTED; return GetAutoLoginState() == AutoLoginState::kRequested;
} }
bool KioskAppManager::IsAutoLaunchEnabled() const { bool KioskAppManager::IsAutoLaunchEnabled() const {
...@@ -433,7 +434,7 @@ bool KioskAppManager::IsAutoLaunchEnabled() const { ...@@ -433,7 +434,7 @@ bool KioskAppManager::IsAutoLaunchEnabled() const {
if (connector->IsEnterpriseManaged()) if (connector->IsEnterpriseManaged())
return true; return true;
return GetAutoLoginState() == AUTOLOGIN_APPROVED; return GetAutoLoginState() == AutoLoginState::kApproved;
} }
std::string KioskAppManager::GetAutoLaunchAppRequiredPlatformVersion() const { std::string KioskAppManager::GetAutoLaunchAppRequiredPlatformVersion() const {
...@@ -839,7 +840,7 @@ KioskAppManager::AutoLoginState KioskAppManager::GetAutoLoginState() const { ...@@ -839,7 +840,7 @@ KioskAppManager::AutoLoginState KioskAppManager::GetAutoLoginState() const {
prefs->GetDictionary(KioskAppManager::kKioskDictionaryName); prefs->GetDictionary(KioskAppManager::kKioskDictionaryName);
int value; int value;
if (!dict->GetInteger(kKeyAutoLoginState, &value)) if (!dict->GetInteger(kKeyAutoLoginState, &value))
return AUTOLOGIN_NONE; return AutoLoginState::kNone;
return static_cast<AutoLoginState>(value); return static_cast<AutoLoginState>(value);
} }
...@@ -848,7 +849,7 @@ void KioskAppManager::SetAutoLoginState(AutoLoginState state) { ...@@ -848,7 +849,7 @@ void KioskAppManager::SetAutoLoginState(AutoLoginState state) {
PrefService* prefs = g_browser_process->local_state(); PrefService* prefs = g_browser_process->local_state();
DictionaryPrefUpdate dict_update(prefs, DictionaryPrefUpdate dict_update(prefs,
KioskAppManager::kKioskDictionaryName); KioskAppManager::kKioskDictionaryName);
dict_update->SetInteger(kKeyAutoLoginState, state); dict_update->SetInteger(kKeyAutoLoginState, static_cast<int>(state));
prefs->CommitPendingWrite(); prefs->CommitPendingWrite();
} }
......
...@@ -254,11 +254,11 @@ class KioskAppManager : public KioskAppManagerBase, ...@@ -254,11 +254,11 @@ class KioskAppManager : public KioskAppManagerBase,
friend class KioskTest; friend class KioskTest;
friend class KioskUpdateTest; friend class KioskUpdateTest;
enum AutoLoginState { enum class AutoLoginState {
AUTOLOGIN_NONE = 0, kNone = 0,
AUTOLOGIN_REQUESTED = 1, kRequested = 1,
AUTOLOGIN_APPROVED = 2, kApproved = 2,
AUTOLOGIN_REJECTED = 3, kRejected = 3,
}; };
KioskAppManager(); KioskAppManager();
......
...@@ -2846,7 +2846,7 @@ class KioskAutoLaunchViewsTest : public OobeBaseTest, ...@@ -2846,7 +2846,7 @@ class KioskAutoLaunchViewsTest : public OobeBaseTest,
// The AutoLoginState is taken from KioskAppManager::AutoLoginState. // The AutoLoginState is taken from KioskAppManager::AutoLoginState.
dict_update->SetInteger( dict_update->SetInteger(
KioskAppManager::kKeyAutoLoginState, KioskAppManager::kKeyAutoLoginState,
KioskAppManager::AutoLoginState::AUTOLOGIN_REQUESTED); static_cast<int>(KioskAppManager::AutoLoginState::kRequested));
} }
void TearDownOnMainThread() override { void TearDownOnMainThread() override {
......
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