| Index: ash/common/shelf/wm_shelf.h
|
| diff --git a/ash/common/shelf/wm_shelf.h b/ash/common/shelf/wm_shelf.h
|
| index 4bfd2cfb15b4b0cb641db59fdcc6d089097ba72f..de3c15847b9a70316470e675e0de0d4a35dd2f93 100644
|
| --- a/ash/common/shelf/wm_shelf.h
|
| +++ b/ash/common/shelf/wm_shelf.h
|
| @@ -7,6 +7,8 @@
|
|
|
| #include "ash/ash_export.h"
|
| #include "ash/common/shelf/shelf_types.h"
|
| +#include "ash/shelf/shelf_layout_manager_observer.h"
|
| +#include "base/observer_list.h"
|
|
|
| namespace gfx {
|
| class Rect;
|
| @@ -18,6 +20,8 @@ class GestureEvent;
|
|
|
| namespace ash {
|
|
|
| +class Shelf;
|
| +class ShelfLayoutManager;
|
| class ShelfLockingManager;
|
| class ShelfView;
|
| class WmDimmerView;
|
| @@ -25,13 +29,22 @@ class WmShelfObserver;
|
| class WmWindow;
|
|
|
| // Used for accessing global state.
|
| -class ASH_EXPORT WmShelf {
|
| +class ASH_EXPORT WmShelf : public ShelfLayoutManagerObserver {
|
| public:
|
| + void SetShelf(Shelf* shelf);
|
| + void ClearShelf();
|
| + Shelf* shelf() const { return shelf_; }
|
| +
|
| + virtual void SetShelfLayoutManager(ShelfLayoutManager* manager);
|
| + ShelfLayoutManager* shelf_layout_manager() const {
|
| + return shelf_layout_manager_;
|
| + }
|
| +
|
| // Returns the window showing the shelf.
|
| - virtual WmWindow* GetWindow() = 0;
|
| + WmWindow* GetWindow();
|
|
|
| - virtual ShelfAlignment GetAlignment() const = 0;
|
| - virtual void SetAlignment(ShelfAlignment alignment) = 0;
|
| + ShelfAlignment GetAlignment() const;
|
| + void SetAlignment(ShelfAlignment alignment);
|
|
|
| // Returns true if the shelf alignment is horizontal (i.e. at the bottom).
|
| bool IsHorizontalAlignment() const;
|
| @@ -42,69 +55,90 @@ class ASH_EXPORT WmShelf {
|
| // Returns |horizontal| is shelf is horizontal, otherwise |vertical|.
|
| int PrimaryAxisValue(int horizontal, int vertical) const;
|
|
|
| - virtual ShelfAutoHideBehavior GetAutoHideBehavior() const = 0;
|
| - virtual void SetAutoHideBehavior(ShelfAutoHideBehavior behavior) = 0;
|
| + ShelfAutoHideBehavior GetAutoHideBehavior() const;
|
| + void SetAutoHideBehavior(ShelfAutoHideBehavior behavior);
|
|
|
| - virtual ShelfAutoHideState GetAutoHideState() const = 0;
|
| + ShelfAutoHideState GetAutoHideState() const;
|
|
|
| // Invoke when the auto-hide state may have changed (for example, when the
|
| // system tray bubble opens it should force the shelf to be visible).
|
| - virtual void UpdateAutoHideState() = 0;
|
| + void UpdateAutoHideState();
|
|
|
| - virtual ShelfBackgroundType GetBackgroundType() const = 0;
|
| + ShelfBackgroundType GetBackgroundType() const;
|
|
|
| // Creates a view that dims shelf items. The returned view is owned by its
|
| // widget. Returns null if shelf dimming is not supported (e.g. on mus).
|
| // TODO(jamescook): Delete this after material design ships, as MD will not
|
| // require shelf dimming. http://crbug.com/614453
|
| - virtual WmDimmerView* CreateDimmerView(bool disable_animations_for_test) = 0;
|
| + virtual WmDimmerView* CreateDimmerView(bool disable_animations_for_test);
|
|
|
| // Shelf items are slightly dimmed (e.g. when a window is maximized).
|
| // TODO(jamescook): Delete this after material design ships, as MD will not
|
| // require shelf dimming. http://crbug.com/614453
|
| - virtual bool IsDimmed() const = 0;
|
| + bool IsDimmed() const;
|
|
|
| // Schedules a repaint for all shelf buttons.
|
| // TODO(jamescook): Eliminate when ShelfView moves to //ash/common.
|
| // http://crbug.com/615155
|
| - virtual void SchedulePaint() = 0;
|
| + void SchedulePaint();
|
|
|
| // Whether the shelf view is visible.
|
| // TODO(jamescook): Consolidate this with GetVisibilityState().
|
| - virtual bool IsVisible() const = 0;
|
| + bool IsVisible() const;
|
|
|
| - virtual void UpdateVisibilityState() = 0;
|
| + void UpdateVisibilityState();
|
|
|
| - virtual ShelfVisibilityState GetVisibilityState() const = 0;
|
| + ShelfVisibilityState GetVisibilityState() const;
|
|
|
| // Returns the ideal bounds of the shelf assuming it is visible.
|
| - virtual gfx::Rect GetIdealBounds() = 0;
|
| + gfx::Rect GetIdealBounds();
|
|
|
| - virtual gfx::Rect GetUserWorkAreaBounds() const = 0;
|
| + gfx::Rect GetUserWorkAreaBounds() const;
|
|
|
| - virtual void UpdateIconPositionForWindow(WmWindow* window) = 0;
|
| + void UpdateIconPositionForWindow(WmWindow* window);
|
|
|
| // Returns the screen bounds of the item for the specified window. If there is
|
| // no item for the specified window an empty rect is returned.
|
| - virtual gfx::Rect GetScreenBoundsOfItemIconForWindow(WmWindow* window) = 0;
|
| + gfx::Rect GetScreenBoundsOfItemIconForWindow(WmWindow* window);
|
|
|
| // Handles a gesture |event| coming from a source outside the shelf widget
|
| // (e.g. the status area widget). Allows support for behaviors like toggling
|
| // auto-hide with a swipe, even if that gesture event hits another window.
|
| // Returns true if the event was handled.
|
| - virtual bool ProcessGestureEvent(const ui::GestureEvent& event) = 0;
|
| + bool ProcessGestureEvent(const ui::GestureEvent& event);
|
|
|
| - virtual void AddObserver(WmShelfObserver* observer) = 0;
|
| - virtual void RemoveObserver(WmShelfObserver* observer) = 0;
|
| + void AddObserver(WmShelfObserver* observer);
|
| + void RemoveObserver(WmShelfObserver* observer);
|
|
|
| - // Simulates a virtual keyboard bounds update.
|
| - virtual void SetKeyboardBoundsForTesting(const gfx::Rect& bounds) = 0;
|
| + void NotifyShelfIconPositionsChanged();
|
|
|
| - virtual ShelfLockingManager* GetShelfLockingManagerForTesting() = 0;
|
| - virtual ShelfView* GetShelfViewForTesting() = 0;
|
| + void SetVirtualKeyboardBoundsForTesting(const gfx::Rect& bounds);
|
| + ShelfLockingManager* GetShelfLockingManagerForTesting();
|
| + ShelfView* GetShelfViewForTesting();
|
|
|
| protected:
|
| - virtual ~WmShelf() {}
|
| + WmShelf();
|
| + ~WmShelf() override;
|
| +
|
| + // ShelfLayoutManagerObserver:
|
| + void WillDeleteShelfLayoutManager() override;
|
| + void WillChangeVisibilityState(ShelfVisibilityState new_state) override;
|
| + void OnAutoHideStateChanged(ShelfAutoHideState new_state) override;
|
| + void OnBackgroundUpdated(ShelfBackgroundType background_type,
|
| + BackgroundAnimatorChangeType change_type) override;
|
| +
|
| + private:
|
| + // Legacy shelf controller. Null before login and in secondary display init.
|
| + // Instance lifetimes are managed by ash::RootWindowController and WmShelfMus.
|
| + Shelf* shelf_ = nullptr;
|
| +
|
| + // Layout manager for the shelf container window. Instances are constructed by
|
| + // ShelfWidget and lifetimes are managed by the container windows themselves.
|
| + ShelfLayoutManager* shelf_layout_manager_ = nullptr;
|
| +
|
| + base::ObserverList<WmShelfObserver> observers_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(WmShelf);
|
| };
|
|
|
| } // namespace ash
|
|
|