Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Unified Diff: ui/views/test/desktop_test_views_delegate.cc

Issue 11758002: Desktop aura: Expand what the ViewsDelegate can do to new windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Don't clobber native_widget Created 7 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/test/desktop_test_views_delegate.h ('k') | ui/views/test/test_views_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/test/desktop_test_views_delegate.cc
diff --git a/ui/views/test/desktop_test_views_delegate.cc b/ui/views/test/desktop_test_views_delegate.cc
index fedcb79d11be346237b1daae5205762e16b1b191..4dc0bb579fa27ccb8398dbdecc43c9dffd287929 100644
--- a/ui/views/test/desktop_test_views_delegate.cc
+++ b/ui/views/test/desktop_test_views_delegate.cc
@@ -13,20 +13,21 @@ DesktopTestViewsDelegate::DesktopTestViewsDelegate() {}
DesktopTestViewsDelegate::~DesktopTestViewsDelegate() {}
-NativeWidget* DesktopTestViewsDelegate::CreateNativeWidget(
- Widget::InitParams::Type type,
- internal::NativeWidgetDelegate* delegate,
- gfx::NativeView parent,
- gfx::NativeView context) {
+void DesktopTestViewsDelegate::OnBeforeWidgetInit(
+ Widget::InitParams* params,
+ internal::NativeWidgetDelegate* delegate) {
#if defined(USE_AURA) && !defined(OS_CHROMEOS)
- if (parent && type != views::Widget::InitParams::TYPE_MENU)
- return new views::NativeWidgetAura(delegate);
-
- if (!parent && !context)
- return new views::DesktopNativeWidgetAura(delegate);
+ // If we already have a native_widget, we don't have to try to come
+ // up with one.
+ if (params->native_widget)
+ return;
+
+ if (params->parent && params->type != views::Widget::InitParams::TYPE_MENU) {
+ params->native_widget = new views::NativeWidgetAura(delegate);
+ } else if (!params->parent && !params->context) {
+ params->native_widget = new views::DesktopNativeWidgetAura(delegate);
+ }
#endif
-
- return NULL;
}
} // namespace views
« no previous file with comments | « ui/views/test/desktop_test_views_delegate.h ('k') | ui/views/test/test_views_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698