void AutoUpdater::QuitAndInstall() {
// If we don't have any window then quitAndInstall immediately.
- WindowList* window_list = WindowList::GetInstance();
- if (window_list->empty()) {
+ if (WindowList::IsEmpty()) {
auto_updater::AutoUpdater::QuitAndInstall();
return;
}
// Otherwise do the restart after all windows have been closed.
- window_list->AddObserver(this);
+ WindowList::AddObserver(this);
WindowList::CloseAllWindows();
}
if (!is_quiting_)
return;
- atom::WindowList* window_list = atom::WindowList::GetInstance();
- if (window_list->empty())
+ if (atom::WindowList::IsEmpty())
NotifyAndShutdown();
-
- window_list->CloseAllWindows();
+ else
+ atom::WindowList::CloseAllWindows();
}
void Browser::Exit(mate::Arguments* args) {
is_exiting_ = true;
// Must destroy windows before quitting, otherwise bad things can happen.
- atom::WindowList* window_list = atom::WindowList::GetInstance();
- if (window_list->empty()) {
+ if (atom::WindowList::IsEmpty()) {
Shutdown();
} else {
// Unlike Quit(), we do not ask to close window, but destroy the window
}
// static
+bool WindowList::IsEmpty() {
+ return GetInstance()->windows_.empty();
+}
+
+// static
void WindowList::AddWindow(NativeWindow* window) {
DCHECK(window);
// Push |window| on the appropriate list instance.
public:
typedef std::vector<NativeWindow*> WindowVector;
- bool empty() const { return windows_.empty(); }
-
- static WindowList* GetInstance();
-
static WindowVector GetWindows();
+ static bool IsEmpty();
// Adds or removes |window| from the list it is associated with.
static void AddWindow(NativeWindow* window);
static void DestroyAllWindows();
private:
+ static WindowList* GetInstance();
+
WindowList();
~WindowList();