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

Side by Side Diff: ui/views/widget/widget.cc

Issue 12212136: Ensures Widget::InitParams::top_level is set correctly before calling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/views/test/test_views_delegate.h ('k') | ui/views/widget/widget_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/widget/widget.h" 5 #include "ui/views/widget/widget.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "ui/base/events/event.h" 10 #include "ui/base/events/event.h"
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 331
332 // static 332 // static
333 bool Widget::RequiresNonClientView(InitParams::Type type) { 333 bool Widget::RequiresNonClientView(InitParams::Type type) {
334 return type == InitParams::TYPE_WINDOW || 334 return type == InitParams::TYPE_WINDOW ||
335 type == InitParams::TYPE_PANEL || 335 type == InitParams::TYPE_PANEL ||
336 type == InitParams::TYPE_BUBBLE; 336 type == InitParams::TYPE_BUBBLE;
337 } 337 }
338 338
339 void Widget::Init(const InitParams& in_params) { 339 void Widget::Init(const InitParams& in_params) {
340 InitParams params = in_params; 340 InitParams params = in_params;
341 if (ViewsDelegate::views_delegate)
342 ViewsDelegate::views_delegate->OnBeforeWidgetInit(&params, this);
343 341
344 is_top_level_ = params.top_level || 342 is_top_level_ = params.top_level ||
345 (!params.child && 343 (!params.child &&
346 params.type != InitParams::TYPE_CONTROL && 344 params.type != InitParams::TYPE_CONTROL &&
347 params.type != InitParams::TYPE_TOOLTIP); 345 params.type != InitParams::TYPE_TOOLTIP);
346 params.top_level = is_top_level_;
347
348 if (ViewsDelegate::views_delegate)
349 ViewsDelegate::views_delegate->OnBeforeWidgetInit(&params, this);
350
348 widget_delegate_ = params.delegate ? 351 widget_delegate_ = params.delegate ?
349 params.delegate : new DefaultWidgetDelegate(this, params); 352 params.delegate : new DefaultWidgetDelegate(this, params);
350 ownership_ = params.ownership; 353 ownership_ = params.ownership;
351 native_widget_ = CreateNativeWidget(params.native_widget, this)-> 354 native_widget_ = CreateNativeWidget(params.native_widget, this)->
352 AsNativeWidgetPrivate(); 355 AsNativeWidgetPrivate();
353 GetRootView(); 356 GetRootView();
354 default_theme_provider_.reset(new DefaultThemeProvider); 357 default_theme_provider_.reset(new DefaultThemeProvider);
355 if (params.type == InitParams::TYPE_MENU) { 358 if (params.type == InitParams::TYPE_MENU) {
356 is_mouse_button_pressed_ = 359 is_mouse_button_pressed_ =
357 internal::NativeWidgetPrivate::IsMouseButtonDown(); 360 internal::NativeWidgetPrivate::IsMouseButtonDown();
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after
1414 1417
1415 //////////////////////////////////////////////////////////////////////////////// 1418 ////////////////////////////////////////////////////////////////////////////////
1416 // internal::NativeWidgetPrivate, NativeWidget implementation: 1419 // internal::NativeWidgetPrivate, NativeWidget implementation:
1417 1420
1418 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { 1421 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() {
1419 return this; 1422 return this;
1420 } 1423 }
1421 1424
1422 } // namespace internal 1425 } // namespace internal
1423 } // namespace views 1426 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/test/test_views_delegate.h ('k') | ui/views/widget/widget_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698