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 [permissions=screenlockPrivate, nodoc] | 6 [permissions=screenlockPrivate, nodoc] |
7 namespace screenlockPrivate { | 7 namespace screenlockPrivate { |
8 // Supported authentication types shown on the user pod. | 8 // Supported authentication types shown on the user pod. |
9 // |offlinePassword|: The standard password field, which authenticates using | 9 // |offlinePassword|: The standard password field, which authenticates using |
10 // the user's regular password. The $(ref:onAuthAttempted)() | 10 // the user's regular password. The $(ref:onAuthAttempted)() |
11 // event will not be fired for this authentication type. | 11 // event will not be fired for this authentication type. |
12 // |numericPin|: An input field for a 4 digit numeric pin code. | 12 // |numericPin|: An input field for a 4 digit numeric pin code. |
13 // |userClick|: Makes the user pod clickable when it is focused, and | 13 // |userClick|: Makes the user pod clickable when it is focused, and |
14 // clicking on it attempts the authentication. If |value| is | 14 // clicking on it attempts the authentication. If |value| is |
15 // specified with $(ref:setAuthType)(), the text is displayed | 15 // specified with $(ref:setAuthType)(), the text is displayed |
16 // in the password field. | 16 // in the password field. |
17 enum AuthType {offlinePassword, numericPin, userClick}; | 17 enum AuthType {offlinePassword, numericPin, userClick}; |
18 | 18 |
19 // Extension resource for a icon representation for a scale factor. | |
20 dictionary IconRepresentation { | |
21 // The scale factor the representation is for. | |
22 double scaleFactor; | |
23 // The image resource URL. | |
24 DOMString url; | |
25 }; | |
26 | |
27 callback BooleanCallback = void(boolean locked); | 19 callback BooleanCallback = void(boolean locked); |
28 callback AuthTypeCallback = void(AuthType authType); | |
29 | 20 |
30 interface Functions { | 21 interface Functions { |
31 // Returns true if the screen is currently locked, false otherwise. | 22 // Returns true if the screen is currently locked, false otherwise. |
32 static void getLocked(BooleanCallback callback); | 23 static void getLocked(BooleanCallback callback); |
33 | 24 |
34 // Set <code>locked=true</code> to lock the screen, | 25 // Set <code>locked=true</code> to lock the screen, |
35 // <code>locked=false</code> to unlock it. | 26 // <code>locked=false</code> to unlock it. |
36 static void setLocked(boolean locked); | 27 static void setLocked(boolean locked); |
37 | 28 |
38 // Show a message to the user on the unlock UI if the screen is locked. | |
39 static void showMessage(DOMString message); | |
40 | |
41 // Show a custom icon beside the input field on the user pod. | |
42 // |icon|: Extension resoucres for the icon's multi-scale representations. | |
43 // Currently, only scales 1 and 2 are supported. The list must have a | |
44 // resource for at least scale 1. | |
45 static void showCustomIcon(IconRepresentation[] icon); | |
46 | |
47 // Hides the custom icon added by $(ref:showCustomIcon)(). | |
48 static void hideCustomIcon(); | |
49 | |
50 // Returns the current auth type used for the user pod. | |
51 static void getAuthType(AuthTypeCallback callback); | |
52 | |
53 // Set the type of the authentication for the user pod. The input field | |
54 // area of the user pod below the user's portrait will be changed. | |
55 // |authType|: The type of authentication to use. | |
56 // |initialValue|: The initial value to populate the input field. | |
57 static void setAuthType(AuthType authType, optional DOMString initialValue); | |
58 | |
59 // Accepts or rejects the current auth attempt. | 29 // Accepts or rejects the current auth attempt. |
60 static void acceptAuthAttempt(boolean accept); | 30 static void acceptAuthAttempt(boolean accept); |
61 }; | 31 }; |
62 | 32 |
63 interface Events { | 33 interface Events { |
64 // Fires whenever the screen is locked or unlocked. | 34 // Fires whenever the screen is locked or unlocked. |
65 static void onChanged(boolean locked); | 35 static void onChanged(boolean locked); |
66 | 36 |
67 // Fires when the user attempts to authenticate with the user's input. | 37 // Fires when the user attempts to authenticate with the user's input. |
68 // There will be at most one auth attempt active at any time. | 38 // There will be at most one auth attempt active at any time. |
69 // Call $(ref:acceptAuthAttempt)() to accept or reject this attempt. | 39 // Call $(ref:acceptAuthAttempt)() to accept or reject this attempt. |
70 // Note: Some authentication types will not have an input. | 40 // Note: Some authentication types will not have an input. |
71 static void onAuthAttempted(AuthType type, DOMString input); | 41 static void onAuthAttempted(AuthType type, DOMString input); |
72 }; | 42 }; |
73 }; | 43 }; |
OLD | NEW |