fix: register for connected standby changes (#25076)

This commit is contained in:
Cheng Zhao 2020-08-25 05:09:36 +09:00 committed by GitHub
parent 8baa9deccd
commit 5ed3460751
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,6 +8,7 @@
#include <wtsapi32.h> #include <wtsapi32.h>
#include "base/win/windows_types.h" #include "base/win/windows_types.h"
#include "base/win/windows_version.h"
#include "base/win/wrapped_window_proc.h" #include "base/win/wrapped_window_proc.h"
#include "ui/base/win/shell.h" #include "ui/base/win/shell.h"
#include "ui/gfx/win/hwnd_util.h" #include "ui/gfx/win/hwnd_util.h"
@ -40,6 +41,13 @@ void PowerMonitor::InitPlatformSpecificMonitors() {
// Tel windows we want to be notified with session events // Tel windows we want to be notified with session events
WTSRegisterSessionNotification(window_, NOTIFY_FOR_THIS_SESSION); WTSRegisterSessionNotification(window_, NOTIFY_FOR_THIS_SESSION);
// For Windows 8 and later, a new "connected standy" mode has been added and
// we must explicitly register for its notifications.
if (base::win::GetVersion() >= base::win::Version::WIN8) {
RegisterSuspendResumeNotification(static_cast<HANDLE>(window_),
DEVICE_NOTIFY_WINDOW_HANDLE);
}
} }
LRESULT CALLBACK PowerMonitor::WndProcStatic(HWND hwnd, LRESULT CALLBACK PowerMonitor::WndProcStatic(HWND hwnd,