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 | |
10 #if !defined(USE_AURA) | |
9 #include "chrome/browser/screensaver_window_finder_linux.h" | 11 #include "chrome/browser/screensaver_window_finder_linux.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() { |
28 #if defined(USE_AURA) | |
29 // TODO(saintlou): We have no Screensaver in Aura. | |
oshima
2011/09/19 22:31:03
we will have, just different implementation. We ju
Emmanuel Saint-loubert-Bié
2011/09/19 23:26:02
Done.
| |
30 return false; | |
31 #else | |
25 // Usually the screensaver is used to lock the screen, so we do not need to | 32 // Usually the screensaver is used to lock the screen, so we do not need to |
26 // check if the workstation is locked. | 33 // check if the workstation is locked. |
27 return ScreensaverWindowFinder::ScreensaverWindowExists(); | 34 return ScreensaverWindowFinder::ScreensaverWindowExists(); |
35 #endif | |
28 } | 36 } |
OLD | NEW |