Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(954)

Unified Diff: ash/wm/workspace/phantom_window_controller.h

Issue 101773004: Refactor PhantomWindowController so that the PhantomWindowController owns the phantom window (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/wm/gestures/system_pinch_handler.cc ('k') | ash/wm/workspace/phantom_window_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..a6ab601b414b1cf67fdf96935bfba49f2e24a919 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,28 +39,20 @@ 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.
- void Hide();
-
- // Returns true if the phantom is showing.
- bool IsShowing() const;
-
// If set, the phantom window is stacked below this window, otherwise it
// is stacked above the window passed to the constructor.
void set_phantom_below_window(aura::Window* phantom_below_window) {
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);
+ scoped_ptr<views::Widget> CreatePhantomWidget(
+ aura::Window* root_window,
+ const gfx::Rect& bounds_in_screen);
// Window the phantom is placed beneath.
aura::Window* window_;
@@ -73,26 +60,18 @@ 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_;
-
- // The primary phantom representation of the window. It is parented by the
- // root window matching the target bounds.
- views::Widget* phantom_widget_;
+ 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> phantom_widget_in_target_root_;
- // 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> phantom_widget_in_start_root_;
DISALLOW_COPY_AND_ASSIGN(PhantomWindowController);
};
« no previous file with comments | « ash/wm/gestures/system_pinch_handler.cc ('k') | ash/wm/workspace/phantom_window_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698