]> khamidou — GitHub mirrors - electron.git/commitdiff
win: Implement setSkipTaskbar.
authorCheng Zhao <zcbenz@gmail.com>
Mon, 16 Jun 2014 02:48:49 +0000 (10:48 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Mon, 16 Jun 2014 02:49:55 +0000 (10:49 +0800)
atom/browser/native_window_win.cc

index 828b282be5173fcc386a887fe7fc4085b84288c1..84b26e953ad8f20ed92453506a9c07563b360cc3 100644 (file)
@@ -4,6 +4,8 @@
 
 #include "atom/browser/native_window_win.h"
 
+#include <shobjidl.h>
+
 #include <string>
 #include <vector>
 
@@ -14,6 +16,7 @@
 #include "atom/common/options_switches.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/values.h"
+#include "base/win/scoped_comptr.h"
 #include "content/public/browser/native_web_keyboard_event.h"
 #include "content/public/browser/render_view_host.h"
 #include "content/public/browser/render_widget_host_view.h"
@@ -396,6 +399,15 @@ void NativeWindowWin::FlashFrame(bool flash) {
 }
 
 void NativeWindowWin::SetSkipTaskbar(bool skip) {
+  base::win::ScopedComPtr<ITaskbarList> taskbar;
+  if (FAILED(taskbar.CreateInstance(CLSID_TaskbarList, NULL,
+                                    CLSCTX_INPROC_SERVER)) ||
+      FAILED(taskbar->HrInit()))
+    return;
+  if (skip)
+    taskbar->DeleteTab(GetNativeWindow());
+  else
+    taskbar->AddTab(GetNativeWindow());
 }
 
 void NativeWindowWin::SetKiosk(bool kiosk) {