Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.cc

Issue 2538303002: md-settings: Added settings for fingerprint unlock. (Closed)
Patch Set: Nit. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 18 matching lines...) Expand all
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 33
34 // Preferences related the lock screen pin unlock. 34 // Preferences related the lock screen pin unlock.
35 registry->RegisterIntegerPref(prefs::kPinUnlockMinimumLength, 4); 35 registry->RegisterIntegerPref(prefs::kPinUnlockMinimumLength, 4);
36 // 0 indicates no maximum length for the pin. 36 // 0 indicates no maximum length for the pin.
37 registry->RegisterIntegerPref(prefs::kPinUnlockMaximumLength, 0); 37 registry->RegisterIntegerPref(prefs::kPinUnlockMaximumLength, 0);
38 registry->RegisterBooleanPref(prefs::kPinUnlockWeakPinsAllowed, true); 38 registry->RegisterBooleanPref(prefs::kPinUnlockWeakPinsAllowed, true);
39
40 registry->RegisterBooleanPref(prefs::kEnableQuickUnlockFingerprint, false);
39 } 41 }
40 42
41 bool IsPinUnlockEnabled(PrefService* pref_service) { 43 bool IsPinUnlockEnabled(PrefService* pref_service) {
42 if (enable_for_testing_) 44 if (enable_for_testing_)
43 return true; 45 return true;
44 46
45 // Check if policy allows PIN. 47 // Check if policy allows PIN.
46 const base::ListValue* quick_unlock_whitelist = 48 const base::ListValue* quick_unlock_whitelist =
47 pref_service->GetList(prefs::kQuickUnlockModeWhitelist); 49 pref_service->GetList(prefs::kQuickUnlockModeWhitelist);
48 base::StringValue all_value(kQuickUnlockWhitelistOptionAll); 50 base::StringValue all_value(kQuickUnlockWhitelistOptionAll);
49 base::StringValue pin_value(kQuickUnlockWhitelistOptionPin); 51 base::StringValue pin_value(kQuickUnlockWhitelistOptionPin);
50 if (quick_unlock_whitelist->Find(all_value) == 52 if (quick_unlock_whitelist->Find(all_value) ==
51 quick_unlock_whitelist->end() && 53 quick_unlock_whitelist->end() &&
52 quick_unlock_whitelist->Find(pin_value) == 54 quick_unlock_whitelist->Find(pin_value) ==
53 quick_unlock_whitelist->end()) { 55 quick_unlock_whitelist->end()) {
54 return false; 56 return false;
55 } 57 }
56 58
57 // TODO(jdufault): Disable PIN for supervised users until we allow the owner 59 // TODO(jdufault): Disable PIN for supervised users until we allow the owner
58 // to set the PIN. See crbug.com/632797. 60 // to set the PIN. See crbug.com/632797.
59 user_manager::User* user = user_manager::UserManager::Get()->GetActiveUser(); 61 user_manager::User* user = user_manager::UserManager::Get()->GetActiveUser();
60 if (user && user->IsSupervised()) 62 if (user && user->IsSupervised())
61 return false; 63 return false;
62 64
63 // Enable quick unlock only if the switch is present. 65 // Enable quick unlock only if the switch is present.
64 return base::FeatureList::IsEnabled(features::kQuickUnlockPin); 66 return base::FeatureList::IsEnabled(features::kQuickUnlockPin);
65 } 67 }
66 68
69 bool IsFingerprintUnlockEnabled() {
70 // Enable fingerprint unlock only if the switch is present. The fingerprint
71 // settings are under the lock screen so we cannot set it up without
72 // kQuickUnlockPin enabled, so make sure that feature is turned on as well.
73 return base::FeatureList::IsEnabled(features::kQuickUnlockPin) &&
Dan Beam 2016/12/13 19:53:23 can we rename the Pin version to just kQuickUnlock
sammiequon 2016/12/13 23:33:33 Should I add a TODO and bug or do you prefer to do
jdufault 2016/12/14 17:58:57 That seems confusing; in the context of kQuickUnlo
Dan Beam 2016/12/14 22:25:17 it's not too long, it's confusing that the PIN ver
jdufault 2016/12/14 23:32:56 Yes, I agree. I think renaming only the flag/pref
sammiequon 2017/01/10 22:33:27 I removed the dependence on kQuickUnlockPin.
74 base::FeatureList::IsEnabled(features::kQuickUnlockFingerprint);
75 }
76
67 void EnableQuickUnlockForTesting() { 77 void EnableQuickUnlockForTesting() {
68 enable_for_testing_ = true; 78 enable_for_testing_ = true;
69 } 79 }
70 80
71 } // namespace chromeos 81 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698