| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 Hide(); | 79 Hide(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 void PhantomWindowController::Show(const gfx::Rect& bounds) { | 82 void PhantomWindowController::Show(const gfx::Rect& bounds) { |
| 83 if (bounds == bounds_) | 83 if (bounds == bounds_) |
| 84 return; | 84 return; |
| 85 bounds_ = bounds; | 85 bounds_ = bounds; |
| 86 if (!phantom_widget_.get()) { | 86 if (!phantom_widget_.get()) { |
| 87 // Show the phantom at the bounds of the window. We'll animate to the target | 87 // Show the phantom at the bounds of the window. We'll animate to the target |
| 88 // bounds. | 88 // bounds. |
| 89 start_bounds_ = window_->GetScreenBounds(); | 89 start_bounds_ = window_->GetBoundsInScreen(); |
| 90 CreatePhantomWidget(start_bounds_); | 90 CreatePhantomWidget(start_bounds_); |
| 91 } else { | 91 } else { |
| 92 start_bounds_ = phantom_widget_->GetWindowScreenBounds(); | 92 start_bounds_ = phantom_widget_->GetWindowBoundsInScreen(); |
| 93 } | 93 } |
| 94 animation_.reset(new ui::SlideAnimation(this)); | 94 animation_.reset(new ui::SlideAnimation(this)); |
| 95 animation_->Show(); | 95 animation_->Show(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void PhantomWindowController::SetBounds(const gfx::Rect& bounds) { | 98 void PhantomWindowController::SetBounds(const gfx::Rect& bounds) { |
| 99 DCHECK(IsShowing()); | 99 DCHECK(IsShowing()); |
| 100 animation_.reset(); | 100 animation_.reset(); |
| 101 bounds_ = bounds; | 101 bounds_ = bounds; |
| 102 phantom_widget_->SetBounds(bounds_); | 102 phantom_widget_->SetBounds(bounds_); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 phantom_widget_->Show(); | 143 phantom_widget_->Show(); |
| 144 // Fade the window in. | 144 // Fade the window in. |
| 145 ui::Layer* layer = phantom_widget_->GetNativeWindow()->layer(); | 145 ui::Layer* layer = phantom_widget_->GetNativeWindow()->layer(); |
| 146 layer->SetOpacity(0); | 146 layer->SetOpacity(0); |
| 147 ui::ScopedLayerAnimationSettings scoped_setter(layer->GetAnimator()); | 147 ui::ScopedLayerAnimationSettings scoped_setter(layer->GetAnimator()); |
| 148 layer->SetOpacity(1); | 148 layer->SetOpacity(1); |
| 149 } | 149 } |
| 150 | 150 |
| 151 } // namespace internal | 151 } // namespace internal |
| 152 } // namespace ash | 152 } // namespace ash |
| OLD | NEW |