Support tooltips in ash windows
commitdbc7b185c842f56d205808c8b6924c1b7037955b
authorcpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Fri, 2 Nov 2012 18:18:16 +0000 (2 18:18 +0000)
committercpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Fri, 2 Nov 2012 18:18:16 +0000 (2 18:18 +0000)
tree7ce2bc5670c6c84c84e4d248770e53d5fc56af51
parent8409ad041c6c0d50a4ee6c07121751e3fbf07b45
Support tooltips in ash windows

In windows ash mode, if a tooltip is going to be presented we end up
creating a desktop widget which is incorrect. The issue at hand
is the widget selection here:

views::NativeWidget* ChromeViewsDelegate::CreateNativeWidget(
   views::Widget::InitParams::Type type,
   views::internal::NativeWidgetDelegate* delegate,

   gfx::NativeView parent) {
  if (parent && type != views::Widget::InitParams::TYPE_MENU)
    return new views::NativeWidgetAura(delegate);

  if (chrome::GetHostDesktopTypeForNativeView(parent) == chrome::HOST_DESKTOP_TYPE_NATIVE)
    return new views::DesktopNativeWidgetAura(delegate);
  return NULL;
}

For a tooltip the |parent| is null and that ends up returning a
views::DesktopNativeWidgetAura which is wrong and causes a crash. In ash
we need to return NativeWidgetAura

The alternative to this change is to have GetHostDesktopTypeForNativeView()
return not chrome::HOST_DESKTOP_TYPE_NATIVE.

BUG=151718
TEST= hover on the page tumbnails in the NTP and see the tooltips
Review URL: https://codereview.chromium.org/11344048

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165709 0039d316-1c4b-4281-b951-d872f2087c98
ash/tooltips/tooltip_controller.cc
ash/tooltips/tooltip_controller.h
ash/tooltips/tooltip_controller_unittest.cc