diff options
Diffstat (limited to 'chrome/browser/idle_linux.cc')
-rw-r--r-- | chrome/browser/idle_linux.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/chrome/browser/idle_linux.cc b/chrome/browser/idle_linux.cc index 2689808..eba7958 100644 --- a/chrome/browser/idle_linux.cc +++ b/chrome/browser/idle_linux.cc @@ -63,18 +63,21 @@ bool ScreensaverWindowExists() { } -IdleState CalculateIdleState(unsigned int idle_threshold) { +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) - return IDLE_STATE_LOCKED; + if (result && !got_error) { + notify.Run(IDLE_STATE_LOCKED); + return; + } browser::IdleQueryLinux idle_query; unsigned int idle_time = idle_query.IdleTime(); if (idle_time >= idle_threshold) - return IDLE_STATE_IDLE; - return IDLE_STATE_ACTIVE; + notify.Run(IDLE_STATE_IDLE); + else + notify.Run(IDLE_STATE_ACTIVE); } |