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

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

Issue 9403035: Refactor intra-strip panel drags by introducing PanelDragController. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Final patch for commit 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
« no previous file with comments | « chrome/browser/ui/panels/panel_drag_controller.h ('k') | chrome/browser/ui/panels/panel_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/panels/panel_drag_controller.cc
diff --git a/chrome/browser/ui/panels/panel_drag_controller.cc b/chrome/browser/ui/panels/panel_drag_controller.cc
new file mode 100644
index 0000000000000000000000000000000000000000..8c4132dcb68eff9ac44ee53a891011e9c54facd9
--- /dev/null
+++ b/chrome/browser/ui/panels/panel_drag_controller.cc
@@ -0,0 +1,40 @@
+// 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.
+
+#include "chrome/browser/ui/panels/panel_drag_controller.h"
+
+#include "base/logging.h"
+#include "chrome/browser/ui/panels/panel.h"
+#include "chrome/browser/ui/panels/panel_strip.h"
+
+PanelDragController::PanelDragController()
+ : dragging_panel_(NULL) {
+}
+
+PanelDragController::~PanelDragController() {
+}
+
+void PanelDragController::StartDragging(Panel* panel) {
+ DCHECK(!dragging_panel_);
+ DCHECK(panel->draggable());
+
+ dragging_panel_ = panel;
+ dragging_panel_original_position_ = panel->GetBounds().origin();
+
+ dragging_panel_->panel_strip()->StartDraggingPanel(panel);
+}
+
+void PanelDragController::Drag(int delta_x, int delta_y) {
+ DCHECK(dragging_panel_);
+
+ dragging_panel_->panel_strip()->DragPanel(dragging_panel_, delta_x, delta_y);
+}
+
+void PanelDragController::EndDragging(bool cancelled) {
+ DCHECK(dragging_panel_);
+
+ dragging_panel_->panel_strip()->EndDraggingPanel(dragging_panel_, cancelled);
+ dragging_panel_ = NULL;
+}
+
« no previous file with comments | « chrome/browser/ui/panels/panel_drag_controller.h ('k') | chrome/browser/ui/panels/panel_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698