Chromium Code Reviews| Index: chrome/browser/ui/panels/panel_drag_controller.h |
| diff --git a/chrome/browser/ui/panels/panel_drag_controller.h b/chrome/browser/ui/panels/panel_drag_controller.h |
| index 7c0c7023f08e3477d83b43a05cf5ff81d1b641df..2132bd450a4325f793246d27a7d61a901fec21f5 100644 |
| --- a/chrome/browser/ui/panels/panel_drag_controller.h |
| +++ b/chrome/browser/ui/panels/panel_drag_controller.h |
| @@ -6,12 +6,16 @@ |
| #define CHROME_BROWSER_UI_PANELS_PANEL_DRAG_CONTROLLER_H_ |
| #include "base/memory/scoped_ptr.h" |
| -#include "ui/gfx/point.h" |
| +#include "chrome/browser/ui/panels/panel_collection.h" |
| #include "ui/gfx/vector2d.h" |
| class Panel; |
| class PanelCollection; |
| class PanelManager; |
| +namespace gfx { |
| +class Point; |
| +class Rect; |
| +} |
| // Controls all the drags initiated for all panels, including detaching, |
| // docking, stacking, snapping and intra-collection dragging. |
| @@ -35,8 +39,21 @@ class PanelDragController { |
| // For testing. |
| static int GetDetachDockedPanelThresholdForTesting(); |
| static int GetDockDetachedPanelThresholdForTesting(); |
| + static int GetGluePanelDistanceThresholdForTesting(); |
| private: |
| + enum GlueAction { |
| + STACK, |
| + SNAP |
| + }; |
| + |
| + enum GlueEdge { |
| + TOP_EDGE, |
| + BOTTOM_EDGE, |
| + LEFT_EDGE, |
| + RIGHT_EDGE |
| + }; |
| + |
| gfx::Point GetPanelPositionForMouseLocation( |
| const gfx::Point& mouse_location) const; |
| @@ -44,8 +61,29 @@ class PanelDragController { |
| // panel origin to move to. Returns true if the request has been performed. |
| bool TryDetach(const gfx::Point& target_position); |
| bool TryDock(const gfx::Point& target_position); |
| + bool TryStack(const gfx::Point& target_position); |
| + bool TryUnstackFromTop(const gfx::Point& target_position); |
| + bool TryUnstackFromBottom(const gfx::Point& target_position); |
| + void TrySnap(gfx::Point* target_position); |
| + |
| + // Finds the panel that the dragging panel with |potential_position| could |
| + // snap to or stack with. If such panel is found, |target_bounds| contains the |
| + // new bounds for the dragging panel and |target_edge| contains the matched |
| + // edge. |
| + Panel* FindPanelToGlue(const gfx::Point& potential_position, |
| + GlueAction action, |
| + gfx::Rect* target_bounds, |
| + GlueEdge* target_edge) const; |
| + |
| + // Moves the |panel| (and all panels below if it is in a stack) to a different |
| + // colleciton. |
|
dcheng
2013/01/10 22:39:03
Nit: typo, s/colleciton/collection
jianli
2013/01/10 23:23:23
Done.
|
| + void MovePanelAndBelowToCollection( |
| + Panel* panel, |
| + PanelCollection* target_collection, |
| + PanelCollection::PositioningMask positioning_mask) const; |
| PanelManager* panel_manager_; // Weak, owns us. |
| + bool panel_stacking_enabled_; |
| // Panel currently being dragged. |
| Panel* dragging_panel_; |