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 "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 10 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 registry->RegisterBooleanPref(prefs::kEnableQuickUnlockFingerprint, false); | 61 registry->RegisterBooleanPref(prefs::kEnableQuickUnlockFingerprint, false); |
62 } | 62 } |
63 | 63 |
64 bool IsPinEnabled(PrefService* pref_service) { | 64 bool IsPinEnabled(PrefService* pref_service) { |
65 if (enable_for_testing_) | 65 if (enable_for_testing_) |
66 return true; | 66 return true; |
67 | 67 |
68 // Check if policy allows PIN. | 68 // Check if policy allows PIN. |
69 const base::ListValue* quick_unlock_whitelist = | 69 const base::ListValue* quick_unlock_whitelist = |
70 pref_service->GetList(prefs::kQuickUnlockModeWhitelist); | 70 pref_service->GetList(prefs::kQuickUnlockModeWhitelist); |
71 base::StringValue all_value(kQuickUnlockWhitelistOptionAll); | 71 base::Value all_value(kQuickUnlockWhitelistOptionAll); |
72 base::StringValue pin_value(kQuickUnlockWhitelistOptionPin); | 72 base::Value pin_value(kQuickUnlockWhitelistOptionPin); |
73 if (quick_unlock_whitelist->Find(all_value) == | 73 if (quick_unlock_whitelist->Find(all_value) == |
74 quick_unlock_whitelist->end() && | 74 quick_unlock_whitelist->end() && |
75 quick_unlock_whitelist->Find(pin_value) == | 75 quick_unlock_whitelist->Find(pin_value) == |
76 quick_unlock_whitelist->end()) { | 76 quick_unlock_whitelist->end()) { |
77 return false; | 77 return false; |
78 } | 78 } |
79 | 79 |
80 // TODO(jdufault): Disable PIN for supervised users until we allow the owner | 80 // TODO(jdufault): Disable PIN for supervised users until we allow the owner |
81 // to set the PIN. See crbug.com/632797. | 81 // to set the PIN. See crbug.com/632797. |
82 user_manager::User* user = user_manager::UserManager::Get()->GetActiveUser(); | 82 user_manager::User* user = user_manager::UserManager::Get()->GetActiveUser(); |
(...skipping 11 matching lines...) Expand all Loading... |
94 // Enable fingerprint unlock only if the switch is present. | 94 // Enable fingerprint unlock only if the switch is present. |
95 return base::FeatureList::IsEnabled(features::kQuickUnlockFingerprint); | 95 return base::FeatureList::IsEnabled(features::kQuickUnlockFingerprint); |
96 } | 96 } |
97 | 97 |
98 void EnableForTesting() { | 98 void EnableForTesting() { |
99 enable_for_testing_ = true; | 99 enable_for_testing_ = true; |
100 } | 100 } |
101 | 101 |
102 } // namespace quick_unlock | 102 } // namespace quick_unlock |
103 } // namespace chromeos | 103 } // namespace chromeos |
OLD | NEW |