Get exit code from within App::OnQuit

This commit is contained in:
Kevin Sawicki 2015-12-09 18:19:51 -08:00
parent c4389ad70f
commit 3e5caf7e54
4 changed files with 6 additions and 6 deletions

View file

@ -180,8 +180,9 @@ void App::OnWindowAllClosed() {
Emit("window-all-closed"); Emit("window-all-closed");
} }
void App::OnQuit(const int code) { void App::OnQuit() {
Emit("quit", code); int exitCode = AtomBrowserMainParts::Get()->GetExitCode();
Emit("quit", exitCode);
if (process_singleton_.get()) { if (process_singleton_.get()) {
process_singleton_->Cleanup(); process_singleton_->Cleanup();

View file

@ -42,7 +42,7 @@ class App : public AtomBrowserClient::Delegate,
void OnBeforeQuit(bool* prevent_default) override; void OnBeforeQuit(bool* prevent_default) override;
void OnWillQuit(bool* prevent_default) override; void OnWillQuit(bool* prevent_default) override;
void OnWindowAllClosed() override; void OnWindowAllClosed() override;
void OnQuit(int code) override; void OnQuit() override;
void OnOpenFile(bool* prevent_default, const std::string& file_path) override; void OnOpenFile(bool* prevent_default, const std::string& file_path) override;
void OnOpenURL(const std::string& url) override; void OnOpenURL(const std::string& url) override;
void OnActivate(bool has_visible_windows) override; void OnActivate(bool has_visible_windows) override;

View file

@ -72,8 +72,7 @@ void Browser::Shutdown() {
is_shutdown_ = true; is_shutdown_ = true;
is_quiting_ = true; is_quiting_ = true;
int exitCode = AtomBrowserMainParts::Get()->GetExitCode(); FOR_EACH_OBSERVER(BrowserObserver, observers_, OnQuit());
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnQuit(exitCode));
if (base::MessageLoop::current()) { if (base::MessageLoop::current()) {
base::MessageLoop::current()->PostTask( base::MessageLoop::current()->PostTask(

View file

@ -24,7 +24,7 @@ class BrowserObserver {
virtual void OnWindowAllClosed() {} virtual void OnWindowAllClosed() {}
// The browser is quitting. // The browser is quitting.
virtual void OnQuit(const int code) {} virtual void OnQuit() {}
// The browser has opened a file by double clicking in Finder or dragging the // The browser has opened a file by double clicking in Finder or dragging the
// file to the Dock icon. (OS X only) // file to the Dock icon. (OS X only)