summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/public/mojom/idle/idle_manager.mojom
blob: 09118ab006ecf920c5dfcb99d6543084df34682d (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
// Copyright 2018 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.

module blink.mojom;

import "mojo/public/mojom/base/time.mojom";

// Implementation of the proposed "Idle Detection API".
//
// Proposal: https://github.com/inexorabletash/idle-detection

enum UserIdleState {
  kActive,
  kIdle
};

enum ScreenIdleState {
  kLocked,
  kUnlocked
};

struct IdleState {
  UserIdleState user;
  ScreenIdleState screen;
};

interface IdleMonitor {
  Update(IdleState state);
};

interface IdleManager {
  // Register an IdleMonitor instance. When registered, it will return the
  // initial state. It will be notified by calls to Update() per the threshold
  // registered for this instance. It can be unregistered by simply closing
  // the pipe.
  AddMonitor(mojo_base.mojom.TimeDelta threshold, IdleMonitor monitor)
      => (IdleState state);
};