summaryrefslogtreecommitdiff
path: root/chromium/ui/base/idle/idle_linux.cc
blob: 31c89bebb922e5d10aa13e008be00433802030ff (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
// Copyright (c) 2012 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.

#include "ui/base/idle/idle.h"


#if defined(USE_X11) && defined(USE_XSCRNSAVER)
#include "ui/base/idle/idle_query_x11.h"
#include "ui/base/idle/screensaver_window_finder_x11.h"
#endif

namespace ui {

void CalculateIdleTime(IdleTimeCallback notify) {
#if defined(USE_X11) && defined(USE_XSCRNSAVER)
  IdleQueryX11 idle_query;
  notify.Run(idle_query.IdleTime());
#endif
}

bool CheckIdleStateIsLocked() {
#if defined(USE_X11) && defined(USE_XSCRNSAVER)
  // Usually the screensaver is used to lock the screen.
  return ScreensaverWindowFinder::ScreensaverWindowExists();
#else
  return false;
#endif
}

}  // namespace ui