From a15ee1871a1ac08ddaf9cd366a2b201b10b5225a Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 21 Jul 2014 22:03:58 +0800 Subject: [PATCH] win: Implement SetSkipTaskbar. --- atom/browser/native_window_views.cc | 24 +++++++++++++++++++++++- atom/browser/native_window_views.h | 2 ++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/atom/browser/native_window_views.cc b/atom/browser/native_window_views.cc index 981b150301c..73b691edb13 100644 --- a/atom/browser/native_window_views.cc +++ b/atom/browser/native_window_views.cc @@ -4,6 +4,10 @@ #include "atom/browser/native_window_views.h" +#if defined(OS_WIN) +#include +#endif + #include #include @@ -16,6 +20,8 @@ #include "content/public/browser/native_web_keyboard_event.h" #include "content/public/browser/web_contents_view.h" #include "native_mate/dictionary.h" +#include "ui/aura/window.h" +#include "ui/aura/window_tree_host.h" #include "ui/base/hit_test.h" #include "ui/gfx/image/image.h" #include "ui/gfx/image/image_skia.h" @@ -30,6 +36,7 @@ #include "atom/browser/ui/views/linux_frame_view.h" #elif defined(OS_WIN) #include "atom/browser/ui/views/win_frame_view.h" +#include "base/win/scoped_comptr.h" #endif namespace atom { @@ -92,9 +99,12 @@ NativeWindowViews::NativeWindowViews(content::WebContents* web_contents, params.remove_standard_frame = true; #endif +#if defined(USE_X11) + // FIXME Find out how to do this dynamically on Linux. bool skip_taskbar = false; if (options.Get(switches::kSkipTaskbar, &skip_taskbar) && skip_taskbar) params.type = views::Widget::InitParams::TYPE_BUBBLE; +#endif window_->Init(params); @@ -268,7 +278,15 @@ void NativeWindowViews::FlashFrame(bool flash) { void NativeWindowViews::SetSkipTaskbar(bool skip) { #if defined(OS_WIN) - // FIXME + base::win::ScopedComPtr taskbar; + if (FAILED(taskbar.CreateInstance(CLSID_TaskbarList, NULL, + CLSCTX_INPROC_SERVER)) || + FAILED(taskbar->HrInit())) + return; + if (skip) + taskbar->DeleteTab(GetAcceleratedWidget()); + else + taskbar->AddTab(GetAcceleratedWidget()); #endif } @@ -315,6 +333,10 @@ gfx::NativeWindow NativeWindowViews::GetNativeWindow() { return window_->GetNativeWindow(); } +gfx::AcceleratedWidget NativeWindowViews::GetAcceleratedWidget() { + return GetNativeWindow()->GetHost()->GetAcceleratedWidget(); +} + void NativeWindowViews::UpdateDraggableRegions( const std::vector& regions) { if (has_frame_) diff --git a/atom/browser/native_window_views.h b/atom/browser/native_window_views.h index d4db4934e4c..57a92534b10 100644 --- a/atom/browser/native_window_views.h +++ b/atom/browser/native_window_views.h @@ -72,6 +72,8 @@ class NativeWindowViews : public NativeWindow, virtual void SetMenu(ui::MenuModel* menu_model) OVERRIDE; virtual gfx::NativeWindow GetNativeWindow() OVERRIDE; + gfx::AcceleratedWidget GetAcceleratedWidget(); + SkRegion* draggable_region() const { return draggable_region_.get(); } views::Widget* widget() const { return window_.get(); }