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

Unified Diff: views/widget/native_widget_aura.cc

Issue 8194004: change the way windows are parented when their parent is set to NULL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 | « views/views.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/widget/native_widget_aura.cc
===================================================================
--- views/widget/native_widget_aura.cc (revision 104542)
+++ views/widget/native_widget_aura.cc (working copy)
@@ -8,6 +8,7 @@
#include "ui/aura/desktop.h"
#include "ui/aura/event.h"
#include "ui/aura/window.h"
+#include "ui/aura/window_types.h"
#include "ui/base/ui_base_types.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/compositor/layer.h"
@@ -29,6 +30,30 @@
namespace views {
+namespace {
+
+int GetAuraWindowTypeForWidgetType(Widget::InitParams::Type type) {
+ switch (type) {
+ case Widget::InitParams::TYPE_WINDOW:
+ case Widget::InitParams::TYPE_WINDOW_FRAMELESS:
+ case Widget::InitParams::TYPE_POPUP:
+ case Widget::InitParams::TYPE_BUBBLE:
+ return aura::kWindowType_Toplevel;
+ case Widget::InitParams::TYPE_CONTROL:
+ return aura::kWindowType_Control;
+ case Widget::InitParams::TYPE_MENU:
+ return aura::kWindowType_Menu;
+ case Widget::InitParams::TYPE_TOOLTIP:
+ return aura::kWindowType_Tooltip;
+ default:
+ NOTREACHED();
+ break;
+ }
+ return aura::kWindowType_Toplevel;
+}
+
+} // namespace
+
////////////////////////////////////////////////////////////////////////////////
// NativeWidgetAura, public:
@@ -67,12 +92,14 @@
void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) {
ownership_ = params.ownership;
window_->set_user_data(this);
+ window_->SetType(GetAuraWindowTypeForWidgetType(params.type));
window_->Init();
// TODO(beng): respect |params| authoritah wrt transparency.
window_->layer()->SetFillsBoundsOpaquely(false);
delegate_->OnNativeWidgetCreated();
window_->SetBounds(params.bounds);
- window_->SetParent(params.parent);
+ window_->SetParent(
+ params.type == Widget::InitParams::TYPE_MENU ? NULL : params.parent);
// TODO(beng): do this some other way.
delegate_->OnNativeWidgetSizeChanged(params.bounds.size());
can_activate_ = params.can_activate;
@@ -547,7 +574,7 @@
aura::Window* toplevel = native_view;
aura::Window* parent = native_view->parent();
while (parent) {
- if (parent->IsToplevelWindowContainer())
+ if (parent->AsToplevelWindowContainer())
return GetNativeWidgetForNativeView(toplevel);
toplevel = parent;
parent = parent->parent();
« no previous file with comments | « views/views.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698