| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // IdleTimer is a recurring Timer which runs only when the system is idle. | 5 // IdleTimer is a recurring Timer which runs only when the system is idle. |
| 6 // System Idle time is defined as not having any user keyboard or mouse | 6 // System Idle time is defined as not having any user keyboard or mouse |
| 7 // activity for some period of time. Because the timer is user dependant, it | 7 // activity for some period of time. Because the timer is user dependant, it |
| 8 // is possible for the timer to never fire. | 8 // is possible for the timer to never fire. |
| 9 // | 9 // |
| 10 // Usage should be for low-priority work, and may look like this: | 10 // Usage should be for low-priority work, and may look like this: |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // Such a thread should be running a MessageLoopForUI. | 26 // Such a thread should be running a MessageLoopForUI. |
| 27 | 27 |
| 28 #ifndef BASE_IDLE_TIMER_H_ | 28 #ifndef BASE_IDLE_TIMER_H_ |
| 29 #define BASE_IDLE_TIMER_H_ | 29 #define BASE_IDLE_TIMER_H_ |
| 30 | 30 |
| 31 #if defined(OS_WIN) | 31 #if defined(OS_WIN) |
| 32 #include <windows.h> | 32 #include <windows.h> |
| 33 #endif | 33 #endif |
| 34 | 34 |
| 35 #include "base/basictypes.h" | 35 #include "base/basictypes.h" |
| 36 #include "base/task.h" | |
| 37 #include "base/timer.h" | 36 #include "base/timer.h" |
| 38 | 37 |
| 39 namespace base { | 38 namespace base { |
| 40 | 39 |
| 41 // Function prototype - Get the number of milliseconds that the user has been | 40 // Function prototype - Get the number of milliseconds that the user has been |
| 42 // idle. | 41 // idle. |
| 43 typedef bool (*IdleTimeSource)(int32 *milliseconds_interval_since_last_event); | 42 typedef bool (*IdleTimeSource)(int32 *milliseconds_interval_since_last_event); |
| 44 | 43 |
| 45 class IdleTimer { | 44 class IdleTimer { |
| 46 public: | 45 public: |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 OneShotTimer<IdleTimer> timer_; | 87 OneShotTimer<IdleTimer> timer_; |
| 89 | 88 |
| 90 IdleTimeSource idle_time_source_; | 89 IdleTimeSource idle_time_source_; |
| 91 | 90 |
| 92 DISALLOW_COPY_AND_ASSIGN(IdleTimer); | 91 DISALLOW_COPY_AND_ASSIGN(IdleTimer); |
| 93 }; | 92 }; |
| 94 | 93 |
| 95 } // namespace base | 94 } // namespace base |
| 96 | 95 |
| 97 #endif // BASE_IDLE_TIMER_H_ | 96 #endif // BASE_IDLE_TIMER_H_ |
| OLD | NEW |