Chromium Code Reviews| Index: ash/wm/panels/panel_layout_manager.h |
| diff --git a/ash/wm/panels/panel_layout_manager.h b/ash/wm/panels/panel_layout_manager.h |
| index d8f8c84c09d9df694917661c047a8ef70ff6eb2e..b94260972502474c3dd79102afe569d231e3504c 100644 |
| --- a/ash/wm/panels/panel_layout_manager.h |
| +++ b/ash/wm/panels/panel_layout_manager.h |
| @@ -9,20 +9,22 @@ |
| #include <memory> |
| #include "ash/ash_export.h" |
| -#include "ash/display/window_tree_host_manager.h" |
| #include "ash/shelf/shelf_icon_observer.h" |
| #include "ash/shelf/shelf_layout_manager_observer.h" |
| #include "ash/shell_observer.h" |
| +#include "ash/wm/common/wm_activation_observer.h" |
| +#include "ash/wm/common/wm_display_observer.h" |
| +#include "ash/wm/common/wm_layout_manager.h" |
| +#include "ash/wm/common/wm_overview_mode_observer.h" |
| +#include "ash/wm/common/wm_root_window_controller_observer.h" |
| +#include "ash/wm/common/wm_window_observer.h" |
| +#include "ash/wm/common/wm_window_tracker.h" |
| #include "ash/wm/window_state_observer.h" |
| #include "base/compiler_specific.h" |
| #include "base/macros.h" |
| #include "base/memory/weak_ptr.h" |
| -#include "ui/aura/layout_manager.h" |
| -#include "ui/aura/window_observer.h" |
| -#include "ui/aura/window_tracker.h" |
| #include "ui/keyboard/keyboard_controller.h" |
| #include "ui/keyboard/keyboard_controller_observer.h" |
| -#include "ui/wm/public/activation_change_observer.h" |
| namespace aura { |
| class Window; |
| @@ -41,6 +43,10 @@ class PanelCalloutWidget; |
| class Shelf; |
| class ShelfLayoutManager; |
| +namespace wm { |
| +class WmRootWindowController; |
| +} |
| + |
| // PanelLayoutManager is responsible for organizing panels within the |
| // workspace. It is associated with a specific container window (i.e. |
| // kShellWindowId_PanelContainer) and controls the layout of any windows |
| @@ -51,67 +57,72 @@ class ShelfLayoutManager; |
| // panel_container->SetLayoutManager(new PanelLayoutManager(panel_container)); |
| class ASH_EXPORT PanelLayoutManager |
| - : public aura::LayoutManager, |
| + : public wm::WmLayoutManager, |
| public ShelfIconObserver, |
| - public ShellObserver, |
| - public aura::WindowObserver, |
| public wm::WindowStateObserver, |
| - public aura::client::ActivationChangeObserver, |
| + public wm::WmActivationObserver, |
| + public wm::WmDisplayObserver, |
| + public wm::WmOverviewModeObserver, |
| + public wm::WmRootWindowControllerObserver, |
| + public wm::WmWindowObserver, |
| public keyboard::KeyboardControllerObserver, |
| - public WindowTreeHostManager::Observer, |
| public ShelfLayoutManagerObserver { |
| public: |
| - explicit PanelLayoutManager(aura::Window* panel_container); |
| + explicit PanelLayoutManager(wm::WmWindow* panel_container); |
| ~PanelLayoutManager() override; |
| + // Returns the PanelLayoutManager in the specified hierarchy. This searches |
| + // from the root of |window|. |
| + static PanelLayoutManager* Get(wm::WmWindow* window); |
| + |
| // Call Shutdown() before deleting children of panel_container. |
| void Shutdown(); |
| - void StartDragging(aura::Window* panel); |
| + void StartDragging(wm::WmWindow* panel); |
| void FinishDragging(); |
| - void ToggleMinimize(aura::Window* panel); |
| + void ToggleMinimize(wm::WmWindow* panel); |
| // Hide / Show the panel callout widgets. |
| void SetShowCalloutWidgets(bool show); |
| // Returns the callout widget (arrow) for |panel|. |
| - views::Widget* GetCalloutWidgetForPanel(aura::Window* panel); |
| + views::Widget* GetCalloutWidgetForPanel(wm::WmWindow* panel); |
| Shelf* shelf() { return shelf_; } |
| void SetShelf(Shelf* shelf); |
| // Overridden from aura::LayoutManager: |
| void OnWindowResized() override; |
| - void OnWindowAddedToLayout(aura::Window* child) override; |
| - void OnWillRemoveWindowFromLayout(aura::Window* child) override; |
| - void OnWindowRemovedFromLayout(aura::Window* child) override; |
| - void OnChildWindowVisibilityChanged(aura::Window* child, |
| + void OnWindowAddedToLayout(wm::WmWindow* child) override; |
| + void OnWillRemoveWindowFromLayout(wm::WmWindow* child) override; |
| + void OnWindowRemovedFromLayout(wm::WmWindow* child) override; |
| + void OnChildWindowVisibilityChanged(wm::WmWindow* child, |
| bool visibile) override; |
| - void SetChildBounds(aura::Window* child, |
| + void SetChildBounds(wm::WmWindow* child, |
| const gfx::Rect& requested_bounds) override; |
| // Overridden from ShelfIconObserver |
| void OnShelfIconPositionsChanged() override; |
| - // Overridden from ShellObserver |
| + // Overridden from wm::WmOverviewModeObserver |
| void OnOverviewModeEnded() override; |
| - void OnShelfAlignmentChanged(aura::Window* root_window) override; |
| - // Overridden from aura::WindowObserver |
| - void OnWindowPropertyChanged(aura::Window* window, |
| - const void* key, |
| + // Overridden from wm::WmRootWindowControllerObserver: |
|
James Cook
2016/04/25 17:16:05
super-nit: Either all the "overridden" lines shoul
sky
2016/04/25 18:17:57
Done.
|
| + void OnShelfAlignmentChanged() override; |
| + |
| + // Overridden from wm::WmWindowObserver |
| + void OnWindowPropertyChanged(wm::WmWindow* window, |
| + wm::WmWindowProperty property, |
|
James Cook
2016/04/25 17:16:05
Hooray for real types! :-)
|
| intptr_t old) override; |
| - // Overridden from ash::wm::WindowStateObserver |
| + // Overridden from wm::WindowStateObserver |
| void OnPostWindowStateTypeChange(wm::WindowState* window_state, |
| wm::WindowStateType old_type) override; |
| - // Overridden from aura::client::ActivationChangeObserver |
| - void OnWindowActivated( |
| - aura::client::ActivationChangeObserver::ActivationReason reason, |
| - aura::Window* gained_active, |
| - aura::Window* lost_active) override; |
| + // Overridden from wm::WmActivationObserver |
| + void OnWindowActivated(wm::WmWindow* gained_active, |
| + wm::WmWindow* lost_active) override; |
| // Overridden from WindowTreeHostManager::Observer |
| void OnDisplayConfigurationChanged() override; |
| @@ -129,15 +140,19 @@ class ASH_EXPORT PanelLayoutManager |
| views::Widget* CreateCalloutWidget(); |
| - struct PanelInfo{ |
| + struct ASH_EXPORT PanelInfo { |
| PanelInfo() : window(NULL), callout_widget(NULL), slide_in(false) {} |
| - bool operator==(const aura::Window* other_window) const { |
| + bool operator==(const wm::WmWindow* other_window) const { |
| return window == other_window; |
| } |
| + // Returns |callout_widget| as a widget. Used by tests. |
| + views::Widget* CalloutWidget(); |
| + |
| // A weak pointer to the panel window. |
| - aura::Window* window; |
| + wm::WmWindow* window; |
| + |
| // The callout widget for this panel. This pointer must be managed |
| // manually as this structure is used in a std::list. See |
| // http://www.chromium.org/developers/smart-pointer-guidelines |
| @@ -151,15 +166,15 @@ class ASH_EXPORT PanelLayoutManager |
| typedef std::list<PanelInfo> PanelList; |
| - void MinimizePanel(aura::Window* panel); |
| - void RestorePanel(aura::Window* panel); |
| + void MinimizePanel(wm::WmWindow* panel); |
| + void RestorePanel(wm::WmWindow* panel); |
| // Called whenever the panel layout might change. |
| void Relayout(); |
| // Called whenever the panel stacking order needs to be updated (e.g. focus |
| // changes or a panel is moved). |
| - void UpdateStacking(aura::Window* active_panel); |
| + void UpdateStacking(wm::WmWindow* active_panel); |
| // Update the callout arrows for all managed panels. |
| void UpdateCallouts(); |
| @@ -168,7 +183,10 @@ class ASH_EXPORT PanelLayoutManager |
| void OnKeyboardBoundsChanging(const gfx::Rect& keyboard_bounds) override; |
| // Parent window associated with this layout manager. |
| - aura::Window* panel_container_; |
| + wm::WmWindow* panel_container_; |
| + |
| + wm::WmRootWindowController* root_window_controller_; |
| + |
| // Protect against recursive calls to OnWindowAddedToLayout(). |
| bool in_add_window_; |
| // Protect against recursive calls to Relayout(). |
| @@ -178,7 +196,7 @@ class ASH_EXPORT PanelLayoutManager |
| // Ordered list of unowned pointers to panel windows. |
| PanelList panel_windows_; |
| // The panel being dragged. |
| - aura::Window* dragged_panel_; |
| + wm::WmWindow* dragged_panel_; |
| // The shelf we are observing for shelf icon changes. |
| Shelf* shelf_; |
| // The shelf layout manager being observed for visibility changes. |
| @@ -187,11 +205,11 @@ class ASH_EXPORT PanelLayoutManager |
| // When not NULL, the shelf is hidden (i.e. full screen) and this tracks the |
| // set of panel windows which have been temporarily hidden and need to be |
| // restored when the shelf becomes visible again. |
| - std::unique_ptr<aura::WindowTracker> restore_windows_on_shelf_visible_; |
| + std::unique_ptr<wm::WmWindowTracker> restore_windows_on_shelf_visible_; |
| // The last active panel. Used to maintain stacking order even if no panels |
| // are currently focused. |
| - aura::Window* last_active_panel_; |
| + wm::WmWindow* last_active_panel_; |
| base::WeakPtrFactory<PanelLayoutManager> weak_factory_; |
| DISALLOW_COPY_AND_ASSIGN(PanelLayoutManager); |