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

Unified Diff: chrome/browser/ui/panels/panel_drag_controller.h

Issue 9546001: Support detaching/attaching panels via inter-strip drags. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix per feedback Created 8 years, 9 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: 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 df944a586e685d5958d7d40e9d3f160d675f9d53..b41b73bcfe2a8af98834565326a93864e6f44e84 100644
--- a/chrome/browser/ui/panels/panel_drag_controller.h
+++ b/chrome/browser/ui/panels/panel_drag_controller.h
@@ -11,12 +11,14 @@
#include "ui/gfx/point.h"
class Panel;
+class PanelManager;
+class PanelStrip;
// Responsible for handling drags initiated for all panels, including both
// intra-strip and inter-strip drags.
class PanelDragController {
public:
- PanelDragController();
+ explicit PanelDragController(PanelManager* panel_manager);
~PanelDragController();
// Drags the given panel.
@@ -31,23 +33,53 @@ class PanelDragController {
bool IsDragging() const { return dragging_panel_ != NULL; }
Panel* dragging_panel() const { return dragging_panel_; }
- gfx::Point dragging_panel_original_position() const {
- return dragging_panel_original_position_;
+
+#ifdef UNIT_TEST
+ static int GetDetachDockedPanelThreshold() {
+ return kDetachDockedPanelThreshold;
+ }
+
+ static int GetDockDetachedPanelThreshold() {
+ return kDockDetachedPanelThreshold;
}
+#endif
private:
+ // Used to figure out if the panel can be dragged to other strip.
jennb 2012/03/08 23:41:09 Comment what the params and return values mean.
jianli 2012/03/09 21:48:58 Done.
+ PanelStrip* ComputeDragTagetStrip(
jennb 2012/03/08 23:41:09 typo: Taget
jianli 2012/03/09 21:48:58 Done.
+ const gfx::Point& mouse_location, gfx::Point* new_panel_position) const;
+ bool CanDragToDockedStrip(
+ const gfx::Point& mouse_location, gfx::Point* new_panel_position) const;
+ bool CanDragToDetachedStrip(
+ const gfx::Point& mouse_location, gfx::Point* new_panel_position) const;
+
+ int GetOffsetToDockedAreaBottom(
jennb 2012/03/08 23:41:09 Needs comment. Unclear what this is.
jianli 2012/03/09 21:48:58 Removed since it is not needed now.
+ const gfx::Point& target_panel_position) const;
+
+ PanelManager* panel_manager_; // Weak, owns us.
+
// Panel currently being dragged.
Panel* dragging_panel_;
- // Original position, in screen coordinate system, of the panel being dragged.
- // This is used to get back to the original position when we cancel the
- // dragging.
- gfx::Point dragging_panel_original_position_;
+ // The original panel strip when the drag is started.
+ PanelStrip* dragging_panel_original_strip_;
// The mouse location, in screen coordinates, when StartDragging or Drag was
// pveviously called.
gfx::Point last_mouse_location_;
+ // The offset from mouse location to the panel position when the drag
+ // starts.
+ gfx::Point offset_from_mouse_location_on_drag_start_;
jennb 2012/03/08 23:41:09 This is a delta of some sort? I don't understand t
jianli 2012/03/09 21:48:58 Comment updated.
+
+ // The minimum distance that the docked panel gets dragged up in order to
+ // make it free-floating.
+ static const int kDetachDockedPanelThreshold;
+
+ // Indicates how close the bottom of the detached panel is to the bottom of
+ // the docked area such that the detached panel becomes docked.
+ static const int kDockDetachedPanelThreshold;
+
DISALLOW_COPY_AND_ASSIGN(PanelDragController);
};

Powered by Google App Engine
This is Rietveld 408576698