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

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

Issue 2234033002: mash: Remove WorkspaceLayoutManagerDelegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove WmRootWindowControllerObserver::OnFullscreenStateChanged; use ShellObserver. Created 4 years, 4 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ASH_COMMON_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_ 5 #ifndef ASH_COMMON_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_
6 #define ASH_COMMON_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_ 6 #define ASH_COMMON_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 10
11 #include "ash/ash_export.h" 11 #include "ash/ash_export.h"
12 #include "ash/common/shell_observer.h" 12 #include "ash/common/shell_observer.h"
13 #include "ash/common/wm/window_state_observer.h" 13 #include "ash/common/wm/window_state_observer.h"
14 #include "ash/common/wm/wm_types.h" 14 #include "ash/common/wm/wm_types.h"
15 #include "ash/common/wm_activation_observer.h" 15 #include "ash/common/wm_activation_observer.h"
16 #include "ash/common/wm_layout_manager.h" 16 #include "ash/common/wm_layout_manager.h"
17 #include "ash/common/wm_root_window_controller_observer.h" 17 #include "ash/common/wm_root_window_controller_observer.h"
18 #include "ash/common/wm_window_observer.h" 18 #include "ash/common/wm_window_observer.h"
19 #include "base/macros.h" 19 #include "base/macros.h"
20 #include "ui/gfx/geometry/rect.h" 20 #include "ui/gfx/geometry/rect.h"
21 #include "ui/keyboard/keyboard_controller_observer.h" 21 #include "ui/keyboard/keyboard_controller_observer.h"
22 22
23 namespace ash { 23 namespace ash {
24 class WmShell; 24 class WmShell;
25 class WmRootWindowController; 25 class WmRootWindowController;
26 class WorkspaceLayoutManagerBackdropDelegate; 26 class WorkspaceLayoutManagerBackdropDelegate;
27 27
28 namespace wm { 28 namespace wm {
29 class WorkspaceLayoutManagerDelegate;
30 class WMEvent; 29 class WMEvent;
31 } 30 }
32 31
33 // LayoutManager used on the window created for a workspace. 32 // LayoutManager used on the window created for a workspace.
34 class ASH_EXPORT WorkspaceLayoutManager 33 class ASH_EXPORT WorkspaceLayoutManager
35 : public WmLayoutManager, 34 : public WmLayoutManager,
36 public WmWindowObserver, 35 public WmWindowObserver,
37 public WmActivationObserver, 36 public WmActivationObserver,
38 public keyboard::KeyboardControllerObserver, 37 public keyboard::KeyboardControllerObserver,
39 public WmRootWindowControllerObserver, 38 public WmRootWindowControllerObserver,
40 public ShellObserver, 39 public ShellObserver,
41 public wm::WindowStateObserver { 40 public wm::WindowStateObserver {
42 public: 41 public:
43 WorkspaceLayoutManager( 42 // |window| is the container for this layout manager.
44 WmWindow* window, 43 explicit WorkspaceLayoutManager(WmWindow* window);
45 std::unique_ptr<wm::WorkspaceLayoutManagerDelegate> delegate);
46
47 ~WorkspaceLayoutManager() override; 44 ~WorkspaceLayoutManager() override;
48 45
49 void DeleteDelegate();
50
51 // A delegate which can be set to add a backdrop behind the top most visible 46 // A delegate which can be set to add a backdrop behind the top most visible
52 // window. With the call the ownership of the delegate will be transferred to 47 // window. With the call the ownership of the delegate will be transferred to
53 // the WorkspaceLayoutManager. 48 // the WorkspaceLayoutManager.
54 void SetMaximizeBackdropDelegate( 49 void SetMaximizeBackdropDelegate(
55 std::unique_ptr<WorkspaceLayoutManagerBackdropDelegate> delegate); 50 std::unique_ptr<WorkspaceLayoutManagerBackdropDelegate> delegate);
56 51
57 // Overridden from WmLayoutManager: 52 // Overridden from WmLayoutManager:
58 void OnWindowResized() override; 53 void OnWindowResized() override;
59 void OnWindowAddedToLayout(WmWindow* child) override; 54 void OnWindowAddedToLayout(WmWindow* child) override;
60 void OnWillRemoveWindowFromLayout(WmWindow* child) override; 55 void OnWillRemoveWindowFromLayout(WmWindow* child) override;
61 void OnWindowRemovedFromLayout(WmWindow* child) override; 56 void OnWindowRemovedFromLayout(WmWindow* child) override;
62 void OnChildWindowVisibilityChanged(WmWindow* child, bool visibile) override; 57 void OnChildWindowVisibilityChanged(WmWindow* child, bool visibile) override;
63 void SetChildBounds(WmWindow* child, 58 void SetChildBounds(WmWindow* child,
64 const gfx::Rect& requested_bounds) override; 59 const gfx::Rect& requested_bounds) override;
65 60
66 // WmRootWindowControllerObserver overrides: 61 // WmRootWindowControllerObserver overrides:
67 void OnWorkAreaChanged() override; 62 void OnWorkAreaChanged() override;
68 void OnFullscreenStateChanged(bool is_fullscreen) override;
69 63
70 // Overriden from WmWindowObserver: 64 // Overriden from WmWindowObserver:
71 void OnWindowTreeChanged( 65 void OnWindowTreeChanged(
72 WmWindow* window, 66 WmWindow* window,
73 const WmWindowObserver::TreeChangeParams& params) override; 67 const WmWindowObserver::TreeChangeParams& params) override;
74 void OnWindowPropertyChanged(WmWindow* window, 68 void OnWindowPropertyChanged(WmWindow* window,
75 WmWindowProperty property) override; 69 WmWindowProperty property) override;
76 void OnWindowStackingChanged(WmWindow* window) override; 70 void OnWindowStackingChanged(WmWindow* window) override;
77 void OnWindowDestroying(WmWindow* window) override; 71 void OnWindowDestroying(WmWindow* window) override;
78 void OnWindowBoundsChanged(WmWindow* window, 72 void OnWindowBoundsChanged(WmWindow* window,
79 const gfx::Rect& old_bounds, 73 const gfx::Rect& old_bounds,
80 const gfx::Rect& new_bounds) override; 74 const gfx::Rect& new_bounds) override;
81 75
82 // WmActivationObserver overrides: 76 // WmActivationObserver overrides:
83 void OnWindowActivated(WmWindow* gained_active, 77 void OnWindowActivated(WmWindow* gained_active,
84 WmWindow* lost_active) override; 78 WmWindow* lost_active) override;
85 79
86 // keyboard::KeyboardControllerObserver overrides: 80 // keyboard::KeyboardControllerObserver overrides:
87 void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override; 81 void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override;
88 82
89 // WindowStateObserver overrides: 83 // WindowStateObserver overrides:
90 void OnPostWindowStateTypeChange(wm::WindowState* window_state, 84 void OnPostWindowStateTypeChange(wm::WindowState* window_state,
91 wm::WindowStateType old_type) override; 85 wm::WindowStateType old_type) override;
92 86
93 // ShellObserver overrides: 87 // ShellObserver overrides:
94 void OnFullscreenStateChanged(bool is_fullscreen, WmWindow* root) override { 88 void OnFullscreenStateChanged(bool is_fullscreen,
95 // Do nothing. Fullscreen state change is observed by the 89 WmWindow* root_window) override;
96 // WmRootWindowControllerObserver::OnFullscreenStateChanged().
97 // Because the name is conflicting, some compiler warns because this is
98 // hidden. To avoid it, we define it here, with empty body.
99 }
100 void OnPinnedStateChanged(WmWindow* pinned_window) override; 90 void OnPinnedStateChanged(WmWindow* pinned_window) override;
101 91
102 private: 92 private:
103 typedef std::set<WmWindow*> WindowSet; 93 typedef std::set<WmWindow*> WindowSet;
104 94
105 // Adjusts the bounds of all managed windows when the display area changes. 95 // Adjusts the bounds of all managed windows when the display area changes.
106 // This happens when the display size, work area insets has changed. 96 // This happens when the display size, work area insets has changed.
107 // If this is called for a display size change (i.e. |event| 97 // If this is called for a display size change (i.e. |event|
108 // is DISPLAY_RESIZED), the non-maximized/non-fullscreen 98 // is DISPLAY_RESIZED), the non-maximized/non-fullscreen
109 // windows are readjusted to make sure the window is completely within the 99 // windows are readjusted to make sure the window is completely within the
(...skipping 10 matching lines...) Expand all
120 110
121 // Updates the always-on-top state for windows managed by this layout 111 // Updates the always-on-top state for windows managed by this layout
122 // manager. 112 // manager.
123 void UpdateAlwaysOnTop(WmWindow* window_on_top); 113 void UpdateAlwaysOnTop(WmWindow* window_on_top);
124 114
125 WmWindow* window_; 115 WmWindow* window_;
126 WmWindow* root_window_; 116 WmWindow* root_window_;
127 WmRootWindowController* root_window_controller_; 117 WmRootWindowController* root_window_controller_;
128 WmShell* shell_; 118 WmShell* shell_;
129 119
130 std::unique_ptr<wm::WorkspaceLayoutManagerDelegate> delegate_;
131
132 // Set of windows we're listening to. 120 // Set of windows we're listening to.
133 WindowSet windows_; 121 WindowSet windows_;
134 122
135 // The work area in the coordinates of |window_|. 123 // The work area in the coordinates of |window_|.
136 gfx::Rect work_area_in_parent_; 124 gfx::Rect work_area_in_parent_;
137 125
138 // True if this workspace is currently in fullscreen mode. 126 // True if this workspace is currently in fullscreen mode.
139 bool is_fullscreen_; 127 bool is_fullscreen_;
140 128
141 // A window which covers the full container and which gets inserted behind the 129 // A window which covers the full container and which gets inserted behind the
142 // topmost visible window. 130 // topmost visible window.
143 std::unique_ptr<WorkspaceLayoutManagerBackdropDelegate> backdrop_delegate_; 131 std::unique_ptr<WorkspaceLayoutManagerBackdropDelegate> backdrop_delegate_;
144 132
145 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManager); 133 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManager);
146 }; 134 };
147 135
148 } // namespace ash 136 } // namespace ash
149 137
150 #endif // ASH_COMMON_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_ 138 #endif // ASH_COMMON_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_
OLDNEW
« no previous file with comments | « ash/common/wm/dock/docked_window_layout_manager.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