| Index: chrome/browser/ui/panels/panel_manager.h
|
| ===================================================================
|
| --- chrome/browser/ui/panels/panel_manager.h (revision 97392)
|
| +++ chrome/browser/ui/panels/panel_manager.h (working copy)
|
| @@ -8,7 +8,10 @@
|
|
|
| #include <vector>
|
| #include "base/basictypes.h"
|
| +#include "base/memory/ref_counted.h"
|
| #include "base/memory/scoped_ptr.h"
|
| +#include "base/task.h"
|
| +#include "chrome/browser/ui/panels/auto_hide_bottom_bar.h"
|
| #include "chrome/browser/ui/panels/panel.h"
|
| #include "ui/gfx/rect.h"
|
|
|
| @@ -16,7 +19,8 @@
|
| class Panel;
|
|
|
| // This class manages a set of panels.
|
| -class PanelManager {
|
| +class PanelManager : public AutoHideBottomBar::Observer,
|
| + public base::RefCountedThreadSafe<PanelManager> {
|
| public:
|
| // Returns a single instance.
|
| static PanelManager* GetInstance();
|
| @@ -39,22 +43,43 @@
|
| void EndDragging(bool cancelled);
|
|
|
| // Should we bring up the titlebar, given the current mouse point?
|
| - bool ShouldBringUpTitlebarForAllMinimizedPanels(int mouse_x,
|
| - int mouse_y) const;
|
| + bool ShouldBringUpTitlebars(int mouse_x, int mouse_y) const;
|
|
|
| - // Brings up or down the title-bar for all minimized panels.
|
| - void BringUpOrDownTitlebarForAllMinimizedPanels(bool bring_up);
|
| + // Brings up or down the titlebars for all minimized panels.
|
| + void BringUpOrDownTitlebars(bool bring_up);
|
|
|
| + // Returns the bottom position for the panel per its expansion state. If auto-
|
| + // hide bottom bar is present, we want to move the minimized panel to the
|
| + // bottom of the screen, not the bottom of the work area.
|
| + int GetBottomPositionForExpansionState(
|
| + Panel::ExpansionState expansion_state) const;
|
| +
|
| int num_panels() const { return panels_.size(); }
|
| bool is_dragging_panel() const;
|
|
|
| private:
|
| - friend class PanelBrowserTest;
|
| + friend class BasePanelBrowserTest;
|
|
|
| + enum DelayedTitlebarAction {
|
| + NO_ACTION,
|
| + BRING_UP,
|
| + BRING_DOWN
|
| + };
|
| +
|
| typedef std::vector<Panel*> Panels;
|
|
|
| + // For testing only.
|
| + static void CreateForTesting(const gfx::Rect& work_area,
|
| + AutoHideBottomBar* auto_hide_bottom_bar);
|
| +
|
| PanelManager();
|
| + void Init();
|
|
|
| + // Overridden from AutoHideBottomBar::Observer:
|
| + virtual void OnAutoHideBottomBarVisibilityChanged(
|
| + AutoHideBottomBar::Visibility visibility) OVERRIDE;
|
| + virtual void OnAutoHideBottomBarHeightChanged(int height) OVERRIDE;
|
| +
|
| // Applies the new work area. This is called by OnDisplayChanged and the test
|
| // code.
|
| void SetWorkArea(const gfx::Rect& work_area);
|
| @@ -84,6 +109,9 @@
|
| void DragLeft();
|
| void DragRight();
|
|
|
| + void DelayedBringUpOrDownTitlebarsCheck();
|
| + void DoBringUpOrDownTitlebars(bool bring_up);
|
| +
|
| Panels panels_;
|
|
|
| // Stores the panels that are pending to remove. We want to delay the removal
|
| @@ -91,14 +119,16 @@
|
| Panels panels_pending_to_remove_;
|
|
|
| // Current work area used in computing the panel bounds.
|
| + // If the always-on-top bottom bar, like Windows taskbar or MacOSX dock, is
|
| + // always visible, it should not be included in the work area. Otherwise, the
|
| + // work area includes the potential area that would be taken by the bottom
|
| + // bar when it becomes visible.
|
| gfx::Rect work_area_;
|
|
|
| // Used in computing the bounds of the next panel.
|
| int max_width_;
|
| int max_height_;
|
| - int min_x_;
|
| int current_x_;
|
| - int bottom_edge_y_;
|
|
|
| // Panel to drag.
|
| size_t dragging_panel_index_;
|
| @@ -112,6 +142,12 @@
|
| // to when the dragging ends.
|
| gfx::Rect dragging_panel_bounds_;
|
|
|
| + scoped_refptr<AutoHideBottomBar> auto_hide_bottom_bar_;
|
| +
|
| + DelayedTitlebarAction delayed_titlebar_action_;
|
| +
|
| + ScopedRunnableMethodFactory<PanelManager> method_factory_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(PanelManager);
|
| };
|
|
|
|
|