| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/panels/detached_panel_strip.h" | 5 #include "chrome/browser/ui/panels/detached_panel_strip.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "chrome/browser/ui/panels/panel_drag_controller.h" |
| 9 #include "chrome/browser/ui/panels/panel_manager.h" | 10 #include "chrome/browser/ui/panels/panel_manager.h" |
| 10 | 11 |
| 11 DetachedPanelStrip::DetachedPanelStrip(PanelManager* panel_manager) | 12 DetachedPanelStrip::DetachedPanelStrip(PanelManager* panel_manager) |
| 12 : PanelStrip(PanelStrip::DETACHED), | 13 : PanelStrip(PanelStrip::DETACHED), |
| 13 panel_manager_(panel_manager) { | 14 panel_manager_(panel_manager) { |
| 14 } | 15 } |
| 15 | 16 |
| 16 DetachedPanelStrip::~DetachedPanelStrip() { | 17 DetachedPanelStrip::~DetachedPanelStrip() { |
| 17 DCHECK(panels_.empty()); | 18 DCHECK(panels_.empty()); |
| 18 } | 19 } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 void DetachedPanelStrip::MinimizePanel(Panel* panel) { | 73 void DetachedPanelStrip::MinimizePanel(Panel* panel) { |
| 73 DCHECK_EQ(this, panel->panel_strip()); | 74 DCHECK_EQ(this, panel->panel_strip()); |
| 74 NOTIMPLEMENTED(); | 75 NOTIMPLEMENTED(); |
| 75 } | 76 } |
| 76 | 77 |
| 77 void DetachedPanelStrip::RestorePanel(Panel* panel) { | 78 void DetachedPanelStrip::RestorePanel(Panel* panel) { |
| 78 DCHECK_EQ(this, panel->panel_strip()); | 79 DCHECK_EQ(this, panel->panel_strip()); |
| 79 NOTIMPLEMENTED(); | 80 NOTIMPLEMENTED(); |
| 80 } | 81 } |
| 81 | 82 |
| 83 bool DetachedPanelStrip::CanDragPanel(const Panel* panel) const { |
| 84 // All detached panels are draggable. |
| 85 return true; |
| 86 } |
| 87 |
| 88 void DetachedPanelStrip::StartDraggingPanel(Panel* panel) { |
| 89 } |
| 90 |
| 91 void DetachedPanelStrip::DragPanel(Panel* panel, int delta_x, int delta_y) { |
| 92 gfx::Rect new_bounds(panel->GetBounds()); |
| 93 new_bounds.Offset(delta_x, delta_y); |
| 94 panel->SetPanelBounds(new_bounds); |
| 95 } |
| 96 |
| 97 void DetachedPanelStrip::EndDraggingPanel(Panel* panel, bool cancelled) { |
| 98 if (cancelled) { |
| 99 gfx::Rect new_bounds(panel->GetBounds()); |
| 100 new_bounds.set_origin( |
| 101 panel_manager_->drag_controller()->dragging_panel_original_position()); |
| 102 panel->SetPanelBounds(new_bounds); |
| 103 } |
| 104 } |
| OLD | NEW |