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

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

Issue 9403035: Refactor intra-strip panel drags by introducing PanelDragController. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix per feedback 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
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
new file mode 100644
index 0000000000000000000000000000000000000000..63cb33a6573d87100c462a8b5e7d7fb0444bc6f5
--- /dev/null
+++ b/chrome/browser/ui/panels/panel_drag_controller.h
@@ -0,0 +1,43 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_PANELS_PANEL_DRAG_CONTROLLER_H_
+#define CHROME_BROWSER_UI_PANELS_PANEL_DRAG_CONTROLLER_H_
+#pragma once
+
+#include <set>
+#include "base/basictypes.h"
+#include "ui/gfx/point.h"
+
+class Panel;
+
+// Responsible for handling drags initiated for all panels, including both
+// intra-strip and inter-strip drags.
+class PanelDragController {
+ public:
+ PanelDragController();
+ ~PanelDragController();
+
+ void StartDragging(Panel* panel);
+ void Drag(int delta_x, int delta_y);
+ void EndDragging(bool cancelled);
+
+ Panel* dragging_panel() const { return dragging_panel_; }
+ gfx::Point dragging_panel_original_position() const {
+ return dragging_panel_original_position_;
+ }
+
+ private:
+ // 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_;
+
+ DISALLOW_COPY_AND_ASSIGN(PanelDragController);
+};
+
+#endif // CHROME_BROWSER_UI_PANELS_PANEL_DRAG_CONTROLLER_H_

Powered by Google App Engine
This is Rietveld 408576698