]> khamidou — GitHub mirrors - electron.git/commitdiff
First hack at setting the window icon overlay
authorPaul Betts <paul@paulbetts.org>
Fri, 6 Feb 2015 23:58:49 +0000 (15:58 -0800)
committerPaul Betts <paul@paulbetts.org>
Fri, 6 Feb 2015 23:58:49 +0000 (15:58 -0800)
atom/browser/native_window_views.cc
atom/browser/native_window_views.h

index 09fd351f42772ad58917904fdefc51f824b8340f..db4090b269a90e580ee70f1affef72fb6c3ebbf8 100644 (file)
@@ -613,6 +613,22 @@ void NativeWindowViews::SetProgressBar(double progress) {
 #endif
 }
 
+void NativeWindowViews::SetOverlayIcon(gfx::ImageSkia& overlay, std::string& description) {
+#if defined(OS_WIN)
+  if (base::win::GetVersion() < base::win::VERSION_WIN7)
+    return;
+
+  base::win::ScopedComPtr<ITaskbarList3> taskbar;
+  if (FAILED(taskbar.CreateInstance(CLSID_TaskbarList, NULL,
+                                    CLSCTX_INPROC_SERVER) ||
+      FAILED(taskbar->HrInit()))) {
+    return;
+  }
+  HWND frame = views::HWNDForNativeWindow(GetNativeWindow());
+  taskbar->SetOverlayIcon(frame, IconUtil::CreateHICONFromSkiaBitmap(overlay.AsBitmap()), description);
+#endif
+}
+
 void NativeWindowViews::SetAutoHideMenuBar(bool auto_hide) {
   menu_bar_autohide_ = auto_hide;
 }
index 2066d4e603d1ec30f5a2865c578fa0840d2c5a7d..e5fb863283585a08d912dc6c5348c0cede5ed4f3 100644 (file)
@@ -73,6 +73,7 @@ class NativeWindowViews : public NativeWindow,
   bool IsKiosk() override;
   void SetMenu(ui::MenuModel* menu_model) override;
   gfx::NativeWindow GetNativeWindow() override;
+  void SetOverlayIcon(gfx::ImageSkia& overlay, std::string& description) override;
   void SetProgressBar(double value) override;
   void SetAutoHideMenuBar(bool auto_hide) override;
   bool IsMenuBarAutoHide() override;