#include "atom/browser/atom_browser_main_parts.h"
#include "atom/browser/window_list.h"
+#include "base/message_loop/message_loop.h"
namespace atom {
atom::WindowList* window_list = atom::WindowList::GetInstance();
if (window_list->size() == 0)
- NotifyAndTerminate();
+ NotifyAndShutdown();
window_list->CloseAllWindows();
}
+void Browser::Shutdown() {
+ is_quiting_ = true;
+ base::MessageLoop::current()->Quit();
+}
+
std::string Browser::GetVersion() const {
if (version_override_.empty()) {
std::string version = GetExecutableFileVersion();
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnFinishLaunching());
}
-void Browser::NotifyAndTerminate() {
+void Browser::NotifyAndShutdown() {
bool prevent_default = false;
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnWillQuit(&prevent_default));
return;
}
- Terminate();
+ Shutdown();
}
void Browser::OnWindowCloseCancelled(NativeWindow* window) {
void Browser::OnWindowAllClosed() {
if (is_quiting_)
- NotifyAndTerminate();
+ NotifyAndShutdown();
else
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnWindowAllClosed());
}
// Try to close all windows and quit the application.
void Quit();
- // Quit the application immediately without cleanup work.
- void Terminate();
+ // Cleanup everything and shutdown the application gracefully.
+ void Shutdown();
// Focus the application.
void Focus();
// Returns the name of application bundle or executable file.
std::string GetExecutableFileProductName() const;
- // Send the will-quit message and then terminate the application.
- void NotifyAndTerminate();
+ // Send the will-quit message and then shutdown the application.
+ void NotifyAndShutdown();
// Tell the system we have cancelled quiting.
void CancelQuit();