blob: 4476ddc99c5f78a28f36bca9a9e71f2cb165be01 [file] [log] [blame]
Torne (Richard Coles)58218062012-11-14 11:43:16 +00001// 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.
4
5#ifndef ASH_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_
6#define ASH_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_
7
8#include <set>
9
10#include "ash/shell_observer.h"
11#include "ash/wm/base_layout_manager.h"
12#include "base/basictypes.h"
13#include "base/compiler_specific.h"
Torne (Richard Coles)58218062012-11-14 11:43:16 +000014#include "ui/base/ui_base_types.h"
15#include "ui/aura/window_observer.h"
16#include "ui/gfx/rect.h"
17
18namespace aura {
19class RootWindow;
20class Window;
21}
22
23namespace ui {
24class Layer;
25}
26
27namespace ash {
28
29namespace internal {
30
Torne (Richard Coles)a36e5922013-08-05 13:57:33 +010031class ShelfLayoutManager;
Torne (Richard Coles)58218062012-11-14 11:43:16 +000032
Torne (Richard Coles)a36e5922013-08-05 13:57:33 +010033// LayoutManager used on the window created for a workspace.
34class ASH_EXPORT WorkspaceLayoutManager : public BaseLayoutManager {
Torne (Richard Coles)58218062012-11-14 11:43:16 +000035 public:
Torne (Richard Coles)a36e5922013-08-05 13:57:33 +010036 explicit WorkspaceLayoutManager(aura::Window* window);
Torne (Richard Coles)58218062012-11-14 11:43:16 +000037 virtual ~WorkspaceLayoutManager();
38
Torne (Richard Coles)a36e5922013-08-05 13:57:33 +010039 void SetShelf(internal::ShelfLayoutManager* shelf);
40
Ben Murdoch558790d2013-07-30 15:19:42 +010041 // Overridden from aura::LayoutManager:
Torne (Richard Coles)58218062012-11-14 11:43:16 +000042 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;
50
Torne (Richard Coles)58218062012-11-14 11:43:16 +000051 // ash::ShellObserver overrides:
52 virtual void OnDisplayWorkAreaInsetsChanged() OVERRIDE;
53
54 // Overriden from WindowObserver:
55 virtual void OnWindowPropertyChanged(aura::Window* window,
56 const void* key,
57 intptr_t old) OVERRIDE;
Torne (Richard Coles)58218062012-11-14 11:43:16 +000058
59 private:
Ben Murdoch558790d2013-07-30 15:19:42 +010060 // Overridden from BaseLayoutManager:
61 virtual void ShowStateChanged(aura::Window* window,
62 ui::WindowShowState last_show_state) OVERRIDE;
Ben Murdochbb1529c2013-08-08 10:24:53 +010063 virtual void AdjustAllWindowsBoundsForWorkAreaChange(
Ben Murdoch558790d2013-07-30 15:19:42 +010064 AdjustWindowReason reason) OVERRIDE;
Ben Murdochbb1529c2013-08-08 10:24:53 +010065 virtual void AdjustWindowBoundsForWorkAreaChange(
Ben Murdoch558790d2013-07-30 15:19:42 +010066 aura::Window* window,
67 AdjustWindowReason reason) OVERRIDE;
Torne (Richard Coles)58218062012-11-14 11:43:16 +000068
Ben Murdochbb1529c2013-08-08 10:24:53 +010069 void AdjustWindowBoundsWhenAdded(aura::Window* window);
70
Torne (Richard Coles)a36e5922013-08-05 13:57:33 +010071 void UpdateDesktopVisibility();
72
Torne (Richard Coles)58218062012-11-14 11:43:16 +000073 // Updates the bounds of the window from a show state change.
74 void UpdateBoundsFromShowState(aura::Window* window);
75
76 // If |window| is maximized or fullscreen the bounds of the window are set and
77 // true is returned. Does nothing otherwise.
78 bool SetMaximizedOrFullscreenBounds(aura::Window* window);
79
Torne (Richard Coles)a36e5922013-08-05 13:57:33 +010080 internal::ShelfLayoutManager* shelf_;
81 aura::Window* window_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +000082
Torne (Richard Coles)58218062012-11-14 11:43:16 +000083 // The work area. Cached to avoid unnecessarily moving windows during a
84 // workspace switch.
85 gfx::Rect work_area_;
86
87 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManager);
88};
89
90} // namespace internal
91} // namespace ash
92
93#endif // ASH_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_