diff options
-rw-r--r-- | chrome/browser/ui/views/message_center/message_center_widget_delegate.cc | 12 | ||||
-rw-r--r-- | ui/message_center/message_center.gyp | 8 | ||||
-rw-r--r-- | ui/message_center/views/toast_contents_view.cc | 13 |
3 files changed, 33 insertions, 0 deletions
diff --git a/chrome/browser/ui/views/message_center/message_center_widget_delegate.cc b/chrome/browser/ui/views/message_center/message_center_widget_delegate.cc index b273c44..57beed4 100644 --- a/chrome/browser/ui/views/message_center/message_center_widget_delegate.cc +++ b/chrome/browser/ui/views/message_center/message_center_widget_delegate.cc @@ -22,6 +22,10 @@ #include "ui/views/win/hwnd_util.h" #endif +#if defined(USE_ASH) +#include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" +#endif + namespace message_center { MessageCenterWidgetDelegate::MessageCenterWidgetDelegate( @@ -135,6 +139,14 @@ void MessageCenterWidgetDelegate::InitWidget() { params.delegate = this; params.keep_on_top = true; params.top_level = true; +#if defined(USE_ASH) + // This class is not used in Ash; there is another container for the message + // center that's used there. So, we must be in a Views + Ash environment. We + // want the notification center to be available on both desktops. Setting the + // |native_widget| variable here ensures that the widget is hosted on the + // native desktop. + params.native_widget = new views::DesktopNativeWidgetAura(widget); +#endif widget->Init(params); #if defined(OS_WIN) diff --git a/ui/message_center/message_center.gyp b/ui/message_center/message_center.gyp index 42d0aef..431ef9e 100644 --- a/ui/message_center/message_center.gyp +++ b/ui/message_center/message_center.gyp @@ -98,6 +98,14 @@ # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. 'msvs_disabled_warnings': [ 4267, ], 'conditions': [ + # This condition is for Windows 8 Metro mode support. We need to + # specify a particular desktop during widget creation in that case. + # This is done using the desktop aura native widget framework. + ['use_ash==1 and OS=="win"', { + 'dependencies': [ + '../aura/aura.gyp:aura', + ], + }], ['toolkit_views==1', { 'dependencies': [ '../events/events.gyp:events', diff --git a/ui/message_center/views/toast_contents_view.cc b/ui/message_center/views/toast_contents_view.cc index 1ca3ed0..a1bc34f 100644 --- a/ui/message_center/views/toast_contents_view.cc +++ b/ui/message_center/views/toast_contents_view.cc @@ -24,6 +24,10 @@ #include "ui/views/widget/widget.h" #include "ui/views/widget/widget_delegate.h" +#if defined(OS_WIN) && defined(USE_ASH) +#include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" +#endif + namespace message_center { namespace { @@ -79,6 +83,15 @@ views::Widget* ToastContentsView::CreateWidget(gfx::NativeView parent) { params.delegate = this; views::Widget* widget = new views::Widget(); widget->set_focus_on_creation(false); + +#if defined(OS_WIN) && defined(USE_ASH) + // We want to ensure that this toast always goes to the native desktop, + // not the Ash desktop (since there is already another toast contents view + // there. + if (!params.parent) + params.native_widget = new views::DesktopNativeWidgetAura(widget); +#endif + widget->Init(params); return widget; } |