Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2250)

Unified Diff: base/idle_timer.h

Issue 2806: This is just an idea for how to implement idle_timer which isn't yet feasible... Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 12 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/idle_timer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/idle_timer.h
===================================================================
--- base/idle_timer.h (revision 2086)
+++ base/idle_timer.h (working copy)
@@ -28,7 +28,9 @@
#ifndef BASE_IDLE_TIMER_H_
#define BASE_IDLE_TIMER_H_
+#if defined(OS_WIN)
#include <windows.h>
+#endif // OS_WIN
#include "base/basictypes.h"
#include "base/task.h"
@@ -37,7 +39,7 @@
namespace base {
// Function prototype for GetLastInputInfo.
-typedef BOOL (__stdcall *GetLastInputInfoFunction)(PLASTINPUTINFO plii);
+typedef bool (*GetIdleTimeFunction)(int32* milliseconds);
class IdleTimer {
public:
@@ -61,8 +63,8 @@
protected:
// Override the GetLastInputInfo function.
- void set_last_input_info_fn(GetLastInputInfoFunction function) {
- get_last_input_info_fn_ = function;
+ void set_idle_time_fn(GetIdleTimeFunction function) {
+ get_idle_time_fn_ = function;
}
private:
@@ -78,13 +80,26 @@
// Compute time until idle. Returns 0 if we are now idle.
TimeDelta TimeUntilIdle();
+#if defined(OS_LINUX)
+ struct XssInfoLazyInstanceTraits {
+ static void New(void* instance);
+ static void Delete(void* instance);
+ };
+ struct XssInfo {
+ bool have_xss;
+ ThreadLocalPointer<XScreenSaverInfo> xss_info;
+ };
+#endif // OS_LINUX
+
+ static bool DefaultIdleTimeFunction(int32* milliseconds);
+
TimeDelta idle_interval_;
bool repeat_;
Time last_time_fired_; // The last time the idle timer fired.
// will be 0 until the timer fires the first time.
OneShotTimer<IdleTimer> timer_;
- GetLastInputInfoFunction get_last_input_info_fn_;
+ GetIdleTimeFunction get_idle_time_fn_;
DISALLOW_COPY_AND_ASSIGN(IdleTimer);
};
« no previous file with comments | « no previous file | base/idle_timer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698