OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // Control and monitor the screen locker. | 5 // Control and monitor the screen locker. |
6 [platforms=("chromeos"), implemented_in="chrome/browser/chromeos/extensions/scre enlock_private_api.h", permissions=screenlockPrivate] | 6 [platforms=("chromeos"), implemented_in="chrome/browser/chromeos/extensions/scre enlock_private_api.h", permissions=screenlockPrivate] |
7 namespace screenlockPrivate { | 7 namespace screenlockPrivate { |
8 // Supported authentication types shown on the user pod. | |
9 // |systemPassword|: The standard password field, which authenticates using | |
10 // the user's regular password. The $ref:onAuthAttempted() | |
11 // event will not be fired for this authentication type. | |
12 // |numericPin|: An input field for a 4 digit numeric pin code. | |
13 // |userClick|: Makes the user pod clickable when it is focused, and | |
14 // clicking on it attempts the authentication. If |value| is | |
15 // specified with $ref:setAuthType(), the text is displayed | |
16 // in the password field. | |
17 enum AuthType {systemPassword, numericPin, userClick}; | |
xiyuan
2014/02/20 17:44:44
nit: systemPassword -> offlinePassword to be consi
Tim Song
2014/02/20 21:06:08
Done.
| |
18 | |
8 callback BooleanCallback = void(boolean locked); | 19 callback BooleanCallback = void(boolean locked); |
20 callback AuthTypeCallback = void(AuthType authType); | |
9 | 21 |
10 interface Functions { | 22 interface Functions { |
11 // Returns true if the screen is currently locked, false otherwise. | 23 // Returns true if the screen is currently locked, false otherwise. |
12 static void getLocked(BooleanCallback callback); | 24 static void getLocked(BooleanCallback callback); |
13 | 25 |
14 // Set <code>locked=true</code> to lock the screen, | 26 // Set <code>locked=true</code> to lock the screen, |
15 // <code>locked=false</code> to unlock it. | 27 // <code>locked=false</code> to unlock it. |
16 static void setLocked(boolean locked); | 28 static void setLocked(boolean locked); |
17 | 29 |
18 // Show a message to the user on the unlock UI if the screen is locked. | 30 // Show a message to the user on the unlock UI if the screen is locked. |
19 static void showMessage(DOMString message); | 31 static void showMessage(DOMString message); |
20 | 32 |
21 // Show a button icon on the unlock UI if the screen is locked. | 33 // Show a Button, an icon beside the input field on the user pod. |
34 // |icon|: An extension resource of the icon image. | |
22 static void showButton(DOMString icon); | 35 static void showButton(DOMString icon); |
36 | |
37 // Hides the button added by $ref:showButton(). | |
38 static void hideButton(); | |
39 | |
40 // Returns the current auth type used for the user pod. | |
41 static void getAuthType(AuthTypeCallback callback); | |
42 | |
43 // Set the type of the authentication for the user pod. The input field | |
44 // area of the user pod below the user's portrait will be changed. | |
45 // |authType|: The type of authentication to use. | |
46 // |initialValue|: The initial value to populate the input field. | |
47 static void setAuthType(AuthType authType, optional DOMString initialValue); | |
48 | |
49 // Accepts or rejects the current auth attempt. | |
50 static void acceptAuthAttempt(boolean accept); | |
not at google - send to devlin
2014/02/20 01:16:20
it would be a nicer API if this were a method on t
Tim Song
2014/02/20 01:37:46
That would be nice. Can you point me to another AP
| |
23 }; | 51 }; |
24 | 52 |
25 interface Events { | 53 interface Events { |
26 // Fires whenever the screen is locked or unlocked. | 54 // Fires whenever the screen is locked or unlocked. |
27 static void onChanged(boolean locked); | 55 static void onChanged(boolean locked); |
28 | 56 |
29 // Fires when the user presses the button on the unlock UI shown by | 57 // Fires when the user clicks on the Button shown by $ref:showButton(). |
30 // $ref:showButton(). | |
31 static void onButtonClicked(); | 58 static void onButtonClicked(); |
59 | |
60 // Fires when the user attempts to authenticate with the user's input. | |
61 // There will be at most one auth attempt active at any time. | |
62 // Call $ref:acceptAuthAttempt() to accept or reject this attempt. | |
63 // Note: Some authentication types will not have an input. | |
64 static void onAuthAttempted(AuthType type, DOMString input); | |
32 }; | 65 }; |
33 }; | 66 }; |
OLD | NEW |