summaryrefslogtreecommitdiffstats
path: root/chrome/browser/idle_linux.cc
diff options
context:
space:
mode:
authorsidor@chromium.org <sidor@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-10 07:54:50 +0000
committersidor@chromium.org <sidor@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-10 07:54:50 +0000
commit80722b2de9e24617450c1727b4aa619ca5f8709d (patch)
tree824cf99f86da8f5c8de98cee1f0139be84d314bd /chrome/browser/idle_linux.cc
parent49a9c05b2eafc9b4ed09f9e7b54c8a3a1a269afe (diff)
downloadchromium_src-80722b2de9e24617450c1727b4aa619ca5f8709d.zip
chromium_src-80722b2de9e24617450c1727b4aa619ca5f8709d.tar.gz
chromium_src-80722b2de9e24617450c1727b4aa619ca5f8709d.tar.bz2
Fixing the bug, that caused UI to hang after unsupported device was inserted.
In the idle.h new synchronous method was added - IsWorkstationInLockedState. BUG=chromium-os:20261 TEST=None Review URL: http://codereview.chromium.org/7864022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100582 0039d316-1c4b-4281-b951-d872f2087c98
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;
+}