| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/wm/workspace/phantom_window_controller.h" | 5 #include "ash/wm/workspace/phantom_window_controller.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/shell_window_ids.h" | 8 #include "ash/shell_window_ids.h" |
| 9 #include "third_party/skia/include/core/SkCanvas.h" | 9 #include "third_party/skia/include/core/SkCanvas.h" |
| 10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 SkIntToScalar(kRoundRectSize), paint); | 65 SkIntToScalar(kRoundRectSize), paint); |
| 66 } | 66 } |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 DISALLOW_COPY_AND_ASSIGN(EdgePainter); | 69 DISALLOW_COPY_AND_ASSIGN(EdgePainter); |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 } // namespace | 72 } // namespace |
| 73 | 73 |
| 74 PhantomWindowController::PhantomWindowController(aura::Window* window) | 74 PhantomWindowController::PhantomWindowController(aura::Window* window) |
| 75 : window_(window) { | 75 : window_(window), |
| 76 phantom_below_window_(NULL) { |
| 76 } | 77 } |
| 77 | 78 |
| 78 PhantomWindowController::~PhantomWindowController() { | 79 PhantomWindowController::~PhantomWindowController() { |
| 79 Hide(); | 80 Hide(); |
| 80 } | 81 } |
| 81 | 82 |
| 82 void PhantomWindowController::Show(const gfx::Rect& bounds) { | 83 void PhantomWindowController::Show(const gfx::Rect& bounds) { |
| 83 if (bounds == bounds_) | 84 if (bounds == bounds_) |
| 84 return; | 85 return; |
| 85 bounds_ = bounds; | 86 bounds_ = bounds; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 params.keep_on_top = true; | 133 params.keep_on_top = true; |
| 133 phantom_widget_->set_focus_on_creation(false); | 134 phantom_widget_->set_focus_on_creation(false); |
| 134 phantom_widget_->Init(params); | 135 phantom_widget_->Init(params); |
| 135 phantom_widget_->SetVisibilityChangedAnimationsEnabled(false); | 136 phantom_widget_->SetVisibilityChangedAnimationsEnabled(false); |
| 136 phantom_widget_->GetNativeWindow()->SetName("PhantomWindow"); | 137 phantom_widget_->GetNativeWindow()->SetName("PhantomWindow"); |
| 137 views::View* content_view = new views::View; | 138 views::View* content_view = new views::View; |
| 138 content_view->set_background( | 139 content_view->set_background( |
| 139 views::Background::CreateBackgroundPainter(true, new EdgePainter)); | 140 views::Background::CreateBackgroundPainter(true, new EdgePainter)); |
| 140 phantom_widget_->SetContentsView(content_view); | 141 phantom_widget_->SetContentsView(content_view); |
| 141 phantom_widget_->SetBounds(bounds); | 142 phantom_widget_->SetBounds(bounds); |
| 142 phantom_widget_->StackAbove(window_); | 143 if (phantom_below_window_) |
| 144 phantom_widget_->StackBelow(phantom_below_window_); |
| 145 else |
| 146 phantom_widget_->StackAbove(window_); |
| 143 phantom_widget_->Show(); | 147 phantom_widget_->Show(); |
| 144 // Fade the window in. | 148 // Fade the window in. |
| 145 ui::Layer* layer = phantom_widget_->GetNativeWindow()->layer(); | 149 ui::Layer* layer = phantom_widget_->GetNativeWindow()->layer(); |
| 146 layer->SetOpacity(0); | 150 layer->SetOpacity(0); |
| 147 ui::ScopedLayerAnimationSettings scoped_setter(layer->GetAnimator()); | 151 ui::ScopedLayerAnimationSettings scoped_setter(layer->GetAnimator()); |
| 148 layer->SetOpacity(1); | 152 layer->SetOpacity(1); |
| 149 } | 153 } |
| 150 | 154 |
| 151 } // namespace internal | 155 } // namespace internal |
| 152 } // namespace ash | 156 } // namespace ash |
| OLD | NEW |