fix: remove extra 'suspend'/'resume' handling from powerMonitor (#47188)

fix: remove extra 'suspend'/'resume' handling from powerMonitor

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
trop[bot] 2025-05-22 00:01:17 -05:00 committed by GitHub
commit e53a7c7c00
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 0 additions and 35 deletions

View file

@ -34,17 +34,6 @@
selector:@selector(onScreenUnlocked:) selector:@selector(onScreenUnlocked:)
name:@"com.apple.screenIsUnlocked" name:@"com.apple.screenIsUnlocked"
object:nil]; object:nil];
// A notification that the workspace posts before the machine goes to sleep.
[distributed_center addObserver:self
selector:@selector(isSuspending:)
name:NSWorkspaceWillSleepNotification
object:nil];
// A notification that the workspace posts when the machine wakes from
// sleep.
[distributed_center addObserver:self
selector:@selector(isResuming:)
name:NSWorkspaceDidWakeNotification
object:nil];
NSNotificationCenter* shared_center = NSNotificationCenter* shared_center =
[[NSWorkspace sharedWorkspace] notificationCenter]; [[NSWorkspace sharedWorkspace] notificationCenter];
@ -73,18 +62,6 @@
self->emitters.push_back(monitor_); self->emitters.push_back(monitor_);
} }
- (void)isSuspending:(NSNotification*)notify {
for (auto* emitter : self->emitters) {
emitter->Emit("suspend");
}
}
- (void)isResuming:(NSNotification*)notify {
for (auto* emitter : self->emitters) {
emitter->Emit("resume");
}
}
- (void)onScreenLocked:(NSNotification*)notification { - (void)onScreenLocked:(NSNotification*)notification {
for (auto* emitter : self->emitters) { for (auto* emitter : self->emitters) {
emitter->Emit("lock-screen"); emitter->Emit("lock-screen");

View file

@ -88,18 +88,6 @@ LRESULT CALLBACK PowerMonitor::WndProc(HWND hwnd,
base::Unretained(this))); base::Unretained(this)));
} }
} }
} else if (message == WM_POWERBROADCAST) {
if (wparam == PBT_APMRESUMEAUTOMATIC) {
content::GetUIThreadTaskRunner({})->PostTask(
FROM_HERE,
base::BindOnce([](PowerMonitor* pm) { pm->Emit("resume"); },
base::Unretained(this)));
} else if (wparam == PBT_APMSUSPEND) {
content::GetUIThreadTaskRunner({})->PostTask(
FROM_HERE,
base::BindOnce([](PowerMonitor* pm) { pm->Emit("suspend"); },
base::Unretained(this)));
}
} }
return ::DefWindowProc(hwnd, message, wparam, lparam); return ::DefWindowProc(hwnd, message, wparam, lparam);
} }