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