summaryrefslogtreecommitdiffstats
path: root/ui/base/win
diff options
context:
space:
mode:
authorjbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-25 01:45:10 +0000
committerjbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-25 01:45:10 +0000
commit5df0b3229519a2a4a8c45955081a7dcaafbe666d (patch)
tree0dd1478a27934ea946b2be5a2b578bd606c51855 /ui/base/win
parent5c6d0ccf1bca276fe7827b11c908b72183212e94 (diff)
downloadchromium_src-5df0b3229519a2a4a8c45955081a7dcaafbe666d.zip
chromium_src-5df0b3229519a2a4a8c45955081a7dcaafbe666d.tar.gz
chromium_src-5df0b3229519a2a4a8c45955081a7dcaafbe666d.tar.bz2
Repaint windows on screen unlock.
D3D presents are ignored while the screen is locked, so wait for unlock and then attempt to redraw all windows. BUG=322728 Review URL: https://codereview.chromium.org/140453002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247059 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/base/win')
-rw-r--r--ui/base/win/lock_state.cc26
-rw-r--r--ui/base/win/lock_state.h18
2 files changed, 44 insertions, 0 deletions
diff --git a/ui/base/win/lock_state.cc b/ui/base/win/lock_state.cc
new file mode 100644
index 0000000..c56eae4
--- /dev/null
+++ b/ui/base/win/lock_state.cc
@@ -0,0 +1,26 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/base/win/lock_state.h"
+
+#include <windows.h>
+
+namespace ui {
+
+bool IsWorkstationLocked() {
+ bool is_locked = true;
+ HDESK input_desk = ::OpenInputDesktop(0, 0, GENERIC_READ);
+ if (input_desk) {
+ wchar_t name[256] = {0};
+ DWORD needed = 0;
+ if (::GetUserObjectInformation(
+ input_desk, UOI_NAME, name, sizeof(name), &needed)) {
+ is_locked = lstrcmpi(name, L"default") != 0;
+ }
+ ::CloseDesktop(input_desk);
+ }
+ return is_locked;
+}
+
+} // namespace ui
diff --git a/ui/base/win/lock_state.h b/ui/base/win/lock_state.h
new file mode 100644
index 0000000..be9c912
--- /dev/null
+++ b/ui/base/win/lock_state.h
@@ -0,0 +1,18 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_BASE_WIN_LOCK_STATE_H_
+#define UI_BASE_WIN_LOCK_STATE_H_
+
+#include "base/basictypes.h"
+#include "ui/base/ui_base_export.h"
+
+namespace ui {
+
+// Returns true if the screen is currently locked.
+UI_BASE_EXPORT bool IsWorkstationLocked();
+
+} // namespace ui
+
+#endif // UI_BASE_WIN_LOCK_STATE_H_