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 #include "base/idle_timer.h" | 5 #include "base/idle_timer.h" |
6 | 6 |
7 #if defined(OS_MACOSX) | 7 #if defined(OS_MACOSX) |
8 #include <ApplicationServices/ApplicationServices.h> | 8 #include <ApplicationServices/ApplicationServices.h> |
9 #endif | 9 #endif |
10 | 10 |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "base/time.h" | 12 #include "base/time.h" |
13 | 13 |
| 14 using base::Time; |
| 15 using base::TimeDelta; |
| 16 |
14 namespace base { | 17 namespace base { |
15 | 18 |
16 #if defined(OS_WIN) | 19 #if defined(OS_WIN) |
17 bool OSIdleTimeSource(int32 *milliseconds_interval_since_last_event) { | 20 bool OSIdleTimeSource(int32 *milliseconds_interval_since_last_event) { |
18 LASTINPUTINFO lastInputInfo; | 21 LASTINPUTINFO lastInputInfo; |
19 lastInputInfo.cbSize = sizeof(lastInputInfo); | 22 lastInputInfo.cbSize = sizeof(lastInputInfo); |
20 if (GetLastInputInfo(&lastInputInfo) == 0) { | 23 if (GetLastInputInfo(&lastInputInfo) == 0) { |
21 return false; | 24 return false; |
22 } | 25 } |
23 int32 last_input_time = lastInputInfo.dwTime; | 26 int32 last_input_time = lastInputInfo.dwTime; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 TimeDelta current_idle_time = CurrentIdleTime(); | 97 TimeDelta current_idle_time = CurrentIdleTime(); |
95 if (current_idle_time > time_since_last_fire) { | 98 if (current_idle_time > time_since_last_fire) { |
96 if (repeat_) | 99 if (repeat_) |
97 return idle_interval_ - time_since_last_fire; | 100 return idle_interval_ - time_since_last_fire; |
98 return idle_interval_; | 101 return idle_interval_; |
99 } | 102 } |
100 return idle_interval_ - current_idle_time; | 103 return idle_interval_ - current_idle_time; |
101 } | 104 } |
102 | 105 |
103 } // namespace base | 106 } // namespace base |
OLD | NEW |