Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(508)

Unified Diff: chrome/browser/idle_linux.cc

Issue 7864022: Fixing the bug, that caused UI to hang after unsupported device was inserted. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: style fixes Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/idle_chromeos.cc ('k') | chrome/browser/idle_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/idle_linux.cc
diff --git a/chrome/browser/idle_linux.cc b/chrome/browser/idle_linux.cc
index eba79585d54d76b4710fd933b7066d9936a2d006..dacde8bae13342afb149580e7c78ee1b25c91c19 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;
+}
« no previous file with comments | « chrome/browser/idle_chromeos.cc ('k') | chrome/browser/idle_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698