Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 // Use the <code>chrome.quickUnlockPrivate</code> API to change the active quick | 5 // Use the <code>chrome.quickUnlockPrivate</code> API to change the active quick |
| 6 // unlock modes and to change their respective credentials. | 6 // unlock modes and to change their respective credentials. |
| 7 // | 7 // |
| 8 // Quick unlock only supports unlocking an account that has already been signed | 8 // Quick unlock only supports unlocking an account that has already been signed |
| 9 // in. | 9 // in. |
| 10 // | 10 // |
| 11 // The quick unlock authentication facilities are not available through this | 11 // The quick unlock authentication facilities are not available through this |
| 12 // API; they are built directly into the lock screen. | 12 // API; they are built directly into the lock screen. |
| 13 | 13 |
| 14 [platforms=("chromeos"), | 14 [platforms=("chromeos"), |
| 15 implemented_in="chrome/browser/chromeos/extensions/quick_unlock_private/quick_u nlock_private_api.h"] | 15 implemented_in="chrome/browser/chromeos/extensions/quick_unlock_private/quick_u nlock_private_api.h"] |
| 16 namespace quickUnlockPrivate { | 16 namespace quickUnlockPrivate { |
| 17 // TODO(jdufault): Add more quick unlock modes, such as a pattern unlock. | 17 // TODO(jdufault): Add more quick unlock modes, such as a pattern unlock. |
| 18 enum QuickUnlockMode { | 18 enum QuickUnlockMode { |
| 19 PIN | 19 PIN |
| 20 }; | 20 }; |
| 21 | 21 |
| 22 // The problems a given PIN might have. | |
| 23 enum CredentialProblem { | |
| 24 TOO_SHORT, | |
| 25 TOO_LONG, | |
| 26 TOO_WEAK, | |
| 27 CONTAINS_NONDIGIT | |
| 28 }; | |
| 29 | |
| 30 dictionary CredentialCheck { | |
| 31 // The given PINs errors. Users cannot proceed with an error. | |
| 32 CredentialProblem[] errors; | |
| 33 // THe given PINs warnings. Users can, but are not advised to proceed with | |
| 34 // a warning. | |
| 35 CredentialProblem[] warnings; | |
| 36 }; | |
| 37 | |
| 38 dictionary CredentialRequirements { | |
| 39 // The minimum allowed length for a PIN. | |
| 40 long minLength; | |
| 41 // The maximum allowed length for a PIN. A value of 0 indicates no maximum | |
| 42 // length. | |
| 43 long maxLength; | |
| 44 }; | |
| 45 | |
| 22 callback BooleanResultCallback = void (boolean value); | 46 callback BooleanResultCallback = void (boolean value); |
| 23 callback ModesCallback = void (QuickUnlockMode[] modes); | 47 callback ModesCallback = void (QuickUnlockMode[] modes); |
| 48 callback CredentialCheckCallback = void (CredentialCheck check); | |
| 49 callback CredentialRequirementsCallback = | |
| 50 void (CredentialRequirements requirements); | |
|
stevenjb
2016/12/01 17:32:13
indent 4 spaces from start of previous line
sammiequon
2016/12/01 18:31:30
Done.
| |
| 24 | 51 |
| 25 interface Functions { | 52 interface Functions { |
| 26 // Returns the set of quick unlock modes that are available for the user to | 53 // Returns the set of quick unlock modes that are available for the user to |
| 27 // use. Some quick unlock modes may be disabled by policy. | 54 // use. Some quick unlock modes may be disabled by policy. |
| 28 static void getAvailableModes(ModesCallback onComplete); | 55 static void getAvailableModes(ModesCallback onComplete); |
| 29 | 56 |
| 30 // Returns the quick unlock modes that are currently enabled and usable on | 57 // Returns the quick unlock modes that are currently enabled and usable on |
| 31 // the lock screen. | 58 // the lock screen. |
| 32 static void getActiveModes(ModesCallback onComplete); | 59 static void getActiveModes(ModesCallback onComplete); |
| 33 | 60 |
| 61 // Checks if the given credential can be used for the given unlock mode. | |
| 62 // Enterprise policy can change credential requirements. | |
| 63 // |mode|: The quick unlock mode that is used. | |
| 64 // |credential|: The given credential. | |
| 65 // |onComplete|: Called with a list of warnings and errors the given | |
| 66 // |credential| has (if any). | |
|
stevenjb
2016/12/01 17:32:13
Indent comment 4 spaces (this looks like |credenti
sammiequon
2016/12/01 18:31:30
Done.
| |
| 67 static void checkCredential(QuickUnlockMode mode, | |
| 68 DOMString credential, | |
| 69 CredentialCheckCallback onComplete); | |
| 70 | |
| 71 // Gets the credential requirements for the given unlock mode. | |
| 72 // |mode|: The quick unlock mode that is used. | |
| 73 // |onComplete|: Called with the credential requirements of the given |mode| . | |
|
stevenjb
2016/12/01 17:32:13
Line too long
sammiequon
2016/12/01 18:31:30
Done.
| |
| 74 static void getCredentialRequirements( | |
| 75 QuickUnlockMode mode, CredentialRequirementsCallback onComplete); | |
|
stevenjb
2016/12/01 17:32:13
indent
sammiequon
2016/12/01 18:31:30
Done.
| |
| 76 | |
| 34 // Update the set of quick unlock modes that are currently active/enabled. | 77 // Update the set of quick unlock modes that are currently active/enabled. |
| 35 // |accountPassword|: The password associated with the account (e.g. the | 78 // |accountPassword|: The password associated with the account (e.g. the |
| 36 // GAIA password). This is required to change the quick unlock credentials. | 79 // GAIA password). This is required to change the quick unlock credentials. |
| 37 // |modes|: The quick unlock modes that should be active. | 80 // |modes|: The quick unlock modes that should be active. |
| 38 // |credentials|: The associated credential for each mode. To keep | 81 // |credentials|: The associated credential for each mode. To keep |
| 39 // the credential the same for the associated mode, pass an empty string. | 82 // the credential the same for the associated mode, pass an empty string. |
| 40 // |onComplete|: Called with true if the quick unlock state was updated, | 83 // |onComplete|: Called with true if the quick unlock state was updated, |
| 41 // false otherwise. The update is treated as a single atomic operation. | 84 // false otherwise. The update is treated as a single atomic operation. |
| 42 static void setModes(DOMString accountPassword, | 85 static void setModes(DOMString accountPassword, |
| 43 QuickUnlockMode[] modes, DOMString[] credentials, | 86 QuickUnlockMode[] modes, DOMString[] credentials, |
| 44 BooleanResultCallback onComplete); | 87 BooleanResultCallback onComplete); |
| 45 }; | 88 }; |
| 46 | 89 |
| 47 interface Events { | 90 interface Events { |
| 48 // Called after the active set of quick unlock modes has changed. | 91 // Called after the active set of quick unlock modes has changed. |
| 49 // |activeModes|: The set of quick unlock modes which are now active. | 92 // |activeModes|: The set of quick unlock modes which are now active. |
| 50 static void onActiveModesChanged(QuickUnlockMode[] activeModes); | 93 static void onActiveModesChanged(QuickUnlockMode[] activeModes); |
| 51 }; | 94 }; |
| 52 }; | 95 }; |
| OLD | NEW |