Chromium Code Reviews| Index: chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.cc |
| diff --git a/chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.cc b/chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.cc |
| index afd4e68382a125618bf15689f464cbf84223e2c3..e38fd2a5d8e2acfb8b7499b87c16f19f283a2231 100644 |
| --- a/chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.cc |
| +++ b/chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.cc |
| @@ -8,23 +8,39 @@ |
| #include "chrome/browser/browser_process.h" |
| #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| #include "chrome/common/chrome_features.h" |
| +#include "chrome/common/pref_names.h" |
| +#include "components/prefs/pref_registry_simple.h" |
| +#include "components/prefs/pref_service.h" |
| #include "components/user_manager/user_manager.h" |
| namespace chromeos { |
| +namespace quick_unlock { |
| namespace { |
| bool enable_for_testing_ = false; |
| } // namespace |
| -bool IsQuickUnlockEnabled() { |
| +void RegisterProfilePrefs(PrefRegistrySimple* registry) { |
| + base::ListValue quick_unlock_whitelist_default; |
| + quick_unlock_whitelist_default.AppendString("PIN"); |
| + registry->RegisterListPref(prefs::kQuickUnlockModeWhitelist, |
| + quick_unlock_whitelist_default.DeepCopy()); |
| + registry->RegisterIntegerPref( |
| + prefs::kQuickUnlockTimeout, |
| + static_cast<int>(PasswordConfirmationFrequency::DAY)); |
| +} |
| + |
| +bool IsPinUnlockEnabled(PrefService* pref_service) { |
| if (enable_for_testing_) |
| return true; |
| - // TODO(jdufault): Implement a proper policy check. For now, just disable if |
| - // the device is enterprise enrolled. See crbug.com/612271. |
| - if (g_browser_process->platform_part() |
| - ->browser_policy_connector_chromeos() |
| - ->IsEnterpriseManaged()) { |
| + // Check if policy allows PIN. |
| + const base::ListValue* screen_lock_whitelist = |
|
jdufault
2016/10/31 22:22:02
PIN is still enabled for non-enterprise enrolled u
sammiequon
2016/11/01 04:33:18
You mean as a default, yeah it is.
|
| + pref_service->GetList(prefs::kQuickUnlockModeWhitelist); |
| + base::StringValue all_value("all"); |
| + base::StringValue pin_value("PIN"); |
| + if (screen_lock_whitelist->Find(all_value) == screen_lock_whitelist->end() && |
| + screen_lock_whitelist->Find(pin_value) == screen_lock_whitelist->end()) { |
| return false; |
| } |
| @@ -42,4 +58,5 @@ void EnableQuickUnlockForTesting() { |
| enable_for_testing_ = true; |
| } |
| +} // namespace quick_unlock |
| } // namespace chromeos |