Chromium Code Reviews| Index: chrome/browser/ui/panels/docked_panel_strip.h |
| diff --git a/chrome/browser/ui/panels/docked_panel_strip.h b/chrome/browser/ui/panels/docked_panel_strip.h |
| index d26fbedd86c7847aad1f2a4bc180cd35149c6c1b..c3346effabc7b4dbaf3195391c57bb05fdea311b 100644 |
| --- a/chrome/browser/ui/panels/docked_panel_strip.h |
| +++ b/chrome/browser/ui/panels/docked_panel_strip.h |
| @@ -54,10 +54,16 @@ class DockedPanelStrip : public PanelStrip, |
| virtual void RestorePanel(Panel* panel) OVERRIDE; |
| virtual bool IsPanelMinimized(const Panel* panel) const OVERRIDE; |
| virtual bool CanShowPanelAsActive(const Panel* panel) const OVERRIDE; |
| + virtual void SavePanelPlacement(Panel* panel) OVERRIDE; |
| + virtual void RestorePanelToSavedPlacement() OVERRIDE; |
| + virtual void DiscardSavedPanelPlacement() OVERRIDE; |
| virtual bool CanDragPanel(const Panel* panel) const OVERRIDE; |
| - virtual void StartDraggingPanel(Panel* panel) OVERRIDE; |
| - virtual void DragPanel(Panel* panel, int delta_x, int delta_y) OVERRIDE; |
| - virtual void EndDraggingPanel(Panel* panel, bool cancelled) OVERRIDE; |
| + virtual void StartDraggingPanelWithinStrip(Panel* panel) OVERRIDE; |
| + virtual void DragPanelWithinStrip(Panel* panel, |
| + int delta_x, |
| + int delta_y) OVERRIDE; |
| + virtual void EndDraggingPanelWithinStrip(Panel* panel, |
| + bool aborted) OVERRIDE; |
| // Invoked when a panel's expansion state changes. |
| void OnPanelExpansionStateChanged(Panel* panel); |
| @@ -109,9 +115,29 @@ class DockedPanelStrip : public PanelStrip, |
| BRING_DOWN |
| }; |
| + struct PanelPlacement { |
| + Panel* panel; |
| + // Used to remember the panel to the left of |panel|, if any, for use when |
| + // restoring the position of |panel|. Will be updated if this panel is |
| + // closed. |
|
jennb
2012/03/08 23:41:09
or moved out of the dock (e.g. to overflow).
jianli
2012/03/09 21:48:58
Done.
|
| + Panel* left_panel_; |
| + |
| + PanelPlacement() : panel(NULL) { } |
| + }; |
| + |
| // Overridden from PanelMouseWatcherObserver: |
| virtual void OnMouseMove(const gfx::Point& mouse_position) OVERRIDE; |
| + // Helper methods to put the panel to the collection. |
| + void InsertPreviewedPanel(Panel* panel); |
| + void InsertExistingPanel(Panel* panel); |
| + void InsertNewlyCreatedPanel(Panel* panel); |
| + |
| + // Ensures that there is sufficient space in the strip to add a panel with |
| + // the specified width. We might need to bump panels in the strip to make |
| + // room for this panel. |
| + void EnsureAvailableSpace(int width); |
|
jennb
2012/03/08 23:41:09
Should not need this now that you've synced to lat
jianli
2012/03/09 21:48:58
Done.
|
| + |
| // Keep track of the minimized panels to control mouse watching. |
| void IncrementMinimizedPanels(); |
| void DecrementMinimizedPanels(); |
| @@ -141,8 +167,6 @@ class DockedPanelStrip : public PanelStrip, |
| // panels are (at least briefly) visible before entering overflow. |
| void DelayedMovePanelToOverflow(Panel* panel); |
| - Panel* dragging_panel() const; |
| - |
| PanelManager* panel_manager_; // Weak, owns us. |
| // All panels in the panel strip must fit within this area. |
| @@ -161,10 +185,6 @@ class DockedPanelStrip : public PanelStrip, |
| // resides. |
| Panels::iterator dragging_panel_current_iterator_; |
| - // Referring to original position in |panels_| where the dragging panel |
| - // resides. |
| - Panels::iterator dragging_panel_original_iterator_; |
| - |
| // Delayed transitions support. Sometimes transitions between minimized and |
| // title-only states are delayed, for better usability with Taskbars/Docks. |
| TitlebarAction delayed_titlebar_action_; |
| @@ -172,6 +192,9 @@ class DockedPanelStrip : public PanelStrip, |
| // Owned by MessageLoop after posting. |
| base::WeakPtrFactory<DockedPanelStrip> titlebar_action_factory_; |
| + // Used to save the placement information for a panel. |
| + PanelPlacement saved_panel_placement_; |
| + |
| static const int kPanelsHorizontalSpacing = 4; |
| // Absolute minimum width and height for panels, including non-client area. |