Chromium Code Reviews| Index: ash/wm/workspace/phantom_window_controller.cc |
| diff --git a/ash/wm/workspace/phantom_window_controller.cc b/ash/wm/workspace/phantom_window_controller.cc |
| index 99861fdb3bd2ff041b58e6622ee95e4d2db97402..86cfc9290708bee651536d2752c7d71ec9e2b7c0 100644 |
| --- a/ash/wm/workspace/phantom_window_controller.cc |
| +++ b/ash/wm/workspace/phantom_window_controller.cc |
| @@ -72,7 +72,9 @@ class EdgePainter : public views::Painter { |
| } // namespace |
| PhantomWindowController::PhantomWindowController(aura::Window* window) |
| - : window_(window) { |
| + : window_(window), |
| + phantom_below_window_(NULL), |
| + phantom_widget_(NULL) { |
| } |
| PhantomWindowController::~PhantomWindowController() { |
| @@ -83,7 +85,7 @@ void PhantomWindowController::Show(const gfx::Rect& bounds) { |
| if (bounds == bounds_) |
| return; |
| bounds_ = bounds; |
| - if (!phantom_widget_.get()) { |
| + if (!phantom_widget_) { |
| // Show the phantom at the bounds of the window. We'll animate to the target |
| // bounds. |
| start_bounds_ = window_->GetBoundsInScreen(); |
| @@ -103,11 +105,12 @@ void PhantomWindowController::SetBounds(const gfx::Rect& bounds) { |
| } |
| void PhantomWindowController::Hide() { |
| - phantom_widget_.reset(); |
| + phantom_widget_->Close(); |
| + phantom_widget_ = NULL; |
| } |
| bool PhantomWindowController::IsShowing() const { |
| - return phantom_widget_.get() != NULL; |
| + return phantom_widget_ != NULL; |
| } |
| void PhantomWindowController::AnimationProgressed( |
| @@ -117,8 +120,8 @@ void PhantomWindowController::AnimationProgressed( |
| } |
| void PhantomWindowController::CreatePhantomWidget(const gfx::Rect& bounds) { |
| - DCHECK(!phantom_widget_.get()); |
| - phantom_widget_.reset(new views::Widget); |
| + DCHECK(!phantom_widget_); |
| + phantom_widget_ = new views::Widget; |
| views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
| params.transparent = true; |
| params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
|
sky
2012/08/03 19:42:00
This needs to change, otherwise we're going to lea
Mr4D (OOO till 08-26)
2012/08/03 20:39:28
Ahhh. Interesting! Thanks for figuring that out! D
|
| @@ -139,7 +142,10 @@ void PhantomWindowController::CreatePhantomWidget(const gfx::Rect& bounds) { |
| views::Background::CreateBackgroundPainter(true, new EdgePainter)); |
| phantom_widget_->SetContentsView(content_view); |
| phantom_widget_->SetBounds(bounds); |
| - phantom_widget_->StackAbove(window_); |
| + if (phantom_below_window_) |
| + phantom_widget_->StackBelow(phantom_below_window_); |
| + else |
| + phantom_widget_->StackAbove(window_); |
| phantom_widget_->Show(); |
| // Fade the window in. |
| ui::Layer* layer = phantom_widget_->GetNativeWindow()->layer(); |