Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(830)

Side by Side Diff: ash/common/wm/workspace/workspace_layout_manager.h

Issue 2734653002: chromeos: Move files in //ash/common to //ash (Closed)
Patch Set: fix a11y tests, fix docs Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #ifndef ASH_COMMON_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_
6 #define ASH_COMMON_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_
7
8 #include <memory>
9 #include <set>
10
11 #include "ash/ash_export.h"
12 #include "ash/common/shell_observer.h"
13 #include "ash/common/wm/window_state_observer.h"
14 #include "ash/common/wm/wm_types.h"
15 #include "ash/common/wm_activation_observer.h"
16 #include "ash/common/wm_layout_manager.h"
17 #include "base/macros.h"
18 #include "ui/aura/window_observer.h"
19 #include "ui/display/display_observer.h"
20 #include "ui/gfx/geometry/rect.h"
21 #include "ui/keyboard/keyboard_controller_observer.h"
22
23 namespace ash {
24
25 class RootWindowController;
26 class WmShell;
27 class WmWindow;
28 class WorkspaceLayoutManagerBackdropDelegate;
29
30 namespace wm {
31 class WMEvent;
32 }
33
34 // LayoutManager used on the window created for a workspace.
35 class ASH_EXPORT WorkspaceLayoutManager
36 : public WmLayoutManager,
37 public aura::WindowObserver,
38 public WmActivationObserver,
39 public keyboard::KeyboardControllerObserver,
40 public display::DisplayObserver,
41 public ShellObserver,
42 public wm::WindowStateObserver {
43 public:
44 // |window| is the container for this layout manager.
45 explicit WorkspaceLayoutManager(WmWindow* window);
46 ~WorkspaceLayoutManager() override;
47
48 // A delegate which can be set to add a backdrop behind the top most visible
49 // window. With the call the ownership of the delegate will be transferred to
50 // the WorkspaceLayoutManager.
51 void SetMaximizeBackdropDelegate(
52 std::unique_ptr<WorkspaceLayoutManagerBackdropDelegate> delegate);
53
54 // Overridden from WmLayoutManager:
55 void OnWindowResized() override;
56 void OnWindowAddedToLayout(WmWindow* child) override;
57 void OnWillRemoveWindowFromLayout(WmWindow* child) override;
58 void OnWindowRemovedFromLayout(WmWindow* child) override;
59 void OnChildWindowVisibilityChanged(WmWindow* child, bool visibile) override;
60 void SetChildBounds(WmWindow* child,
61 const gfx::Rect& requested_bounds) override;
62
63 // Overriden from aura::WindowObserver:
64 void OnWindowHierarchyChanged(const HierarchyChangeParams& params) override;
65 void OnWindowPropertyChanged(aura::Window* window,
66 const void* key,
67 intptr_t old) override;
68 void OnWindowStackingChanged(aura::Window* window) override;
69 void OnWindowDestroying(aura::Window* window) override;
70 void OnWindowBoundsChanged(aura::Window* window,
71 const gfx::Rect& old_bounds,
72 const gfx::Rect& new_bounds) override;
73
74 // WmActivationObserver overrides:
75 void OnWindowActivated(WmWindow* gained_active,
76 WmWindow* lost_active) override;
77
78 // keyboard::KeyboardControllerObserver overrides:
79 void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override;
80 void OnKeyboardClosed() override;
81
82 // WindowStateObserver overrides:
83 void OnPostWindowStateTypeChange(wm::WindowState* window_state,
84 wm::WindowStateType old_type) override;
85
86 // display::DisplayObserver overrides:
87 void OnDisplayMetricsChanged(const display::Display& display,
88 uint32_t changed_metrics) override;
89
90 // ShellObserver overrides:
91 void OnFullscreenStateChanged(bool is_fullscreen,
92 WmWindow* root_window) override;
93 void OnPinnedStateChanged(WmWindow* pinned_window) override;
94
95 private:
96 typedef std::set<WmWindow*> WindowSet;
97
98 // Adjusts the bounds of all managed windows when the display area changes.
99 // This happens when the display size, work area insets has changed.
100 // If this is called for a display size change (i.e. |event|
101 // is DISPLAY_RESIZED), the non-maximized/non-fullscreen
102 // windows are readjusted to make sure the window is completely within the
103 // display region. Otherwise, it makes sure at least some parts of the window
104 // is on display.
105 void AdjustAllWindowsBoundsForWorkAreaChange(const wm::WMEvent* event);
106
107 // Updates the visibility state of the shelf.
108 void UpdateShelfVisibility();
109
110 // Updates the fullscreen state of the workspace and notifies Shell if it
111 // has changed.
112 void UpdateFullscreenState();
113
114 // Updates the always-on-top state for windows managed by this layout
115 // manager.
116 void UpdateAlwaysOnTop(WmWindow* window_on_top);
117
118 WmWindow* window_;
119 WmWindow* root_window_;
120 RootWindowController* root_window_controller_;
121 WmShell* shell_;
122
123 // Set of windows we're listening to.
124 WindowSet windows_;
125
126 // The work area in the coordinates of |window_|.
127 gfx::Rect work_area_in_parent_;
128
129 // True if this workspace is currently in fullscreen mode.
130 bool is_fullscreen_;
131
132 // A window which covers the full container and which gets inserted behind the
133 // topmost visible window.
134 std::unique_ptr<WorkspaceLayoutManagerBackdropDelegate> backdrop_delegate_;
135
136 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManager);
137 };
138
139 } // namespace ash
140
141 #endif // ASH_COMMON_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_
OLDNEW
« no previous file with comments | « ash/common/wm/workspace/workspace_event_handler.cc ('k') | ash/common/wm/workspace/workspace_layout_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698