Merge pull request #4271 from thingsinjars/master
🍎 Add 'Hide' to App API for OS X only
This commit is contained in:
commit
457c7f55e6
4 changed files with 26 additions and 0 deletions
|
@ -367,6 +367,10 @@ mate::ObjectTemplateBuilder App::GetObjectTemplateBuilder(
|
|||
base::Bind(&Browser::ClearRecentDocuments, browser))
|
||||
.SetMethod("setAppUserModelId",
|
||||
base::Bind(&Browser::SetAppUserModelID, browser))
|
||||
#if defined(OS_MACOSX)
|
||||
.SetMethod("hide", base::Bind(&Browser::Hide, browser))
|
||||
.SetMethod("show", base::Bind(&Browser::Show, browser))
|
||||
#endif
|
||||
#if defined(OS_WIN)
|
||||
.SetMethod("setUserTasks",
|
||||
base::Bind(&Browser::SetUserTasks, browser))
|
||||
|
|
|
@ -77,6 +77,12 @@ class Browser : public WindowListObserver {
|
|||
void SetAppUserModelID(const base::string16& name);
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
// Hide the application.
|
||||
void Hide();
|
||||
|
||||
// Show the application.
|
||||
void Show();
|
||||
|
||||
// Bounce the dock icon.
|
||||
enum BounceType {
|
||||
BOUNCE_CRITICAL = 0,
|
||||
|
|
|
@ -18,6 +18,14 @@ void Browser::Focus() {
|
|||
[[AtomApplication sharedApplication] activateIgnoringOtherApps:YES];
|
||||
}
|
||||
|
||||
void Browser::Hide() {
|
||||
[[AtomApplication sharedApplication] hide:nil];
|
||||
}
|
||||
|
||||
void Browser::Show() {
|
||||
[[AtomApplication sharedApplication] unhide:nil];
|
||||
}
|
||||
|
||||
void Browser::AddRecentDocument(const base::FilePath& path) {
|
||||
NSString* path_string = base::mac::FilePathToNSString(path);
|
||||
if (!path_string)
|
||||
|
|
|
@ -244,6 +244,14 @@ This method guarantees that all `beforeunload` and `unload` event handlers are
|
|||
correctly executed. It is possible that a window cancels the quitting by
|
||||
returning `false` in the `beforeunload` event handler.
|
||||
|
||||
### `app.hide()` _OS X_
|
||||
|
||||
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)`
|
||||
|
||||
* `exitCode` Integer
|
||||
|
|
Loading…
Reference in a new issue