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 d00fd7eb0cb48ddcacc3ba4719fef527e891b517..2a604341218159cf2d3658feb69d76aeda7f81b0 100644 |
--- a/ash/wm/workspace/phantom_window_controller.cc |
+++ b/ash/wm/workspace/phantom_window_controller.cc |
@@ -8,19 +8,12 @@ |
#include "ash/shell_window_ids.h" |
#include "ash/wm/coordinate_conversion.h" |
#include "third_party/skia/include/core/SkCanvas.h" |
-#include "ui/aura/client/screen_position_client.h" |
-#include "ui/aura/root_window.h" |
#include "ui/aura/window.h" |
-#include "ui/aura/window_delegate.h" |
-#include "ui/aura/window_observer.h" |
#include "ui/base/animation/slide_animation.h" |
-#include "ui/base/animation/tween.h" |
#include "ui/compositor/layer.h" |
#include "ui/compositor/scoped_layer_animation_settings.h" |
#include "ui/gfx/canvas.h" |
-#include "ui/gfx/screen.h" |
#include "ui/gfx/skia_util.h" |
-#include "ui/views/corewm/shadow_types.h" |
#include "ui/views/painter.h" |
#include "ui/views/view.h" |
#include "ui/views/widget/widget.h" |
@@ -84,20 +77,14 @@ class EdgePainter : public views::Painter { |
PhantomWindowController::PhantomWindowController(aura::Window* window) |
: window_(window), |
phantom_below_window_(NULL), |
- phantom_widget_(NULL), |
- style_(STYLE_SHADOW) { |
+ phantom_widget_(NULL) { |
} |
PhantomWindowController::~PhantomWindowController() { |
Hide(); |
} |
-void PhantomWindowController::SetDestinationDisplay( |
- const gfx::Display& dst_display) { |
- dst_display_ = dst_display; |
-} |
- |
-void PhantomWindowController::Show(const gfx::Rect& bounds, ui::Layer* layer) { |
+void PhantomWindowController::Show(const gfx::Rect& bounds) { |
if (bounds == bounds_) |
return; |
bounds_ = bounds; |
@@ -105,7 +92,7 @@ void PhantomWindowController::Show(const gfx::Rect& bounds, ui::Layer* layer) { |
// Show the phantom at the bounds of the window. We'll animate to the target |
// bounds. |
start_bounds_ = window_->GetBoundsInScreen(); |
- CreatePhantomWidget(start_bounds_, layer); |
+ CreatePhantomWidget(start_bounds_); |
} else { |
start_bounds_ = phantom_widget_->GetWindowBoundsInScreen(); |
} |
@@ -115,13 +102,6 @@ void PhantomWindowController::Show(const gfx::Rect& bounds, ui::Layer* layer) { |
animation_->Show(); |
} |
-void PhantomWindowController::SetBounds(const gfx::Rect& bounds) { |
- DCHECK(IsShowing()); |
- animation_.reset(); |
- bounds_ = bounds; |
- SetBoundsInternal(bounds); |
-} |
- |
void PhantomWindowController::Hide() { |
if (phantom_widget_) |
phantom_widget_->Close(); |
@@ -132,31 +112,13 @@ bool PhantomWindowController::IsShowing() const { |
return phantom_widget_ != NULL; |
} |
-void PhantomWindowController::set_style(Style style) { |
- // Cannot change |style_| after the widget is initialized. |
- DCHECK(!phantom_widget_); |
- style_ = style; |
-} |
- |
-void PhantomWindowController::SetOpacity(float opacity) { |
- DCHECK(phantom_widget_); |
- ui::Layer* layer = phantom_widget_->GetNativeWindow()->layer(); |
- ui::ScopedLayerAnimationSettings scoped_setter(layer->GetAnimator()); |
- layer->SetOpacity(opacity); |
-} |
- |
-float PhantomWindowController::GetOpacity() const { |
- DCHECK(phantom_widget_); |
- return phantom_widget_->GetNativeWindow()->layer()->opacity(); |
-} |
- |
void PhantomWindowController::AnimationProgressed( |
const ui::Animation* animation) { |
- SetBoundsInternal(animation->CurrentValueBetween(start_bounds_, bounds_)); |
+ phantom_widget_->SetBounds( |
+ animation->CurrentValueBetween(start_bounds_, bounds_)); |
} |
-void PhantomWindowController::CreatePhantomWidget(const gfx::Rect& bounds, |
- ui::Layer* layer) { |
+void PhantomWindowController::CreatePhantomWidget(const gfx::Rect& bounds) { |
DCHECK(!phantom_widget_); |
phantom_widget_ = new views::Widget; |
views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
@@ -173,29 +135,16 @@ void PhantomWindowController::CreatePhantomWidget(const gfx::Rect& bounds, |
phantom_widget_->SetVisibilityChangedAnimationsEnabled(false); |
phantom_widget_->GetNativeWindow()->SetName("PhantomWindow"); |
phantom_widget_->GetNativeWindow()->set_id(kShellWindowId_PhantomWindow); |
- if (style_ == STYLE_SHADOW) { |
- views::View* content_view = new views::View; |
- content_view->set_background( |
- views::Background::CreateBackgroundPainter(true, new EdgePainter)); |
- phantom_widget_->SetContentsView(content_view); |
- } else if (style_ == STYLE_DRAGGING) { |
- // Show shadow for the dragging window. |
- SetShadowType(phantom_widget_->GetNativeWindow(), |
- views::corewm::SHADOW_TYPE_RECTANGULAR); |
- } |
- SetBoundsInternal(bounds); |
+ views::View* content_view = new views::View; |
+ content_view->set_background( |
+ views::Background::CreateBackgroundPainter(true, new EdgePainter)); |
+ phantom_widget_->SetContentsView(content_view); |
+ phantom_widget_->SetBounds(bounds); |
if (phantom_below_window_) |
phantom_widget_->StackBelow(phantom_below_window_); |
else |
phantom_widget_->StackAbove(window_); |
- if (layer) { |
- aura::Window* window = phantom_widget_->GetNativeWindow(); |
- layer->SetVisible(true); |
- window->layer()->Add(layer); |
- window->layer()->StackAtTop(layer); |
- } |
- |
// Show the widget after all the setups. |
phantom_widget_->Show(); |
@@ -206,17 +155,5 @@ void PhantomWindowController::CreatePhantomWidget(const gfx::Rect& bounds, |
widget_layer->SetOpacity(1); |
} |
-void PhantomWindowController::SetBoundsInternal(const gfx::Rect& bounds) { |
- aura::Window* window = phantom_widget_->GetNativeWindow(); |
- aura::client::ScreenPositionClient* screen_position_client = |
- aura::client::GetScreenPositionClient(window->GetRootWindow()); |
- if (screen_position_client && |
- dst_display_.id() != gfx::Display::kInvalidDisplayID) { |
- screen_position_client->SetBounds(window, bounds, dst_display_); |
- } else { |
- phantom_widget_->SetBounds(bounds); |
- } |
-} |
- |
} // namespace internal |
} // namespace ash |