OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/idle.h" | 5 #include "chrome/browser/idle.h" |
6 | 6 |
| 7 #include <limits.h> |
| 8 #include <windows.h> |
| 9 |
7 static bool IsScreensaverRunning(); | 10 static bool IsScreensaverRunning(); |
8 static bool IsWorkstationLocked(); | 11 static bool IsWorkstationLocked(); |
9 | 12 |
10 IdleState CalculateIdleState(unsigned int idle_threshold) { | 13 IdleState CalculateIdleState(unsigned int idle_threshold) { |
11 if (IsScreensaverRunning() || IsWorkstationLocked()) | 14 if (IsScreensaverRunning() || IsWorkstationLocked()) |
12 return IDLE_STATE_LOCKED; | 15 return IDLE_STATE_LOCKED; |
13 | 16 |
14 LASTINPUTINFO last_input_info = {0}; | 17 LASTINPUTINFO last_input_info = {0}; |
15 last_input_info.cbSize = sizeof(LASTINPUTINFO); | 18 last_input_info.cbSize = sizeof(LASTINPUTINFO); |
16 DWORD current_idle_time = 0; | 19 DWORD current_idle_time = 0; |
(...skipping 28 matching lines...) Expand all Loading... |
45 UOI_NAME, | 48 UOI_NAME, |
46 name, | 49 name, |
47 sizeof(name), | 50 sizeof(name), |
48 &needed)) { | 51 &needed)) { |
49 is_locked = lstrcmpi(name, L"default") != 0; | 52 is_locked = lstrcmpi(name, L"default") != 0; |
50 } | 53 } |
51 ::CloseDesktop(input_desk); | 54 ::CloseDesktop(input_desk); |
52 } | 55 } |
53 return is_locked; | 56 return is_locked; |
54 } | 57 } |
OLD | NEW |