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

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

Issue 9599007: Minor refactoring of window resize code. I wasn't too happy with (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 10 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/workspace/workspace_event_filter.cc ('k') | ash/wm/workspace/workspace_window_resizer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/workspace/workspace_window_resizer.h
===================================================================
--- ash/wm/workspace/workspace_window_resizer.h (revision 124905)
+++ ash/wm/workspace/workspace_window_resizer.h (working copy)
@@ -12,6 +12,8 @@
namespace ash {
namespace internal {
+class RootWindowEventFilter;
+
// WindowResizer implementation for workspaces. This enforces that windows are
// not allowed to vertically move or resize outside of the work area. As windows
// are moved outside the work area they are shrunk. We remember the height of
@@ -19,33 +21,56 @@
// attempt to restore the old height.
class ASH_EXPORT WorkspaceWindowResizer : public WindowResizer {
public:
- WorkspaceWindowResizer(aura::Window* window,
- const gfx::Point& location,
- int window_component,
- int grid_size);
virtual ~WorkspaceWindowResizer();
- protected:
- // WindowResizer overrides:
- virtual gfx::Rect GetBoundsForDrag(const gfx::Point& location) OVERRIDE;
- virtual gfx::Rect GetFinalBounds() OVERRIDE;
+ // Creates a new WorkspaceWindowResizer. The caller takes ownership of the
+ // returned object. Returns NULL if not resizable.
+ static WorkspaceWindowResizer* Create(
+ aura::Window* window,
+ const gfx::Point& location,
+ int window_component,
+ int grid_size);
+ // Returns true if the drag will result in changing the window in anyway.
+ bool is_resizable() const { return details_.is_resizable; }
+
+ const gfx::Point& initial_location_in_parent() const {
+ return details_.initial_location_in_parent;
+ }
+
+ // Overridden from WindowResizer:
+ virtual void Drag(const gfx::Point& location);
+ virtual void CompleteDrag();
+ virtual void RevertDrag();
+
private:
- // Used to maintain the height of the window before we started collapsing it.
- static void SetHeightBeforeObscured(aura::Window* window, int height);
- static void ClearHeightBeforeObscured(aura::Window* window);
- static int GetHeightBeforeObscured(aura::Window* window);
+ explicit WorkspaceWindowResizer(const Details& details);
// Adjusts the bounds to enforce that windows are vertically contained in the
// work area.
- void AdjustBounds(gfx::Rect* bounds) const;
+ void AdjustBoundsForMainWindow(gfx::Rect* bounds) const;
+ void AdjustBoundsForWindow(const gfx::Rect& work_area,
+ aura::Window* window,
+ gfx::Rect* bounds) const;
+ // Clears the cached height of the window being dragged.
+ void ClearCachedHeights();
+
// Returns true if the window touches the bottom of the work area.
- bool WindowTouchesBottomOfScreen() const;
+ bool TouchesBottomOfScreen() const;
+ aura::Window* window() const { return details_.window; }
+
+ const Details details_;
+
// True if the window size (height) should be constrained.
const bool constrain_size_;
+ // Set to true once Drag() is invoked and the bounds of the window change.
+ bool did_move_or_resize_;
+
+ internal::RootWindowEventFilter* root_filter_;
+
DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer);
};
« no previous file with comments | « ash/wm/workspace/workspace_event_filter.cc ('k') | ash/wm/workspace/workspace_window_resizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698