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

Unified Diff: ash/wm/window_resizer.h

Issue 121153003: Prevents panels attached to shelf from docking (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Prevents panels attached to shelf from docking (nits) 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/panels/panel_window_resizer.cc ('k') | ash/wm/window_resizer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/window_resizer.h
diff --git a/ash/wm/window_resizer.h b/ash/wm/window_resizer.h
index 09f8ea2d9c0980b6473b4bb626fe1fc2148eaeb7..278d199f9bec42d44466107f0f9dd663bd60b2aa 100644
--- a/ash/wm/window_resizer.h
+++ b/ash/wm/window_resizer.h
@@ -6,6 +6,8 @@
#define ASH_WM_WINDOW_RESIZER_H_
#include "ash/ash_export.h"
+#include "ash/wm/drag_details.h"
+#include "ash/wm/window_state.h"
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "ui/aura/client/window_move_client.h"
@@ -16,9 +18,6 @@ class Window;
}
namespace ash {
-namespace wm {
-class WindowState;
-}
// WindowResizer is used by ToplevelWindowEventFilter to handle dragging, moving
// or resizing a window. All coordinates passed to this are in the parent
@@ -36,11 +35,15 @@ class ASH_EXPORT WindowResizer {
static const int kBoundsChangeDirection_Vertical;
WindowResizer();
+ WindowResizer(wm::WindowState* window_state);
virtual ~WindowResizer();
// Returns a bitmask of the kBoundsChange_ values.
static int GetBoundsChangeForWindowComponent(int component);
+ // Returns a bitmask of the kBoundsChange_ values.
+ static int GetPositionChangeDirectionForWindowComponent(int window_component);
+
// Invoked to drag/move/resize the window. |location| is in the coordinates
// of the window supplied to the constructor. |event_flags| is the event
// flags from the event.
@@ -53,95 +56,43 @@ class ASH_EXPORT WindowResizer {
virtual void RevertDrag() = 0;
// Returns the target window the resizer was created for.
- virtual aura::Window* GetTarget() = 0;
-
- // See comment for |Details::initial_location_in_parent|.
- virtual const gfx::Point& GetInitialLocation() const = 0;
-
- protected:
- struct Details {
- Details();
- Details(aura::Window* window,
- const gfx::Point& location,
- int window_component,
- aura::client::WindowMoveSource source);
- ~Details();
-
- // The window we're resizing.
- // TODO(oshima): replace this with accessor method to
- // |window_state->window()|.
- aura::Window* window;
-
- // The ash window state for the |window| above.
- wm::WindowState* window_state;
-
- // Initial bounds of the window in parent coordinates.
- gfx::Rect initial_bounds_in_parent;
-
- // Restore bounds (in screen coordinates) of the window before the drag
- // started. Only set if the window is normal and is being dragged.
- gfx::Rect restore_bounds;
+ aura::Window* GetTarget() const {
+ return window_state_ ? window_state_->window() : NULL;
+ }
- // Location passed to the constructor, in |window->parent()|'s coordinates.
- gfx::Point initial_location_in_parent;
+ // See comment for |DragDetails::initial_location_in_parent|.
+ const gfx::Point& GetInitialLocation() const {
+ return window_state_->drag_details()->initial_location_in_parent;
+ }
- // Initial opacity of the window.
- float initial_opacity;
+ // Drag parameters established when drag starts.
+ const DragDetails& details() const { return *window_state_->drag_details(); }
- // The component the user pressed on.
- int window_component;
-
- // Bitmask of the |kBoundsChange_| constants.
- int bounds_change;
-
- // Bitmask of the |kBoundsChangeDirection_| constants.
- int position_change_direction;
-
- // Bitmask of the |kBoundsChangeDirection_| constants.
- int size_change_direction;
-
- // Will the drag actually modify the window?
- bool is_resizable;
-
- // Source of the event initiating the drag.
- aura::client::WindowMoveSource source;
- };
-
- static gfx::Rect CalculateBoundsForDrag(const Details& details,
- const gfx::Point& location);
-
- static gfx::Rect AdjustBoundsToGrid(const gfx::Rect& bounds,
- int grid_size);
+ protected:
+ gfx::Rect CalculateBoundsForDrag(const gfx::Point& location);
static bool IsBottomEdge(int component);
+ // WindowState of the drag target.
+ wm::WindowState* window_state_;
+
private:
// In case of touch resizing, adjusts deltas so that the border is positioned
// just under the touch point.
- static void AdjustDeltaForTouchResize(const Details& details,
- int* delta_x,
- int* delta_y);
+ void AdjustDeltaForTouchResize(int* delta_x, int* delta_y);
// Returns the new origin of the window. The arguments are the difference
// between the current location and the initial location.
- static gfx::Point GetOriginForDrag(const Details& details,
- int delta_x,
- int delta_y);
+ gfx::Point GetOriginForDrag(int delta_x, int delta_y);
// Returns the size of the window for the drag.
- static gfx::Size GetSizeForDrag(const Details& details,
- int* delta_x,
- int* delta_y);
+ gfx::Size GetSizeForDrag(int* delta_x, int* delta_y);
// Returns the width of the window.
- static int GetWidthForDrag(const Details& details,
- int min_width,
- int* delta_x);
+ int GetWidthForDrag(int min_width, int* delta_x);
// Returns the height of the drag.
- static int GetHeightForDrag(const Details& details,
- int min_height,
- int* delta_y);
+ int GetHeightForDrag(int min_height, int* delta_y);
};
// Creates a WindowResizer for |window|. This can return a scoped_ptr
« no previous file with comments | « ash/wm/panels/panel_window_resizer.cc ('k') | ash/wm/window_resizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698