summaryrefslogtreecommitdiffstats
path: root/chrome/browser/idle_linux.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/idle_linux.cc')
-rw-r--r--chrome/browser/idle_linux.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/chrome/browser/idle_linux.cc b/chrome/browser/idle_linux.cc
index eba7958..dacde8b 100644
--- a/chrome/browser/idle_linux.cc
+++ b/chrome/browser/idle_linux.cc
@@ -64,16 +64,10 @@ bool ScreensaverWindowExists() {
}
void CalculateIdleState(unsigned int idle_threshold, IdleCallback notify) {
- // Usually the screensaver is used to lock the screen, so we do not need to
- // check if the workstation is locked.
- gdk_error_trap_push();
- bool result = ScreensaverWindowExists();
- bool got_error = gdk_error_trap_pop();
- if (result && !got_error) {
+ if (CheckIdleStateIsLocked()) {
notify.Run(IDLE_STATE_LOCKED);
return;
}
-
browser::IdleQueryLinux idle_query;
unsigned int idle_time = idle_query.IdleTime();
if (idle_time >= idle_threshold)
@@ -81,3 +75,12 @@ void CalculateIdleState(unsigned int idle_threshold, IdleCallback notify) {
else
notify.Run(IDLE_STATE_ACTIVE);
}
+
+bool CheckIdleStateIsLocked() {
+ // Usually the screensaver is used to lock the screen, so we do not need to
+ // check if the workstation is locked.
+ gdk_error_trap_push();
+ bool result = ScreensaverWindowExists();
+ bool got_error = gdk_error_trap_pop();
+ return result && !got_error;
+}