OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_IDLE_H_ | 5 #ifndef CHROME_BROWSER_IDLE_H_ |
6 #define CHROME_BROWSER_IDLE_H_ | 6 #define CHROME_BROWSER_IDLE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 | 10 |
11 enum IdleState { | 11 enum IdleState { |
12 IDLE_STATE_ACTIVE = 0, | 12 IDLE_STATE_ACTIVE = 0, |
13 IDLE_STATE_IDLE = 1, // No activity within threshold. | 13 IDLE_STATE_IDLE = 1, // No activity within threshold. |
14 IDLE_STATE_LOCKED = 2, // Only available on supported systems. | 14 IDLE_STATE_LOCKED = 2, // Only available on supported systems. |
15 IDLE_STATE_UNKNOWN = 3 // Used when waiting for the Idle state or in error | 15 IDLE_STATE_UNKNOWN = 3 // Used when waiting for the Idle state or in error |
16 // conditions | 16 // conditions |
17 }; | 17 }; |
18 | 18 |
19 // For MacOSX, InitIdleMonitor needs to be called first to setup the monitor. | 19 // For MacOSX, InitIdleMonitor needs to be called first to setup the monitor. |
20 // StopIdleMonitor should be called if it is not needed any more. | 20 // StopIdleMonitor should be called if it is not needed any more. |
21 #if defined(OS_MACOSX) | 21 #if defined(OS_MACOSX) |
22 void InitIdleMonitor(); | 22 void InitIdleMonitor(); |
23 void StopIdleMonitor(); | 23 void StopIdleMonitor(); |
24 #endif | 24 #endif |
25 | 25 |
26 typedef base::Callback<void(IdleState)> IdleCallback; | 26 typedef base::Callback<void(IdleState)> IdleCallback; |
27 | 27 |
28 // Calculate the Idle state and notify the callback. | 28 // Calculate the Idle state and notify the callback. |
29 void CalculateIdleState(unsigned int idle_threshold, IdleCallback notify); | 29 void CalculateIdleState(unsigned int idle_threshold, IdleCallback notify); |
30 | 30 |
31 // Checks synchronously if Idle state is IDLE_STATE_LOCKED. | 31 // Checks synchronously if Idle state is IDLE_STATE_LOCKED. |
32 bool CheckIdleStateIsLocked(); | 32 bool CheckIdleStateIsLocked(); |
33 #endif // CHROME_BROWSER_IDLE_H_ | 33 #endif // CHROME_BROWSER_IDLE_H_ |
OLD | NEW |