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

Unified Diff: chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.cc

Issue 2815733003: cros: Add PinStorageProvider enum which describes pin backend in use. (Closed)
Patch Set: Address comments Created 3 years, 7 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f3a306c6ccf5ab25c2c5ebe2a7bede9a4e88da90..6f0c5bf0f5364fb0a665f9907a83046cee2b5b01 100644
--- a/chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.cc
+++ b/chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.cc
@@ -18,7 +18,12 @@ namespace chromeos {
namespace quick_unlock {
namespace {
+// Quick unlock is enabled regardless of flags.
bool enable_for_testing_ = false;
+// If testing is enabled, PIN will use prefs as backend. Otherwise, it will use
+// cryptohome.
+PinStorageType testing_pin_storage_type_ = PinStorageType::kPrefs;
+
// Options for the quick unlock whitelist.
const char kQuickUnlockWhitelistOptionAll[] = "all";
const char kQuickUnlockWhitelistOptionPin[] = "PIN";
@@ -87,6 +92,15 @@ bool IsPinEnabled(PrefService* pref_service) {
return base::FeatureList::IsEnabled(features::kQuickUnlockPin);
}
+PinStorageType GetPinStorageType() {
+ if (enable_for_testing_)
+ return testing_pin_storage_type_;
+
+ if (base::FeatureList::IsEnabled(features::kQuickUnlockPinSignin))
+ return PinStorageType::kCryptohome;
+ return PinStorageType::kPrefs;
+}
+
bool IsFingerprintEnabled() {
if (enable_for_testing_)
return true;
@@ -95,8 +109,9 @@ bool IsFingerprintEnabled() {
return base::FeatureList::IsEnabled(features::kQuickUnlockFingerprint);
}
-void EnableForTesting() {
+void EnableForTesting(PinStorageType pin_storage_type) {
enable_for_testing_ = true;
+ testing_pin_storage_type_ = pin_storage_type;
}
} // namespace quick_unlock
« no previous file with comments | « chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698