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

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..519596c9bdfd5fbece0327b87cdb25ac6876388e
--- /dev/null
+++ b/chrome/browser/ui/panels/panel_drag_controller.h
@@ -0,0 +1,45 @@
+// 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 panel strips, including
jennb 2012/02/17 21:28:45 s/panel strips/panels ?
jianli 2012/02/17 23:52:56 Done.
+// 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);
+
+ // Checks if |panel| can be removed now. If not, it will be scheduled to be
+ // removed later.
+ bool CanRemovePanel(Panel* panel);
+
+ Panel* dragging_panel() const { return dragging_panel_; }
+
+ private:
+ void DelayedRemove();
+
+ // Panel currently being dragged.
+ Panel* dragging_panel_;
+
+ // Stores the panels that are pending to remove. We want to delay the removal
+ // when we're in the process of the dragging.
+ std::set<Panel*> panels_pending_to_remove_;
+
+ DISALLOW_COPY_AND_ASSIGN(PanelDragController);
+};
+
+#endif // CHROME_BROWSER_UI_PANELS_PANEL_DRAG_CONTROLLER_H_

Powered by Google App Engine
This is Rietveld 408576698