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

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: 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.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..76340e02004ac54ab65c8f48074e6ee3fcbc83eb
--- /dev/null
+++ b/chrome/browser/ui/panels/panel_drag_controller.cc
@@ -0,0 +1,39 @@
+// 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_->panel_strip()->StartDraggingPanel(panel);
+ dragging_panel_original_position_ = panel->GetBounds().origin();
jennb 2012/02/21 20:01:46 nit: Should we save the position before calling St
+}
+
+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;
+}
+

Powered by Google App Engine
This is Rietveld 408576698