🍎 Add Show to API for OS X

This commit is contained in:
Simon Madine 2016-01-30 21:40:32 +01:00
parent 6a643ec3c8
commit f9efdc4435
4 changed files with 12 additions and 0 deletions

View file

@ -369,6 +369,7 @@ mate::ObjectTemplateBuilder App::GetObjectTemplateBuilder(
base::Bind(&Browser::SetAppUserModelID, browser)) base::Bind(&Browser::SetAppUserModelID, browser))
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
.SetMethod("hide", base::Bind(&Browser::Hide, browser)) .SetMethod("hide", base::Bind(&Browser::Hide, browser))
.SetMethod("show", base::Bind(&Browser::Show, browser))
#endif #endif
#if defined(OS_WIN) #if defined(OS_WIN)
.SetMethod("setUserTasks", .SetMethod("setUserTasks",

View file

@ -80,6 +80,9 @@ class Browser : public WindowListObserver {
// Hide the application. // Hide the application.
void Hide(); void Hide();
// Show the application.
void Show();
// Bounce the dock icon. // Bounce the dock icon.
enum BounceType { enum BounceType {
BOUNCE_CRITICAL = 0, BOUNCE_CRITICAL = 0,

View file

@ -22,6 +22,10 @@ void Browser::Hide() {
[[AtomApplication sharedApplication] hide:nil]; [[AtomApplication sharedApplication] hide:nil];
} }
void Browser::Show() {
[[AtomApplication sharedApplication] unhide:nil];
}
void Browser::AddRecentDocument(const base::FilePath& path) { void Browser::AddRecentDocument(const base::FilePath& path) {
NSString* path_string = base::mac::FilePathToNSString(path); NSString* path_string = base::mac::FilePathToNSString(path);
if (!path_string) if (!path_string)

View file

@ -248,6 +248,10 @@ returning `false` in the `beforeunload` event handler.
Hides all application windows without minimising them. Hides all application windows without minimising them.
### `app.show()` _OS X_
Shows application windows after they were hidden. Does not automatically focus them.
### `app.exit(exitCode)` ### `app.exit(exitCode)`
* `exitCode` Integer * `exitCode` Integer