Chromium Code Reviews| Index: views/widget/native_widget_aura.cc |
| diff --git a/views/widget/native_widget_aura.cc b/views/widget/native_widget_aura.cc |
| index 11fcb076f8cf1dc2c295e175dc165dfca9341707..4b858fbcd5155ff58e85f4c94857b904b949af11 100644 |
| --- a/views/widget/native_widget_aura.cc |
| +++ b/views/widget/native_widget_aura.cc |
| @@ -31,7 +31,28 @@ |
| namespace views { |
| -const char* const NativeWidgetAura::kWindowTypeKey = "WindowType"; |
| +namespace { |
| + |
| +aura::WindowType GetAuraWindowTypeForWidgetType(Widget::InitParams::Type type) { |
| + switch (type) { |
| + case Widget::InitParams::TYPE_WINDOW: |
| + return aura::WINDOW_TYPE_NORMAL; |
| + case Widget::InitParams::TYPE_WINDOW_FRAMELESS: |
| + case Widget::InitParams::TYPE_CONTROL: |
| + case Widget::InitParams::TYPE_POPUP: |
| + case Widget::InitParams::TYPE_BUBBLE: |
| + return aura::WINDOW_TYPE_POPUP; |
| + case Widget::InitParams::TYPE_MENU: |
| + return aura::WINDOW_TYPE_MENU; |
| + case Widget::InitParams::TYPE_TOOLTIP: |
| + return aura::WINDOW_TYPE_TOOLTIP; |
| + default: |
| + NOTREACHED() << "Unhandled widget type " << type; |
| + return aura::WINDOW_TYPE_UNKNOWN; |
| + } |
| +} |
| + |
| +} // namespace |
| //////////////////////////////////////////////////////////////////////////////// |
| // NativeWidgetAura, public: |
| @@ -73,11 +94,13 @@ void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) { |
| window_->set_user_data(this); |
| Widget::InitParams::Type window_type = |
| params.child ? Widget::InitParams::TYPE_CONTROL : params.type; |
| - SetNativeWindowProperty(kWindowTypeKey, reinterpret_cast<void*>(window_type)); |
| - window_->SetType(window_type == Widget::InitParams::TYPE_CONTROL ? |
| - aura::kWindowType_Control : aura::kWindowType_None); |
| + window_->SetType(GetAuraWindowTypeForWidgetType(window_type)); |
| window_->Init(params.create_texture_for_layer ? |
| - ui::Layer::LAYER_HAS_TEXTURE : ui::Layer::LAYER_HAS_NO_TEXTURE); |
| + ui::Layer::LAYER_HAS_TEXTURE : |
|
Ben Goodger (Google)
2011/10/31 17:59:48
these lines should be indent 2 more spaces
Daniel Erat
2011/10/31 19:48:18
I always go back and forth between 2 and 4 in the
|
| + ui::Layer::LAYER_HAS_NO_TEXTURE, |
| + window_type == Widget::InitParams::TYPE_CONTROL ? |
| + aura::Window::LAYER_INITIALLY_VISIBLE : |
|
Ben Goodger (Google)
2011/10/31 17:59:48
It really pains to add an extra parameter to every
Daniel Erat
2011/10/31 19:48:18
It pained me to update all the callers too. :-P I
|
| + aura::Window::LAYER_INITIALLY_INVISIBLE); |
| // TODO(beng): respect |params| authoritah wrt transparency. |
| window_->layer()->SetFillsBoundsOpaquely(false); |
| delegate_->OnNativeWidgetCreated(); |