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

Unified Diff: ui/views/widget/widget.cc

Issue 11578014: Desktop aura: Expand what the ViewsDelegate can do to new windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to ToT Created 8 years 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/widget/widget.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/widget.cc
diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc
index 627e1cd17c5d2b792c988e985f78dc5c6bf6121b..644d1b91052f2db760a9c21f1f9404d68b44ab05 100644
--- a/ui/views/widget/widget.cc
+++ b/ui/views/widget/widget.cc
@@ -50,22 +50,12 @@ void BuildRootLayers(View* view, std::vector<ui::Layer*>* layers) {
// Create a native widget implementation.
// First, use the supplied one if non-NULL.
-// Second, ask the delegate.
// Finally, make a default one.
NativeWidget* CreateNativeWidget(NativeWidget* native_widget,
- internal::NativeWidgetDelegate* delegate,
- Widget::InitParams::Type type,
- gfx::NativeView parent,
- gfx::NativeView context) {
+ internal::NativeWidgetDelegate* delegate) {
if (!native_widget) {
- if (ViewsDelegate::views_delegate) {
- native_widget = ViewsDelegate::views_delegate->CreateNativeWidget(
- type, delegate, parent, context);
- }
- if (!native_widget) {
- native_widget =
- internal::NativeWidgetPrivate::CreateNativeWidget(delegate);
- }
+ native_widget =
+ internal::NativeWidgetPrivate::CreateNativeWidget(delegate);
}
return native_widget;
}
@@ -231,7 +221,12 @@ Widget::~Widget() {
// static
Widget* Widget::CreateWindow(WidgetDelegate* delegate) {
- return CreateWindowWithParentAndBounds(delegate, NULL, gfx::Rect());
+ Widget* widget = new Widget;
+ Widget::InitParams params;
+ params.delegate = delegate;
+ params.top_level = true;
+ widget->Init(params);
+ return widget;
}
// static
@@ -339,7 +334,11 @@ bool Widget::RequiresNonClientView(InitParams::Type type) {
type == InitParams::TYPE_BUBBLE;
}
-void Widget::Init(const InitParams& params) {
+void Widget::Init(const InitParams& in_params) {
+ InitParams params = in_params;
+ if (ViewsDelegate::views_delegate)
+ ViewsDelegate::views_delegate->OnBeforeWidgetInit(&params, this);
+
is_top_level_ = params.top_level ||
(!params.child &&
params.type != InitParams::TYPE_CONTROL &&
@@ -347,9 +346,8 @@ void Widget::Init(const InitParams& params) {
widget_delegate_ = params.delegate ?
params.delegate : new DefaultWidgetDelegate(this, params);
ownership_ = params.ownership;
- native_widget_ = CreateNativeWidget(
- params.native_widget, this, params.type, params.parent, params.context)->
- AsNativeWidgetPrivate();
+ native_widget_ = CreateNativeWidget(params.native_widget, this)->
+ AsNativeWidgetPrivate();
GetRootView();
default_theme_provider_.reset(new DefaultThemeProvider);
if (params.type == InitParams::TYPE_MENU) {
« no previous file with comments | « ui/views/widget/widget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698