Chromium Code Reviews| 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_aura.h" | |
| 12 #else | |
| 13 #include "chrome/browser/screensaver_window_finder_gtk.h" | |
|
oshima
2011/09/20 04:59:18
Doh, I was stupid. I thought ScreensaverWindowFind
| |
| 14 #endif | |
| 10 | 15 |
| 11 void CalculateIdleState(unsigned int idle_threshold, IdleCallback notify) { | 16 void CalculateIdleState(unsigned int idle_threshold, IdleCallback notify) { |
| 12 if (CheckIdleStateIsLocked()) { | 17 if (CheckIdleStateIsLocked()) { |
| 13 notify.Run(IDLE_STATE_LOCKED); | 18 notify.Run(IDLE_STATE_LOCKED); |
| 14 return; | 19 return; |
| 15 } | 20 } |
| 16 browser::IdleQueryLinux idle_query; | 21 browser::IdleQueryLinux idle_query; |
| 17 unsigned int idle_time = idle_query.IdleTime(); | 22 unsigned int idle_time = idle_query.IdleTime(); |
| 18 if (idle_time >= idle_threshold) | 23 if (idle_time >= idle_threshold) |
| 19 notify.Run(IDLE_STATE_IDLE); | 24 notify.Run(IDLE_STATE_IDLE); |
| 20 else | 25 else |
| 21 notify.Run(IDLE_STATE_ACTIVE); | 26 notify.Run(IDLE_STATE_ACTIVE); |
| 22 } | 27 } |
| 23 | 28 |
| 24 bool CheckIdleStateIsLocked() { | 29 bool CheckIdleStateIsLocked() { |
| 25 // Usually the screensaver is used to lock the screen, so we do not need to | 30 // Usually the screensaver is used to lock the screen, so we do not need to |
| 26 // check if the workstation is locked. | 31 // check if the workstation is locked. |
| 27 return ScreensaverWindowFinder::ScreensaverWindowExists(); | 32 return ScreensaverWindowFinder::ScreensaverWindowExists(); |
| 28 } | 33 } |
| OLD | NEW |