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

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: Initial upload Created 3 years, 8 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
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..3109378a50b17463c05f91819a56a8886b31914d 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.
+PinStorageProvider testing_pin_storage_provider_ = PinStorageProvider::Prefs;
+
// 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);
}
+PinStorageProvider GetPinStorageProvider() {
+ if (enable_for_testing_)
+ return testing_pin_storage_provider_;
+
+ if (base::FeatureList::IsEnabled(features::kQuickUnlockPinSignin))
+ return PinStorageProvider::Cryptohome;
+ return PinStorageProvider::Prefs;
+}
+
bool IsFingerprintEnabled() {
if (enable_for_testing_)
return true;
@@ -95,8 +109,9 @@ bool IsFingerprintEnabled() {
return base::FeatureList::IsEnabled(features::kQuickUnlockFingerprint);
}
-void EnableForTesting() {
+void EnableForTesting(PinStorageProvider pin_storage_provider) {
enable_for_testing_ = true;
+ testing_pin_storage_provider_ = pin_storage_provider;
}
} // namespace quick_unlock

Powered by Google App Engine
This is Rietveld 408576698