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

Side by Side Diff: chrome/browser/idle_win.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/idle_mac.mm ('k') | chrome/browser/notifications/notification_ui_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <limits.h> 7 #include <limits.h>
8 #include <windows.h> 8 #include <windows.h>
9 9
10 static bool IsScreensaverRunning(); 10 static bool IsScreensaverRunning();
11 static bool IsWorkstationLocked(); 11 static bool IsWorkstationLocked();
12 12
13 void CalculateIdleState(unsigned int idle_threshold, IdleCallback notify) { 13 void CalculateIdleState(unsigned int idle_threshold, IdleCallback notify) {
14 if (IsScreensaverRunning() || IsWorkstationLocked()) { 14 if (CheckIdleStateIsLocked()) {
15 notify.Run(IDLE_STATE_LOCKED); 15 notify.Run(IDLE_STATE_LOCKED);
16 return; 16 return;
17 } 17 }
18 18
19 LASTINPUTINFO last_input_info = {0}; 19 LASTINPUTINFO last_input_info = {0};
20 last_input_info.cbSize = sizeof(LASTINPUTINFO); 20 last_input_info.cbSize = sizeof(LASTINPUTINFO);
21 DWORD current_idle_time = 0; 21 DWORD current_idle_time = 0;
22 if (::GetLastInputInfo(&last_input_info)) { 22 if (::GetLastInputInfo(&last_input_info)) {
23 DWORD now = ::GetTickCount(); 23 DWORD now = ::GetTickCount();
24 if (now < last_input_info.dwTime) { 24 if (now < last_input_info.dwTime) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 UOI_NAME, 60 UOI_NAME,
61 name, 61 name,
62 sizeof(name), 62 sizeof(name),
63 &needed)) { 63 &needed)) {
64 is_locked = lstrcmpi(name, L"default") != 0; 64 is_locked = lstrcmpi(name, L"default") != 0;
65 } 65 }
66 ::CloseDesktop(input_desk); 66 ::CloseDesktop(input_desk);
67 } 67 }
68 return is_locked; 68 return is_locked;
69 } 69 }
70
71 bool CheckIdleStateIsLocked() {
72 return IsWorkstationLocked() || IsScreensaverRunning();
73 }
OLDNEW
« no previous file with comments | « chrome/browser/idle_mac.mm ('k') | chrome/browser/notifications/notification_ui_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698