Chromium Code Reviews| 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; |
| +} |
| + |