:apple: Add Show to API for OS X
authorSimon Madine <simon.madine@here.com>
Sat, 30 Jan 2016 20:40:32 +0000 (21:40 +0100)
committerSimon Madine <simon.madine@here.com>
Sat, 30 Jan 2016 21:30:38 +0000 (22:30 +0100)
atom/browser/api/atom_api_app.cc
atom/browser/browser.h
atom/browser/browser_mac.mm
docs/api/app.md

index 0562cf893af67358db6e773f37769d22d3fa8155..e54d7fee1769cb82f57681a7342e8923d0253888 100644 (file)
@@ -369,6 +369,7 @@ mate::ObjectTemplateBuilder App::GetObjectTemplateBuilder(
                  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",
index dc811fc4a6fd7c842a3e10df96dba592a0be1ab6..2c44eaa107bceb1f8a696a70bbaae7b53d51cdc5 100644 (file)
@@ -80,6 +80,9 @@ class Browser : public WindowListObserver {
   // Hide the application.
   void Hide();
 
+  // Show the application.
+  void Show();
+
   // Bounce the dock icon.
   enum BounceType {
     BOUNCE_CRITICAL = 0,
index db898017b3d92d30cd04f692e07fc92eb73520fb..bf9c9ef69e8e46d59f463721488ee5cdad837a46 100644 (file)
@@ -22,6 +22,10 @@ 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)
index 808f5fabadc14d335cf991c10cb71731a03b2afa..4b5c6ee2a6a9ab29c4f51244abb702c95f319b92 100644 (file)
@@ -248,6 +248,10 @@ returning `false` in the `beforeunload` event handler.
 
 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