OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.h" | 5 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.h" |
6 | 6 |
7 #include "base/feature_list.h" | 7 #include "base/feature_list.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 9 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
10 #include "chrome/common/chrome_features.h" | 10 #include "chrome/common/chrome_features.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 } // namespace | 23 } // namespace |
24 | 24 |
25 void RegisterQuickUnlockProfilePrefs(PrefRegistrySimple* registry) { | 25 void RegisterQuickUnlockProfilePrefs(PrefRegistrySimple* registry) { |
26 base::ListValue quick_unlock_whitelist_default; | 26 base::ListValue quick_unlock_whitelist_default; |
27 quick_unlock_whitelist_default.AppendString(kQuickUnlockWhitelistOptionPin); | 27 quick_unlock_whitelist_default.AppendString(kQuickUnlockWhitelistOptionPin); |
28 registry->RegisterListPref(prefs::kQuickUnlockModeWhitelist, | 28 registry->RegisterListPref(prefs::kQuickUnlockModeWhitelist, |
29 quick_unlock_whitelist_default.DeepCopy()); | 29 quick_unlock_whitelist_default.DeepCopy()); |
30 registry->RegisterIntegerPref( | 30 registry->RegisterIntegerPref( |
31 prefs::kQuickUnlockTimeout, | 31 prefs::kQuickUnlockTimeout, |
32 static_cast<int>(QuickUnlockPasswordConfirmationFrequency::DAY)); | 32 static_cast<int>(QuickUnlockPasswordConfirmationFrequency::DAY)); |
| 33 |
| 34 // Preferences related the lock screen pin unlock. |
| 35 registry->RegisterIntegerPref(prefs::kPinUnlockMinimumLength, 4); |
| 36 // 0 indicates no maximum length for the pin. |
| 37 registry->RegisterIntegerPref(prefs::kPinUnlockMaximumLength, 0); |
| 38 registry->RegisterBooleanPref(prefs::kPinUnlockWeakPinsAllowed, true); |
33 } | 39 } |
34 | 40 |
35 bool IsPinUnlockEnabled(PrefService* pref_service) { | 41 bool IsPinUnlockEnabled(PrefService* pref_service) { |
36 if (enable_for_testing_) | 42 if (enable_for_testing_) |
37 return true; | 43 return true; |
38 | 44 |
39 // Check if policy allows PIN. | 45 // Check if policy allows PIN. |
40 const base::ListValue* quick_unlock_whitelist = | 46 const base::ListValue* quick_unlock_whitelist = |
41 pref_service->GetList(prefs::kQuickUnlockModeWhitelist); | 47 pref_service->GetList(prefs::kQuickUnlockModeWhitelist); |
42 base::StringValue all_value(kQuickUnlockWhitelistOptionAll); | 48 base::StringValue all_value(kQuickUnlockWhitelistOptionAll); |
(...skipping 13 matching lines...) Expand all Loading... |
56 | 62 |
57 // Enable quick unlock only if the switch is present. | 63 // Enable quick unlock only if the switch is present. |
58 return base::FeatureList::IsEnabled(features::kQuickUnlockPin); | 64 return base::FeatureList::IsEnabled(features::kQuickUnlockPin); |
59 } | 65 } |
60 | 66 |
61 void EnableQuickUnlockForTesting() { | 67 void EnableQuickUnlockForTesting() { |
62 enable_for_testing_ = true; | 68 enable_for_testing_ = true; |
63 } | 69 } |
64 | 70 |
65 } // namespace chromeos | 71 } // namespace chromeos |
OLD | NEW |