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

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

Issue 23431009: Windows docking should get triggered by pressing against the screen edge (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Windows docking should get triggered by pressing against the screen edge (warn) Created 7 years, 3 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
Index: ash/wm/workspace/snap_sizer.h
diff --git a/ash/wm/workspace/snap_sizer.h b/ash/wm/workspace/snap_sizer.h
index bd5f719ae482d1d78be1c20d70fd0895e3eb0703..b4cae25739b8dc244593816fa3af0a1a5e2629e5 100644
--- a/ash/wm/workspace/snap_sizer.h
+++ b/ash/wm/workspace/snap_sizer.h
@@ -19,6 +19,8 @@ class Window;
namespace ash {
namespace internal {
+class DockedWindowLayoutManager;
+
// SnapSizer is responsible for determining the resulting bounds of a window
// that is being snapped to the left or right side of the screen.
// The bounds used in this class are in the container's coordinates.
@@ -31,6 +33,7 @@ class ASH_EXPORT SnapSizer {
enum InputType {
TOUCH_MAXIMIZE_BUTTON_INPUT,
+ WORKSPACE_DRAG_INPUT,
OTHER_INPUT
};
@@ -63,6 +66,13 @@ class ASH_EXPORT SnapSizer {
// For unit test purposes this function is not private.
gfx::Rect GetTargetBoundsForSize(size_t size_index) const;
+ // Returns true when snapping sequence is at its last (docking) step.
sky 2013/09/11 19:38:40 Why do we need snapsizer to know about docked wind
varkha 2013/09/11 20:02:10 We moved to the model where docking is the last st
varkha 2013/09/12 19:49:23 Done.
+ bool ShouldDockWindow() const;
+
+ // Returns true when a window can be docked. Windows cannot be docked at the
+ // edge used by the launcher shelf or the edge opposite from existing dock.
+ static bool CanDockWindow(aura::Window* window, SnapSizer::Edge edge);
+
private:
// Calculates the amount to increment by. This returns one of -1, 0 or 1 and
// is intended to by applied to |size_index_|. |x| is the current
@@ -81,6 +91,10 @@ class ASH_EXPORT SnapSizer {
// Returns true if the specified point is along the edge of the screen.
bool AlongEdge(int x) const;
+ // Dock when a window is at its last step in snapping sequence, undock
+ // otherwise.
+ void UpdateDockedState();
+
// Window being snapped.
aura::Window* window_;
@@ -118,8 +132,12 @@ class ASH_EXPORT SnapSizer {
const InputType input_type_;
// A list of usable window widths for size. This gets created when the
- // sizer gets created.
- const std::vector<int> usable_width_;
+ // sizer gets created. Possible last 0 entry indicates that computing bounds
+ // needs to be delegated to DockedWindowLayoutManager.
+ std::vector<int> usable_width_;
+
+ // Dock container window layout manager.
+ DockedWindowLayoutManager* dock_layout_;
DISALLOW_COPY_AND_ASSIGN(SnapSizer);
};

Powered by Google App Engine
This is Rietveld 408576698