Chromium Code Reviews| Index: chrome/browser/ui/panels/detached_panel_strip.cc |
| diff --git a/chrome/browser/ui/panels/detached_panel_strip.cc b/chrome/browser/ui/panels/detached_panel_strip.cc |
| index c0e35acc42f22ff492f1563fbccca5d44eaee820..244819ec6eed52765dcf27546ac751df85d79c64 100644 |
| --- a/chrome/browser/ui/panels/detached_panel_strip.cc |
| +++ b/chrome/browser/ui/panels/detached_panel_strip.cc |
| @@ -35,6 +35,8 @@ void DetachedPanelStrip::RefreshLayout() { |
| void DetachedPanelStrip::AddPanel(Panel* panel) { |
| DCHECK_EQ(this, panel->panel_strip()); |
| + |
| + panel->SetAlwaysOnTop(false); |
| panels_.insert(panel); |
| } |
| @@ -81,27 +83,61 @@ bool DetachedPanelStrip::CanShowPanelAsActive(const Panel* panel) const { |
| return true; |
| } |
| +void DetachedPanelStrip::SavePanelPlacement(Panel* panel) { |
| + DCHECK(!saved_panel_placement_.panel); |
| + saved_panel_placement_.panel = panel; |
| + saved_panel_placement_.position = panel->GetBounds().origin(); |
| +} |
| + |
| +void DetachedPanelStrip::LoadSavedPanelPlacement() { |
| + DCHECK(saved_panel_placement_.panel); |
| + |
| + gfx::Rect new_bounds(saved_panel_placement_.panel->GetBounds()); |
| + new_bounds.set_origin(saved_panel_placement_.position); |
| + saved_panel_placement_.panel->SetPanelBounds(new_bounds); |
| + |
| + saved_panel_placement_.panel = NULL; |
|
jennb
2012/03/03 02:19:33
Should this call DiscardSavedPanelPlacement() inst
jianli
2012/03/07 19:14:31
Done.
|
| +} |
| + |
| +void DetachedPanelStrip::DiscardSavedPanelPlacement() { |
| + DCHECK(saved_panel_placement_.panel); |
| + saved_panel_placement_.panel = NULL; |
| +} |
| + |
| bool DetachedPanelStrip::CanDragPanel(const Panel* panel) const { |
| // All detached panels are draggable. |
| return true; |
| } |
| -void DetachedPanelStrip::StartDraggingPanel(Panel* panel) { |
| +void DetachedPanelStrip::StartDraggingPanelLocally(Panel* panel) { |
| + // Move the panel to this strip if needed. |
| + if (!HasPanel(panel)) { |
|
jennb
2012/03/03 02:19:33
Reminder that you meant to revert this change.
jianli
2012/03/07 19:14:31
Done.
|
| + // TODO(jianli): Remove this when set_panel_strip is part of AddPanel. |
| + panel->set_panel_strip(this); |
| + AddPanel(panel); |
| + } |
| } |
| -void DetachedPanelStrip::DragPanel(Panel* panel, int delta_x, int delta_y) { |
| +void DetachedPanelStrip::DragPanelLocally(Panel* panel, |
| + int delta_x, |
| + int delta_y) { |
| gfx::Rect new_bounds(panel->GetBounds()); |
| new_bounds.Offset(delta_x, delta_y); |
| panel->SetPanelBounds(new_bounds); |
| } |
| -void DetachedPanelStrip::EndDraggingPanel(Panel* panel, bool cancelled) { |
| - if (cancelled) { |
| - gfx::Rect new_bounds(panel->GetBounds()); |
| - new_bounds.set_origin( |
| - panel_manager_->drag_controller()->dragging_panel_original_position()); |
| - panel->SetPanelBounds(new_bounds); |
| - } |
| +void DetachedPanelStrip::EndDraggingPanelLocally(Panel* panel, bool cancelled) { |
| +} |
| + |
| +void DetachedPanelStrip::AddDraggingPanel(Panel* panel, |
|
jennb
2012/03/03 02:19:33
As discussed, separate out moving panels between s
jianli
2012/03/07 19:14:31
Done.
|
| + const gfx::Point& position) { |
| + // TODO(jianli): remove this when set_panel_strip is part of AddPanel. |
| + panel->set_panel_strip(this); |
| + AddPanel(panel); |
| + |
| + gfx::Rect new_bounds(panel->GetBounds()); |
| + new_bounds.set_origin(position); |
| + panel->SetPanelBounds(new_bounds); |
| } |
| bool DetachedPanelStrip::HasPanel(Panel* panel) const { |