Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/ui/panels/panel_drag_controller.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "chrome/browser/ui/panels/panel.h" | |
| 9 #include "chrome/browser/ui/panels/panel_strip.h" | |
| 10 | |
| 11 PanelDragController::PanelDragController() | |
| 12 : dragging_panel_(NULL) { | |
| 13 } | |
| 14 | |
| 15 PanelDragController::~PanelDragController() { | |
| 16 } | |
| 17 | |
| 18 void PanelDragController::StartDragging(Panel* panel) { | |
| 19 DCHECK(!dragging_panel_); | |
| 20 DCHECK(panel->draggable()); | |
| 21 | |
| 22 dragging_panel_ = panel; | |
| 23 dragging_panel_->panel_strip()->StartDraggingPanel(panel); | |
| 24 dragging_panel_original_position_ = panel->GetBounds().origin(); | |
|
jennb
2012/02/21 20:01:46
nit: Should we save the position before calling St
| |
| 25 } | |
| 26 | |
| 27 void PanelDragController::Drag(int delta_x, int delta_y) { | |
| 28 DCHECK(dragging_panel_); | |
| 29 | |
| 30 dragging_panel_->panel_strip()->DragPanel(dragging_panel_, delta_x, delta_y); | |
| 31 } | |
| 32 | |
| 33 void PanelDragController::EndDragging(bool cancelled) { | |
| 34 DCHECK(dragging_panel_); | |
| 35 | |
| 36 dragging_panel_->panel_strip()->EndDraggingPanel(dragging_panel_, cancelled); | |
| 37 dragging_panel_ = NULL; | |
| 38 } | |
| 39 | |
| OLD | NEW |