More fixes after code review.
This commit is contained in:
parent
40d93ce55a
commit
9652ed6508
7 changed files with 11 additions and 30 deletions
|
@ -167,12 +167,8 @@ void App::OnOpenURL(const std::string& url) {
|
||||||
Emit("open-url", url);
|
Emit("open-url", url);
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::OnActivateWithNoOpenWindows() {
|
void App::OnActivate(bool has_visible_windows) {
|
||||||
Emit("activate-with-no-open-windows");
|
Emit("activate", has_visible_windows);
|
||||||
}
|
|
||||||
|
|
||||||
void App::OnActivate(bool hasVisibleWindows) {
|
|
||||||
Emit("activate", hasVisibleWindows);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::OnWillFinishLaunching() {
|
void App::OnWillFinishLaunching() {
|
||||||
|
|
|
@ -41,8 +41,7 @@ class App : public mate::EventEmitter,
|
||||||
void OnQuit() override;
|
void OnQuit() override;
|
||||||
void OnOpenFile(bool* prevent_default, const std::string& file_path) override;
|
void OnOpenFile(bool* prevent_default, const std::string& file_path) override;
|
||||||
void OnOpenURL(const std::string& url) override;
|
void OnOpenURL(const std::string& url) override;
|
||||||
void OnActivateWithNoOpenWindows() override;
|
void OnActivate(bool has_visible_windows) override;
|
||||||
void OnActivate(bool hasVisibleWindows) override;
|
|
||||||
void OnWillFinishLaunching() override;
|
void OnWillFinishLaunching() override;
|
||||||
void OnFinishLaunching() override;
|
void OnFinishLaunching() override;
|
||||||
void OnSelectCertificate(
|
void OnSelectCertificate(
|
||||||
|
|
|
@ -45,6 +45,7 @@ app.getHomeDir = -> @getPath 'home'
|
||||||
app.getDataPath = -> @getPath 'userData'
|
app.getDataPath = -> @getPath 'userData'
|
||||||
app.setDataPath = (path) -> @setPath 'userData', path
|
app.setDataPath = (path) -> @setPath 'userData', path
|
||||||
app.resolveProxy = -> @defaultSession.resolveProxy.apply @defaultSession, arguments
|
app.resolveProxy = -> @defaultSession.resolveProxy.apply @defaultSession, arguments
|
||||||
|
app.on 'activate', (event, hasVisibleWindows) -> @emit 'activate-with-no-open-windows' if hasVisibleWindows
|
||||||
|
|
||||||
# Session wrapper.
|
# Session wrapper.
|
||||||
sessionBindings._setWrapSession wrapSession
|
sessionBindings._setWrapSession wrapSession
|
||||||
|
|
|
@ -94,12 +94,10 @@ void Browser::OpenURL(const std::string& url) {
|
||||||
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnOpenURL(url));
|
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnOpenURL(url));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Browser::ActivateWithNoOpenWindows() {
|
void Browser::Activate(bool has_visible_windows) {
|
||||||
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnActivateWithNoOpenWindows());
|
FOR_EACH_OBSERVER(BrowserObserver,
|
||||||
}
|
observers_,
|
||||||
|
OnActivate(has_visible_windows));
|
||||||
void Browser::Activate(bool hasVisibleWindows) {
|
|
||||||
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnActivate(hasVisibleWindows));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Browser::WillFinishLaunching() {
|
void Browser::WillFinishLaunching() {
|
||||||
|
|
|
@ -108,12 +108,9 @@ class Browser : public WindowListObserver {
|
||||||
// Tell the application to open a url.
|
// Tell the application to open a url.
|
||||||
void OpenURL(const std::string& url);
|
void OpenURL(const std::string& url);
|
||||||
|
|
||||||
// Tell the application that application is activated with no open windows.
|
|
||||||
void ActivateWithNoOpenWindows();
|
|
||||||
|
|
||||||
// Tell the application that application is activated with visible/invisible
|
// Tell the application that application is activated with visible/invisible
|
||||||
// windows.
|
// windows.
|
||||||
void Activate(bool hasVisibleWindows);
|
void Activate(bool has_visible_windows);
|
||||||
|
|
||||||
// Tell the application the loading has been done.
|
// Tell the application the loading has been done.
|
||||||
void WillFinishLaunching();
|
void WillFinishLaunching();
|
||||||
|
|
|
@ -43,13 +43,9 @@ class BrowserObserver {
|
||||||
// Browser is used to open a url.
|
// Browser is used to open a url.
|
||||||
virtual void OnOpenURL(const std::string& url) {}
|
virtual void OnOpenURL(const std::string& url) {}
|
||||||
|
|
||||||
// The browser is activated with no open windows (usually by clicking on the
|
|
||||||
// dock icon).
|
|
||||||
virtual void OnActivateWithNoOpenWindows() {}
|
|
||||||
|
|
||||||
// The browser is activated with visible/invisible windows (usually by
|
// The browser is activated with visible/invisible windows (usually by
|
||||||
// clicking on the dock icon).
|
// clicking on the dock icon).
|
||||||
virtual void OnActivate(bool hasVisibleWindows) {}
|
virtual void OnActivate(bool has_visible_windows) {}
|
||||||
|
|
||||||
// The browser has finished loading.
|
// The browser has finished loading.
|
||||||
virtual void OnWillFinishLaunching() {}
|
virtual void OnWillFinishLaunching() {}
|
||||||
|
|
|
@ -53,13 +53,7 @@
|
||||||
hasVisibleWindows:(BOOL)flag {
|
hasVisibleWindows:(BOOL)flag {
|
||||||
atom::Browser* browser = atom::Browser::Get();
|
atom::Browser* browser = atom::Browser::Get();
|
||||||
browser->Activate(static_cast<bool>(flag));
|
browser->Activate(static_cast<bool>(flag));
|
||||||
if (flag) {
|
return flag;
|
||||||
return YES;
|
|
||||||
} else {
|
|
||||||
// Deprecated API, for compatibility.
|
|
||||||
browser->ActivateWithNoOpenWindows();
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Reference in a new issue