1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef ASH_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_
6 #define ASH_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_
10 #include "ash/shell_observer.h"
11 #include "ash/wm/base_layout_manager.h"
12 #include "ash/wm/wm_types.h"
13 #include "base/basictypes.h"
14 #include "base/compiler_specific.h"
15 #include "ui/aura/window_observer.h"
16 #include "ui/gfx/rect.h"
31 class ShelfLayoutManager;
33 // LayoutManager used on the window created for a workspace.
34 class ASH_EXPORT WorkspaceLayoutManager : public BaseLayoutManager {
36 explicit WorkspaceLayoutManager(aura::Window* window);
37 virtual ~WorkspaceLayoutManager();
39 void SetShelf(internal::ShelfLayoutManager* shelf);
41 // Overridden from aura::LayoutManager:
42 virtual void OnWindowResized() OVERRIDE {}
43 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE;
44 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE;
45 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE;
46 virtual void OnChildWindowVisibilityChanged(aura::Window* child,
47 bool visibile) OVERRIDE;
48 virtual void SetChildBounds(aura::Window* child,
49 const gfx::Rect& requested_bounds) OVERRIDE;
51 // ash::ShellObserver overrides:
52 virtual void OnDisplayWorkAreaInsetsChanged() OVERRIDE;
54 // Overriden from WindowObserver:
55 virtual void OnWindowPropertyChanged(aura::Window* window,
57 intptr_t old) OVERRIDE;
58 virtual void OnWindowStackingChanged(aura::Window* window) OVERRIDE;
60 // WindowStateObserver overrides:
61 virtual void OnWindowShowTypeChanged(wm::WindowState* window_state,
62 wm::WindowShowType old_type) OVERRIDE;
65 // Overridden from BaseLayoutManager:
66 virtual void AdjustAllWindowsBoundsForWorkAreaChange(
67 AdjustWindowReason reason) OVERRIDE;
68 virtual void AdjustWindowBoundsForWorkAreaChange(
69 wm::WindowState* window_state,
70 AdjustWindowReason reason) OVERRIDE;
72 void AdjustWindowBoundsWhenAdded(wm::WindowState* window_state);
74 // Updates the visibility state of the shelf.
75 void UpdateShelfVisibility();
77 // Updates the fullscreen state of the workspace and notifies Shell if it
79 void UpdateFullscreenState();
81 // Updates the bounds of the window for a show type change from
83 void UpdateBoundsFromShowType(wm::WindowState* window_state,
84 wm::WindowShowType old_show_type);
86 // If |window_state| is maximized or fullscreen the bounds of the
87 // window are set and true is returned. Does nothing otherwise.
88 bool SetMaximizedOrFullscreenBounds(wm::WindowState* window_state);
90 // Adjusts the |bounds| so that they are flush with the edge of the
91 // workspace if the window represented by |window_state| is side snapped.
92 void AdjustSnappedBounds(wm::WindowState* window_state, gfx::Rect* bounds);
94 // Animates the window bounds to |bounds|.
95 void SetChildBoundsAnimated(aura::Window* child, const gfx::Rect& bounds);
97 internal::ShelfLayoutManager* shelf_;
98 aura::Window* window_;
100 // The work area in the coordinates of |window_|.
101 gfx::Rect work_area_in_parent_;
103 // True if this workspace is currently in fullscreen mode.
106 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManager);
109 } // namespace internal
112 #endif // ASH_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_