diff options
author | brg@chromium.com <brg@chromium.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-16 00:19:34 +0000 |
---|---|---|
committer | brg@chromium.com <brg@chromium.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-16 00:19:34 +0000 |
commit | f5205419c04244f460891b8ff8e30d3793ffa507 (patch) | |
tree | 4becb4662d36d92050001eb65e624cffeec95c10 /chrome/browser/idle_mac.cc | |
parent | 5c7c98d536de7fb818b7f23ae52a92383072aa0d (diff) | |
download | chromium_src-f5205419c04244f460891b8ff8e30d3793ffa507.zip chromium_src-f5205419c04244f460891b8ff8e30d3793ffa507.tar.gz chromium_src-f5205419c04244f460891b8ff8e30d3793ffa507.tar.bz2 |
Idle API for the extension system
Tests=ExtensionApiTest.Idle
Bug=one
Review URL: http://codereview.chromium.org/845005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41661 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/idle_mac.cc')
-rw-r--r-- | chrome/browser/idle_mac.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/chrome/browser/idle_mac.cc b/chrome/browser/idle_mac.cc new file mode 100644 index 0000000..383e4c7 --- /dev/null +++ b/chrome/browser/idle_mac.cc @@ -0,0 +1,16 @@ +// Copyright (c) 2009 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 "chrome/browser/idle.h" + +#include <CoreGraphics/CGEventSource.h> + +IdleState CalculateIdleState(unsigned int idle_threshold) { + unsigned int idle_time = CGEventSourceSecondsSinceLastEventType( + kCGEventSourceStateCombinedSessionState, + kCGAnyInputEventType); + if (idle_time >= idle_threshold) + return IDLE_STATE_IDLE; + return IDLE_STATE_ACTIVE; +} |