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

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: Fixed patch set 6 errors. 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 12 matching lines...) Expand all
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 registry->RegisterBooleanPref(prefs::kEnableQuickUnlockFingerprint, false);
33 } 34 }
34 35
35 bool IsPinUnlockEnabled(PrefService* pref_service) { 36 bool IsPinUnlockEnabled(PrefService* pref_service) {
36 if (enable_for_testing_) 37 if (enable_for_testing_)
37 return true; 38 return true;
38 39
39 // Check if policy allows PIN. 40 // Check if policy allows PIN.
40 const base::ListValue* quick_unlock_whitelist = 41 const base::ListValue* quick_unlock_whitelist =
41 pref_service->GetList(prefs::kQuickUnlockModeWhitelist); 42 pref_service->GetList(prefs::kQuickUnlockModeWhitelist);
42 base::StringValue all_value(kQuickUnlockWhitelistOptionAll); 43 base::StringValue all_value(kQuickUnlockWhitelistOptionAll);
43 base::StringValue pin_value(kQuickUnlockWhitelistOptionPin); 44 base::StringValue pin_value(kQuickUnlockWhitelistOptionPin);
44 if (quick_unlock_whitelist->Find(all_value) == 45 if (quick_unlock_whitelist->Find(all_value) ==
45 quick_unlock_whitelist->end() && 46 quick_unlock_whitelist->end() &&
46 quick_unlock_whitelist->Find(pin_value) == 47 quick_unlock_whitelist->Find(pin_value) ==
47 quick_unlock_whitelist->end()) { 48 quick_unlock_whitelist->end()) {
48 return false; 49 return false;
49 } 50 }
50 51
51 // TODO(jdufault): Disable PIN for supervised users until we allow the owner 52 // TODO(jdufault): Disable PIN for supervised users until we allow the owner
52 // to set the PIN. See crbug.com/632797. 53 // to set the PIN. See crbug.com/632797.
53 user_manager::User* user = user_manager::UserManager::Get()->GetActiveUser(); 54 user_manager::User* user = user_manager::UserManager::Get()->GetActiveUser();
54 if (user && user->IsSupervised()) 55 if (user && user->IsSupervised())
55 return false; 56 return false;
56 57
57 // Enable quick unlock only if the switch is present. 58 // Enable quick unlock only if the switch is present.
58 return base::FeatureList::IsEnabled(features::kQuickUnlockPin); 59 return base::FeatureList::IsEnabled(features::kQuickUnlockPin);
59 } 60 }
60 61
62 bool IsFingerprintUnlockEnabled() {
63 // Enable fingerprint unlock only if the switch is present. The fingerprint
64 // settings are under the lock screen so we cannot set it up without
65 // kQuickUnlockPin enabled, so make sure that feature is turned on as well.
66 return base::FeatureList::IsEnabled(features::kQuickUnlockPin) &&
67 base::FeatureList::IsEnabled(features::kQuickUnlockFingerprint);
68 }
69
61 void EnableQuickUnlockForTesting() { 70 void EnableQuickUnlockForTesting() {
62 enable_for_testing_ = true; 71 enable_for_testing_ = true;
63 } 72 }
64 73
65 } // namespace chromeos 74 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698