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 acc89a82b5d1b4be30e0eaa9fe95ba9f244da1aa..3be03c009db69e3dbf16d1f7e088d4c2e9929ebf 100644 |
| --- a/chrome/browser/ui/panels/detached_panel_strip.cc |
| +++ b/chrome/browser/ui/panels/detached_panel_strip.cc |
| @@ -37,6 +37,8 @@ void DetachedPanelStrip::AddPanel(Panel* panel) { |
| DCHECK_NE(this, panel->panel_strip()); |
| panel->set_panel_strip(this); |
| panels_.insert(panel); |
| + |
| + panel->SetAlwaysOnTop(false); |
| } |
| void DetachedPanelStrip::RemovePanel(Panel* panel) { |
| @@ -91,27 +93,45 @@ 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::RestorePanelToSavedPlacement() { |
| + 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); |
| + |
| + DiscardSavedPanelPlacement(); |
| +} |
| + |
| +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::StartDraggingPanelWithinStrip(Panel* panel) { |
|
jennb
2012/03/08 23:41:09
dcheck panel is in strip?
jianli
2012/03/09 21:48:58
Done.
|
| } |
| -void DetachedPanelStrip::DragPanel(Panel* panel, int delta_x, int delta_y) { |
| +void DetachedPanelStrip::DragPanelWithinStrip(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::EndDraggingPanelWithinStrip(Panel* panel, |
| + bool aborted) { |
| } |
| bool DetachedPanelStrip::HasPanel(Panel* panel) const { |