Implement shutdown event for macOS

This commit is contained in:
Cheng Zhao 2018-02-05 16:13:35 +09:00
parent c470e758cc
commit 983e1b1a70
7 changed files with 25 additions and 6 deletions

View file

@ -29,10 +29,16 @@ inline void dispatch_sync_main(dispatch_block_t block) {
}
- (void)terminate:(id)sender {
if (shouldShutdown_ && !shouldShutdown_.Run())
return; // User will call Quit later.
AtomApplicationDelegate* atomDelegate = (AtomApplicationDelegate*) [NSApp delegate];
[atomDelegate tryToTerminateApp:self];
}
- (void)setShutdownHandler:(base::Callback<bool()>)handler {
shouldShutdown_ = std::move(handler);
}
- (BOOL)isHandlingSendEvent {
return handlingSendEvent_;
}