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 #include "chrome/browser/idle.h" | 5 #include "chrome/browser/idle.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "chrome/browser/idle_query_linux.h" | 8 #include "chrome/browser/idle_query_linux.h" |
9 #include "chrome/browser/screensaver_window_finder_linux.h" | 9 |
| 10 #if !defined(USE_AURA) |
| 11 #include "chrome/browser/screensaver_window_finder_gtk.h" |
| 12 #endif |
10 | 13 |
11 void CalculateIdleState(unsigned int idle_threshold, IdleCallback notify) { | 14 void CalculateIdleState(unsigned int idle_threshold, IdleCallback notify) { |
12 if (CheckIdleStateIsLocked()) { | 15 if (CheckIdleStateIsLocked()) { |
13 notify.Run(IDLE_STATE_LOCKED); | 16 notify.Run(IDLE_STATE_LOCKED); |
14 return; | 17 return; |
15 } | 18 } |
16 browser::IdleQueryLinux idle_query; | 19 browser::IdleQueryLinux idle_query; |
17 unsigned int idle_time = idle_query.IdleTime(); | 20 unsigned int idle_time = idle_query.IdleTime(); |
18 if (idle_time >= idle_threshold) | 21 if (idle_time >= idle_threshold) |
19 notify.Run(IDLE_STATE_IDLE); | 22 notify.Run(IDLE_STATE_IDLE); |
20 else | 23 else |
21 notify.Run(IDLE_STATE_ACTIVE); | 24 notify.Run(IDLE_STATE_ACTIVE); |
22 } | 25 } |
23 | 26 |
24 bool CheckIdleStateIsLocked() { | 27 bool CheckIdleStateIsLocked() { |
25 // Usually the screensaver is used to lock the screen, so we do not need to | 28 // Usually the screensaver is used to lock the screen, so we do not need to |
26 // check if the workstation is locked. | 29 // check if the workstation is locked. |
| 30 #if defined(USE_AURA) |
| 31 return false; |
| 32 #else |
27 return ScreensaverWindowFinder::ScreensaverWindowExists(); | 33 return ScreensaverWindowFinder::ScreensaverWindowExists(); |
| 34 #endif |
28 } | 35 } |
OLD | NEW |