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

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

Issue 12342028: make menus, bubbles, etc. top level windows on aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add animation_host.* Created 7 years, 9 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
Index: ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
index 75eceb54bc15c8c3a3e6e3879db5c1b7eef32e5b..be30f88ede1fb07cbd7d4035b206da1ee4516e91 100644
--- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
+++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
@@ -24,6 +24,8 @@
#include "ui/views/corewm/shadow_controller.h"
#include "ui/views/corewm/shadow_types.h"
#include "ui/views/corewm/tooltip_controller.h"
+#include "ui/views/corewm/visibility_controller.h"
+#include "ui/views/corewm/window_animations.h"
#include "ui/views/drag_utils.h"
#include "ui/views/ime/input_method.h"
#include "ui/views/ime/input_method_bridge.h"
@@ -159,8 +161,10 @@ DesktopNativeWidgetAura::DesktopNativeWidgetAura(
ALLOW_THIS_IN_INITIALIZER_LIST(window_(new aura::Window(this))),
native_widget_delegate_(delegate),
last_drop_operation_(ui::DragDropTypes::DRAG_NONE),
- restore_focus_on_activate_(false) {
+ restore_focus_on_activate_(false),
+ pending_close_(false) {
window_->SetProperty(kDesktopNativeWidgetAuraKey, this);
+ aura::client::SetAnimationHost(window_, this);
aura::client::SetFocusChangeObserver(window_, this);
aura::client::SetActivationChangeObserver(window_, this);
}
@@ -219,7 +223,6 @@ void DesktopNativeWidgetAura::InitNativeWidget(
window_->SetTransparent(true);
window_->Init(params.layer_type);
corewm::SetShadowType(window_, corewm::SHADOW_TYPE_NONE);
- window_->Show();
desktop_root_window_host_ = params.desktop_root_window_host ?
params.desktop_root_window_host :
@@ -240,6 +243,16 @@ void DesktopNativeWidgetAura::InitNativeWidget(
tooltip_controller_.get());
root_window_->AddPreTargetHandler(tooltip_controller_.get());
+ if (params.type != Widget::InitParams::TYPE_WINDOW) {
+ visibility_controller_.reset(new views::corewm::VisibilityController);
+ aura::client::SetVisibilityClient(GetNativeView()->GetRootWindow(),
+ visibility_controller_.get());
+ views::corewm::SetChildWindowVisibilityChangesAnimated(
+ GetNativeView()->GetRootWindow());
+ }
+ window_->Show();
+ desktop_root_window_host_->InitFocus(window_);
+
aura::client::SetActivationDelegate(window_, this);
shadow_controller_.reset(
@@ -401,9 +414,16 @@ void DesktopNativeWidgetAura::SetShape(gfx::NativeRegion shape) {
}
void DesktopNativeWidgetAura::Close() {
- desktop_root_window_host_->Close();
- if (window_)
+ if (window_) {
window_->SuppressPaint();
+ if (window_->type() == aura::client::WINDOW_TYPE_NORMAL ||
+ views::corewm::WindowAnimationsDisabled(window_)) {
+ desktop_root_window_host_->Close();
+ } else {
+ pending_close_ = true;
sky 2013/03/18 15:49:42 Do you end up in this code path on linux?
+ Hide(); // OnWindowHidingAnimationCompleted does the actual Close.
+ }
+ }
}
void DesktopNativeWidgetAura::CloseNow() {
@@ -416,7 +436,8 @@ void DesktopNativeWidgetAura::Show() {
}
void DesktopNativeWidgetAura::Hide() {
- desktop_root_window_host_->AsRootWindowHost()->Hide();
+ if (!pending_close_)
+ desktop_root_window_host_->AsRootWindowHost()->Hide();
if (window_)
window_->Hide();
}
@@ -635,6 +656,18 @@ scoped_refptr<ui::Texture> DesktopNativeWidgetAura::CopyTexture() {
}
////////////////////////////////////////////////////////////////////////////////
+// DesktopNativeWidgetAura, aura::WindowAnimationHost implementation:
+
+void DesktopNativeWidgetAura::SetHostTransitionBounds(const gfx::Rect& bounds) {
sky 2013/03/18 15:49:42 If this is only applicable to windows, should we i
scottmg 2013/03/18 21:47:48 Ah, that seems better, removes all the empty/NOTIM
+ desktop_root_window_host_->AsRootWindowHost()->SetHostWindowExpansion(bounds);
+}
+
+void DesktopNativeWidgetAura::OnWindowHidingAnimationCompleted() {
+ if (pending_close_)
+ desktop_root_window_host_->Close();
+}
+
+////////////////////////////////////////////////////////////////////////////////
// DesktopNativeWidgetAura, ui::EventHandler implementation:
void DesktopNativeWidgetAura::OnKeyEvent(ui::KeyEvent* event) {

Powered by Google App Engine
This is Rietveld 408576698