Commit 2c7e41c4 authored by mgiuca@chromium.org's avatar mgiuca@chromium.org

Windows: Top-level bubbles no longer appear on taskbar by default.

On Windows, Widget::InitParams::force_show_in_taskbar is now respected,
so it is possible to override the default without having to directly set
HWND properties.

This should not change any behaviour (just a refactor).

Previously, we had a special case where the message center would turn
off showing in taskbar, and app launcher would turn it off for <= Vista.
Now we have just one special case: app launcher turns it on for >= Win7.

BUG=332277

Review URL: https://codereview.chromium.org/127133003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243857 0039d316-1c4b-4281-b951-d872f2087c98
parent c522f4bc
......@@ -263,15 +263,6 @@ void CreateAppListShortcuts(
// Customizes the app list |hwnd| for Windows (eg: disable aero peek, set up
// restart params).
void SetWindowAttributes(HWND hwnd) {
// Vista and lower do not offer pinning to the taskbar, which makes any
// presence on the taskbar useless. So, hide the window on the taskbar
// for these versions of Windows.
if (base::win::GetVersion() <= base::win::VERSION_VISTA) {
LONG_PTR ex_styles = GetWindowLongPtr(hwnd, GWL_EXSTYLE);
ex_styles |= WS_EX_TOOLWINDOW;
SetWindowLongPtr(hwnd, GWL_EXSTYLE, ex_styles);
}
if (base::win::GetVersion() > base::win::VERSION_VISTA) {
// Disable aero peek. Without this, hovering over the taskbar popup puts
// Windows into a mode for switching between windows in the same
......
......@@ -149,14 +149,6 @@ void MessageCenterWidgetDelegate::InitWidget() {
#endif
widget->Init(params);
#if defined(OS_WIN)
// Remove the Message Center from taskbar and alt-tab rotation.
HWND hwnd = views::HWNDForWidget(widget);
LONG_PTR ex_styles = ::GetWindowLongPtr(hwnd, GWL_EXSTYLE);
ex_styles |= WS_EX_TOOLWINDOW;
::SetWindowLongPtr(hwnd, GWL_EXSTYLE, ex_styles);
#endif
widget->AddObserver(this);
widget->StackAtTop();
widget->SetAlwaysOnTop(true);
......
......@@ -6,6 +6,7 @@
#include "base/command_line.h"
#include "base/strings/string_util.h"
#include "base/win/windows_version.h"
#include "ui/app_list/app_list_constants.h"
#include "ui/app_list/app_list_model.h"
#include "ui/app_list/app_list_view_delegate.h"
......@@ -325,7 +326,13 @@ void AppListView::OnBeforeBubbleWidgetInit(
if (delegate_ && delegate_->ForceNativeDesktop())
params->native_widget = new views::DesktopNativeWidgetAura(widget);
#endif
#if defined(OS_LINUX)
#if defined(OS_WIN)
// Windows 7 and higher offer pinning to the taskbar, but we need presence
// on the taskbar for the user to be able to pin us. So, show the window on
// the taskbar for these versions of Windows.
if (base::win::GetVersion() >= base::win::VERSION_WIN7)
params->force_show_in_taskbar = true;
#elif defined(OS_LINUX)
// Set up a custom WM_CLASS for the app launcher window. This allows task
// switchers in X11 environments to distinguish it from main browser windows.
params->wm_class_name = kAppListWMClass;
......
......@@ -227,8 +227,6 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
gfx::NativeView context;
// If true, forces the window to be shown in the taskbar, even for window
// types that do not appear in the taskbar by default (popup and bubble).
// Currently only used by X11.
// TODO(mgiuca): Respect this flag in Windows (http://crbug.com/332277).
bool force_show_in_taskbar;
// Only used by X11, for root level windows. Specifies the res_name and
// res_class fields, respectively, of the WM_CLASS window property. Controls
......
......@@ -122,10 +122,13 @@ void CalculateWindowStylesFromInitParams(
case Widget::InitParams::TYPE_BUBBLE:
*style |= WS_POPUP;
*style |= WS_CLIPCHILDREN;
if (!params.force_show_in_taskbar)
*ex_style |= WS_EX_TOOLWINDOW;
break;
case Widget::InitParams::TYPE_POPUP:
*style |= WS_POPUP;
*ex_style |= WS_EX_TOOLWINDOW;
if (!params.force_show_in_taskbar)
*ex_style |= WS_EX_TOOLWINDOW;
break;
case Widget::InitParams::TYPE_MENU:
*style |= WS_POPUP;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment