Chromium Code Reviews| Index: chrome/browser/chromeos/login/quick_unlock/pin_storage.cc |
| diff --git a/chrome/browser/chromeos/login/quick_unlock/pin_storage.cc b/chrome/browser/chromeos/login/quick_unlock/pin_storage.cc |
| index 2030a63edbcbf1ca73329f6851edba77cc3d8882..a8b3b77df8849d16cd49e93a13db58b8cec09f13 100644 |
| --- a/chrome/browser/chromeos/login/quick_unlock/pin_storage.cc |
| +++ b/chrome/browser/chromeos/login/quick_unlock/pin_storage.cc |
| @@ -6,6 +6,8 @@ |
| #include "base/base64.h" |
| #include "base/strings/string_util.h" |
| +#include "chrome/browser/browser_process.h" |
| +#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| #include "chrome/common/pref_names.h" |
| #include "chromeos/login/auth/key.h" |
| #include "components/pref_registry/pref_registry_syncable.h" |
| @@ -16,6 +18,14 @@ namespace chromeos { |
| namespace { |
| +bool IsDisabledByPolicy() { |
|
achuithb
2016/07/22 01:14:59
Maybe move this to after ComputeSecret? I think kS
jdufault
2016/07/22 19:15:50
Done, moved into another file.
|
| + // TODO(jdufault): Implement a proper policy check. For now, just disable if |
|
achuithb
2016/07/22 01:14:59
file a bug?
jdufault
2016/07/22 19:15:50
Done.
|
| + // the device is enterprise enrolled. |
| + return g_browser_process->platform_part() |
| + ->browser_policy_connector_chromeos() |
| + ->IsEnterpriseManaged(); |
| +} |
| + |
| const int kSaltByteSize = 16; |
| // Returns a new salt of length |kSaltByteSize|. |
| @@ -104,8 +114,9 @@ std::string PinStorage::PinSecret() const { |
| } |
| bool PinStorage::IsPinAuthenticationAvailable() const { |
| - return IsPinSet() && unlock_attempt_count() < kMaximumUnlockAttempts && |
| - HasStrongAuth() && TimeSinceLastStrongAuth() < kStrongAuthTimeout; |
| + return !IsDisabledByPolicy() && IsPinSet() && |
|
achuithb
2016/07/22 01:14:59
I think booleans like
const bool exceeded_unlock_a
jdufault
2016/07/22 19:15:50
Done.
|
| + unlock_attempt_count() < kMaximumUnlockAttempts && HasStrongAuth() && |
| + TimeSinceLastStrongAuth() < kStrongAuthTimeout; |
| } |
| bool PinStorage::TryAuthenticatePin(const std::string& pin) { |