Add 'quit' and 'window-all-closed' events for app module.
This commit is contained in:
parent
66404b5f15
commit
9b75019898
10 changed files with 123 additions and 15 deletions
|
@ -7,6 +7,8 @@
|
|||
|
||||
#include "base/basictypes.h"
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/observer_list.h"
|
||||
#include "browser/browser_observer.h"
|
||||
#include "browser/window_list_observer.h"
|
||||
|
||||
namespace atom {
|
||||
|
@ -25,9 +27,17 @@ class Browser : public WindowListObserver {
|
|||
// Quit the application immediately without cleanup work.
|
||||
void Terminate();
|
||||
|
||||
bool is_quiting() const { return is_quiting_; }
|
||||
void AddObserver(BrowserObserver* obs) {
|
||||
observers_.AddObserver(obs);
|
||||
}
|
||||
|
||||
void RemoveObserver(BrowserObserver* obs) {
|
||||
observers_.RemoveObserver(obs);
|
||||
}
|
||||
|
||||
protected:
|
||||
void NotifyAndTerminate();
|
||||
|
||||
bool is_quiting_;
|
||||
|
||||
private:
|
||||
|
@ -35,6 +45,9 @@ class Browser : public WindowListObserver {
|
|||
virtual void OnWindowCloseCancelled(NativeWindow* window) OVERRIDE;
|
||||
virtual void OnWindowAllClosed() OVERRIDE;
|
||||
|
||||
// Observers of the browser.
|
||||
ObserverList<BrowserObserver> observers_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(Browser);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue