Index: ash/wm/workspace/phantom_window_controller.h |
diff --git a/ash/wm/workspace/phantom_window_controller.h b/ash/wm/workspace/phantom_window_controller.h |
index 77d4a2860353a0393c0d703f8c09187f4c3788ba..2f079b701d53039dce731660c2c54d43b3be20b7 100644 |
--- a/ash/wm/workspace/phantom_window_controller.h |
+++ b/ash/wm/workspace/phantom_window_controller.h |
@@ -9,17 +9,12 @@ |
#include "base/basictypes.h" |
#include "base/gtest_prod_util.h" |
#include "base/memory/scoped_ptr.h" |
-#include "ui/gfx/animation/animation_delegate.h" |
#include "ui/gfx/rect.h" |
namespace aura { |
class Window; |
} |
-namespace gfx { |
-class SlideAnimation; |
-} |
- |
namespace views { |
class Widget; |
} |
@@ -28,14 +23,14 @@ namespace ash { |
namespace internal { |
// PhantomWindowController is responsible for showing a phantom representation |
-// of a window. It's used used during dragging a window to show a snap location. |
-class ASH_EXPORT PhantomWindowController : public gfx::AnimationDelegate { |
+// of a window. It's used to show a preview of how snapping or docking a window |
+// will affect the window's bounds. |
+class ASH_EXPORT PhantomWindowController { |
public: |
explicit PhantomWindowController(aura::Window* window); |
- virtual ~PhantomWindowController(); |
- // Bounds last passed to Show(). |
- const gfx::Rect& bounds_in_screen() const { return bounds_in_screen_; } |
+ // Hides the phantom window without any animation. |
+ virtual ~PhantomWindowController(); |
// Animates the phantom window towards |bounds_in_screen|. |
// Creates two (if start bounds intersect any root window other than the |
@@ -44,7 +39,10 @@ class ASH_EXPORT PhantomWindowController : public gfx::AnimationDelegate { |
// This does not immediately show the window. |
void Show(const gfx::Rect& bounds_in_screen); |
- // Hides the phantom. |
+ // Starts fading out the phantom window. |
+ void StartFadeOut(); |
sky
2013/12/19 21:25:43
Instead make Hide() take an argument indicating if
|
+ |
+ // Hides the phantom window without any animation. |
void Hide(); |
// Returns true if the phantom is showing. |
@@ -56,16 +54,18 @@ class ASH_EXPORT PhantomWindowController : public gfx::AnimationDelegate { |
phantom_below_window_ = phantom_below_window; |
} |
- // gfx::AnimationDelegate overrides: |
- virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; |
- |
private: |
- FRIEND_TEST_ALL_PREFIXES(WorkspaceWindowResizerTest, PhantomWindowShow); |
+ friend class PhantomWindowControllerTest; |
// Creates, shows and returns a phantom widget at |bounds| |
- // with kShellWindowId_ShelfContainer in |root_window| as a parent. |
- views::Widget* CreatePhantomWidget(aura::Window* root_window, |
- const gfx::Rect& bounds_in_screen); |
+ // with kShellWindowId_ShelfContainer in |root_window| as a parent. The caller |
+ // takes ownership of the returned widget. |
+ views::Widget* CreatePhantomWidget( |
sky
2013/12/19 21:25:43
return scoped_ptr?
|
+ aura::Window* root_window, |
+ const gfx::Rect& bounds_in_screen) WARN_UNUSED_RESULT; |
+ |
+ // Starts fading the phantom window in or out. |
+ void StartFade(bool fade_in); |
// Window the phantom is placed beneath. |
aura::Window* window_; |
@@ -73,26 +73,22 @@ class ASH_EXPORT PhantomWindowController : public gfx::AnimationDelegate { |
// If set, the phantom window should get stacked below this window. |
aura::Window* phantom_below_window_; |
- // Initially the bounds of |window_| (in screen coordinates). |
- // Each time Show() is invoked |start_bounds_| is then reset to the bounds of |
- // |phantom_widget_| and |bounds_| is set to the value passed into Show(). |
- // The animation animates between these two values. |
- gfx::Rect start_bounds_; |
- |
- // Target bounds of the animation in screen coordinates. |
- gfx::Rect bounds_in_screen_; |
+ // Target visibility of the animation. |
+ bool target_visibility_; |
- // The primary phantom representation of the window. It is parented by the |
- // root window matching the target bounds. |
- views::Widget* phantom_widget_; |
+ // Target bounds (including the shadows if any) of the animation in screen |
+ // coordinates. |
+ gfx::Rect target_bounds_in_screen_; |
- // If the animation starts on another display, this is the secondary phantom |
- // representation of the window used on the initial display, otherwise this is |
- // NULL. This allows animation to progress from one display into the other. |
- views::Widget* phantom_widget_start_; |
+ // Phantom representation of the window which is in the root window matching |
+ // |target_bounds_in_screen_|. |
+ scoped_ptr<views::Widget> target_phantom_widget_; |
- // Used to transition the bounds. |
- scoped_ptr<gfx::SlideAnimation> animation_; |
+ // Phantom representation of the window which is in the root window matching |
+ // the window's initial bounds. This allows animations to progress from one |
+ // display to the other. NULL if the phantom window starts and ends in the |
+ // same root window. |
+ scoped_ptr<views::Widget> start_phantom_widget_; |
sky
2013/12/19 21:25:43
start|target aren't particular descriptive by them
|
DISALLOW_COPY_AND_ASSIGN(PhantomWindowController); |
}; |