summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/api/screenlock_private.idl
blob: 9af2160f813c4098b37c8fb38854ceeec3537cd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Control and monitor the screen locker.
[permissions=screenlockPrivate, nodoc]
namespace screenlockPrivate {
  // Supported authentication types shown on the user pod.
  // |offlinePassword|: The standard password field, which authenticates using
  //                   the user's regular password. The $(ref:onAuthAttempted)()
  //                   event will not be fired for this authentication type.
  // |numericPin|: An input field for a 4 digit numeric pin code.
  // |userClick|: Makes the user pod clickable when it is focused, and
  //                 clicking on it attempts the authentication. If |value| is
  //                 specified with $(ref:setAuthType)(), the text is displayed
  //                 in the password field.
  enum AuthType {offlinePassword, numericPin, userClick};

  callback BooleanCallback = void(boolean locked);

  interface Functions {
    // Returns true if the screen is currently locked, false otherwise.
    static void getLocked(BooleanCallback callback);

    // Set <code>locked=true</code> to lock the screen,
    // <code>locked=false</code> to unlock it.
    static void setLocked(boolean locked);

    // Accepts or rejects the current auth attempt.
    static void acceptAuthAttempt(boolean accept);
  };

  interface Events {
    // Fires whenever the screen is locked or unlocked.
    static void onChanged(boolean locked);

    // Fires when the user attempts to authenticate with the user's input.
    // There will be at most one auth attempt active at any time.
    // Call $(ref:acceptAuthAttempt)() to accept or reject this attempt.
    // Note: Some authentication types will not have an input.
    static void onAuthAttempted(AuthType type, DOMString input);
  };
};