mirror of
https://github.com/atom/atom.git
synced 2026-01-22 13:28:01 -05:00
Atom will auto-update on close if a newer version is on Speakeasy
The first call to terminate is canceled so that every window can be closed. On AtomCefClient the OnBeforeClose method is called when a browser is finished closing. Once all windows have finished closing, AtomCefClient calls terminate again, which will terminate the application. Closes #527
This commit is contained in:
@@ -278,12 +278,21 @@
|
||||
}
|
||||
}
|
||||
|
||||
// The first call to terminate is canceled so that every window can be closed.
|
||||
// On AtomCefClient the OnBeforeClose method is called when a browser is
|
||||
// finished closing. Once all windows have finished closing, AtomCefClient calls
|
||||
// terminate again, which will terminate the application.
|
||||
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender {
|
||||
for (NSWindow *window in [self windows]) {
|
||||
[window performClose:self];
|
||||
if (self.windows.count > 0) {
|
||||
for (NSWindow *window in self.windows) {
|
||||
[window performClose:self];
|
||||
}
|
||||
return NSTerminateCancel;
|
||||
}
|
||||
else {
|
||||
CefQuitMessageLoop();
|
||||
return NSTerminateNow;
|
||||
}
|
||||
|
||||
return NSTerminateCancel;
|
||||
}
|
||||
|
||||
# pragma mark CefAppProtocol
|
||||
|
||||
@@ -174,7 +174,7 @@ void AtomCefClient::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
|
||||
m_Browser = NULL;
|
||||
numberOfOpenBrowsers--;
|
||||
if (numberOfOpenBrowsers == 0) {
|
||||
CefQuitMessageLoop();
|
||||
Terminate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -127,6 +127,7 @@ class AtomCefClient : public CefClient,
|
||||
void ShowSaveDialog(int replyId, CefRefPtr<CefBrowser> browser);
|
||||
CefRefPtr<CefListValue> CreateReplyDescriptor(int replyId, int callbackIndex);
|
||||
void Exit(int status);
|
||||
void Terminate();
|
||||
void Log(const char *message);
|
||||
void Show(CefRefPtr<CefBrowser> browser);
|
||||
void ToggleFullScreen(CefRefPtr<CefBrowser> browser);
|
||||
|
||||
@@ -159,6 +159,10 @@ void AtomCefClient::Exit(int status) {
|
||||
exit(status);
|
||||
}
|
||||
|
||||
void AtomCefClient::Terminate() {
|
||||
[NSApp terminate:NSApp];
|
||||
}
|
||||
|
||||
void AtomCefClient::Log(const char *message) {
|
||||
NSLog(@"%s", message);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user