mirror of
https://github.com/electron/electron.git
synced 2026-01-09 15:38:08 -05:00
Add 'will-finish-launching' event for app.
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user