OLD | NEW |
| (Empty) |
1 // Copyright (c) 2009 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 #include "chrome/browser/idle.h" | |
6 | |
7 #include <CoreGraphics/CGEventSource.h> | |
8 | |
9 IdleState CalculateIdleState(unsigned int idle_threshold) { | |
10 unsigned int idle_time = CGEventSourceSecondsSinceLastEventType( | |
11 kCGEventSourceStateCombinedSessionState, | |
12 kCGAnyInputEventType); | |
13 if (idle_time >= idle_threshold) | |
14 return IDLE_STATE_IDLE; | |
15 return IDLE_STATE_ACTIVE; | |
16 } | |
OLD | NEW |