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

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: review fixes 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..fcc42f42c09f1f526fc2dd7b5af977366e3f0b6d 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,7 +161,8 @@ 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::SetFocusChangeObserver(window_, this);
aura::client::SetActivationChangeObserver(window_, this);
@@ -219,7 +222,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 +242,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_);
sky 2013/03/15 03:15:05 What is the focus needed for?
scottmg 2013/03/15 22:23:46 The window_->Show has to be deferred until after t
+
aura::client::SetActivationDelegate(window_, this);
shadow_controller_.reset(
@@ -401,9 +413,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;
+ Hide(); // OnWindowHidingAnimationCompleted does the actual Close.
+ }
+ }
}
void DesktopNativeWidgetAura::CloseNow() {
@@ -416,7 +435,8 @@ void DesktopNativeWidgetAura::Show() {
}
void DesktopNativeWidgetAura::Hide() {
- desktop_root_window_host_->AsRootWindowHost()->Hide();
+ if (!pending_close_)
sky 2013/03/15 03:15:05 Ugh, this also means if you Hide() a window then a
scottmg 2013/03/15 22:23:46 I believe Hide() still works as before (or that's
+ desktop_root_window_host_->AsRootWindowHost()->Hide();
if (window_)
window_->Hide();
}
@@ -555,6 +575,10 @@ gfx::Size DesktopNativeWidgetAura::GetMaximumSize() const {
return native_widget_delegate_->GetMaximumSize();
}
+void DesktopNativeWidgetAura::SetHostTransitionBounds(const gfx::Rect& bounds) {
+ desktop_root_window_host_->AsRootWindowHost()->SetHostWindowExpansion(bounds);
+}
+
void DesktopNativeWidgetAura::OnBoundsChanged(const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) {
if (old_bounds.origin() != new_bounds.origin())
@@ -616,6 +640,11 @@ void DesktopNativeWidgetAura::OnWindowDestroyed() {
delete this;
}
+void DesktopNativeWidgetAura::OnWindowHidingAnimationCompleted() {
+ if (pending_close_)
+ desktop_root_window_host_->Close();
+}
+
void DesktopNativeWidgetAura::OnWindowTargetVisibilityChanged(bool visible) {
}

Powered by Google App Engine
This is Rietveld 408576698