• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3// found in the LICENSE file.
4
5// Control and monitor the screen locker.
6[permissions=screenlockPrivate, nodoc]
7namespace screenlockPrivate {
8  // Supported authentication types shown on the user pod.
9  // |offlinePassword|: 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 {offlinePassword, numericPin, userClick};
18
19  callback BooleanCallback = void(boolean locked);
20
21  interface Functions {
22    // Returns true if the screen is currently locked, false otherwise.
23    static void getLocked(BooleanCallback callback);
24
25    // Set <code>locked=true</code> to lock the screen,
26    // <code>locked=false</code> to unlock it.
27    static void setLocked(boolean locked);
28
29    // Accepts or rejects the current auth attempt.
30    static void acceptAuthAttempt(boolean accept);
31  };
32
33  interface Events {
34    // Fires whenever the screen is locked or unlocked.
35    static void onChanged(boolean locked);
36
37    // Fires when the user attempts to authenticate with the user's input.
38    // There will be at most one auth attempt active at any time.
39    // Call $(ref:acceptAuthAttempt)() to accept or reject this attempt.
40    // Note: Some authentication types will not have an input.
41    static void onAuthAttempted(AuthType type, DOMString input);
42  };
43};
44