Add 'will-finish-launching' event for app.
This commit is contained in:
parent
e4d2368908
commit
bf409efc46
7 changed files with 16 additions and 0 deletions
|
@ -36,6 +36,10 @@ void App::OnOpenFile(bool* prevent_default, const std::string& file_path) {
|
|||
*prevent_default = Emit("open-file", &args);
|
||||
}
|
||||
|
||||
void App::OnWillFinishLaunching() {
|
||||
Emit("will-finish-launching");
|
||||
}
|
||||
|
||||
void App::OnFinishLaunching() {
|
||||
Emit("finish-launching");
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ class App : public EventEmitter,
|
|||
virtual void OnWindowAllClosed() OVERRIDE;
|
||||
virtual void OnOpenFile(bool* prevent_default,
|
||||
const std::string& file_path) OVERRIDE;
|
||||
virtual void OnWillFinishLaunching() OVERRIDE;
|
||||
virtual void OnFinishLaunching() OVERRIDE;
|
||||
|
||||
private:
|
||||
|
|
|
@ -10,6 +10,10 @@
|
|||
|
||||
@implementation AtomApplicationDelegate
|
||||
|
||||
- (void)applicationWillFinishLaunching:(NSNotification*)notify {
|
||||
atom::Browser::Get()->WillFinishLaunching();
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:(NSNotification*)notify {
|
||||
// Trap the quit message to handleQuitEvent.
|
||||
NSAppleEventManager* em = [NSAppleEventManager sharedAppleEventManager];
|
||||
|
|
|
@ -72,6 +72,7 @@ void AtomBrowserMainParts::PreMainMessageLoopRun() {
|
|||
|
||||
#if !defined(OS_MACOSX)
|
||||
// The corresponding call in OS X is in AtomApplicationDelegate.
|
||||
Browser::Get()->WillFinishLaunching();
|
||||
Browser::Get()->DidFinishLaunching();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -41,6 +41,10 @@ bool Browser::OpenFile(const std::string& file_path) {
|
|||
return prevent_default;
|
||||
}
|
||||
|
||||
void Browser::WillFinishLaunching() {
|
||||
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnWillFinishLaunching());
|
||||
}
|
||||
|
||||
void Browser::DidFinishLaunching() {
|
||||
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnFinishLaunching());
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ class Browser : public WindowListObserver {
|
|||
bool OpenFile(const std::string& file_path);
|
||||
|
||||
// Tell the application the loading has been done.
|
||||
void WillFinishLaunching();
|
||||
void DidFinishLaunching();
|
||||
|
||||
void AddObserver(BrowserObserver* obs) {
|
||||
|
|
|
@ -24,6 +24,7 @@ class BrowserObserver {
|
|||
const std::string& file_path) {}
|
||||
|
||||
// The browser has finished loading.
|
||||
virtual void OnWillFinishLaunching() {}
|
||||
virtual void OnFinishLaunching() {}
|
||||
|
||||
protected:
|
||||
|
|
Loading…
Reference in a new issue