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

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

Issue 2072853002: Implement "pinned" mode in ash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 6 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
« no previous file with comments | « ash/common/wm/window_state.cc ('k') | ash/common/wm/workspace/workspace_layout_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/wm/window_state_observer.h" 13 #include "ash/common/wm/window_state_observer.h"
13 #include "ash/common/wm/wm_types.h" 14 #include "ash/common/wm/wm_types.h"
14 #include "ash/common/wm_activation_observer.h" 15 #include "ash/common/wm_activation_observer.h"
15 #include "ash/common/wm_layout_manager.h" 16 #include "ash/common/wm_layout_manager.h"
16 #include "ash/common/wm_root_window_controller_observer.h" 17 #include "ash/common/wm_root_window_controller_observer.h"
17 #include "ash/common/wm_window_observer.h" 18 #include "ash/common/wm_window_observer.h"
18 #include "base/macros.h" 19 #include "base/macros.h"
19 #include "ui/gfx/geometry/rect.h" 20 #include "ui/gfx/geometry/rect.h"
20 #include "ui/keyboard/keyboard_controller_observer.h" 21 #include "ui/keyboard/keyboard_controller_observer.h"
21 22
22 namespace ash { 23 namespace ash {
23 class WmShell; 24 class WmShell;
24 class WmRootWindowController; 25 class WmRootWindowController;
25 class WorkspaceLayoutManagerBackdropDelegate; 26 class WorkspaceLayoutManagerBackdropDelegate;
26 27
27 namespace wm { 28 namespace wm {
28 class WorkspaceLayoutManagerDelegate; 29 class WorkspaceLayoutManagerDelegate;
29 class WMEvent; 30 class WMEvent;
30 } 31 }
31 32
32 // LayoutManager used on the window created for a workspace. 33 // LayoutManager used on the window created for a workspace.
33 class ASH_EXPORT WorkspaceLayoutManager 34 class ASH_EXPORT WorkspaceLayoutManager
34 : public WmLayoutManager, 35 : public WmLayoutManager,
35 public WmWindowObserver, 36 public WmWindowObserver,
36 public WmActivationObserver, 37 public WmActivationObserver,
37 public keyboard::KeyboardControllerObserver, 38 public keyboard::KeyboardControllerObserver,
38 public WmRootWindowControllerObserver, 39 public WmRootWindowControllerObserver,
40 public ShellObserver,
39 public wm::WindowStateObserver { 41 public wm::WindowStateObserver {
40 public: 42 public:
41 WorkspaceLayoutManager( 43 WorkspaceLayoutManager(
42 WmWindow* window, 44 WmWindow* window,
43 std::unique_ptr<wm::WorkspaceLayoutManagerDelegate> delegate); 45 std::unique_ptr<wm::WorkspaceLayoutManagerDelegate> delegate);
44 46
45 ~WorkspaceLayoutManager() override; 47 ~WorkspaceLayoutManager() override;
46 48
47 void DeleteDelegate(); 49 void DeleteDelegate();
48 50
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 void OnWindowActivated(WmWindow* gained_active, 83 void OnWindowActivated(WmWindow* gained_active,
82 WmWindow* lost_active) override; 84 WmWindow* lost_active) override;
83 85
84 // keyboard::KeyboardControllerObserver overrides: 86 // keyboard::KeyboardControllerObserver overrides:
85 void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override; 87 void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override;
86 88
87 // WindowStateObserver overrides: 89 // WindowStateObserver overrides:
88 void OnPostWindowStateTypeChange(wm::WindowState* window_state, 90 void OnPostWindowStateTypeChange(wm::WindowState* window_state,
89 wm::WindowStateType old_type) override; 91 wm::WindowStateType old_type) override;
90 92
93 // ShellObserver overrides:
94 void OnFullscreenStateChanged(bool is_fullscreen, WmWindow* root) override {
95 // Do nothing. Fullscreen state change is observed by the
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;
101
91 private: 102 private:
92 typedef std::set<WmWindow*> WindowSet; 103 typedef std::set<WmWindow*> WindowSet;
93 104
94 // Adjusts the bounds of all managed windows when the display area changes. 105 // Adjusts the bounds of all managed windows when the display area changes.
95 // This happens when the display size, work area insets has changed. 106 // This happens when the display size, work area insets has changed.
96 // If this is called for a display size change (i.e. |event| 107 // If this is called for a display size change (i.e. |event|
97 // is DISPLAY_RESIZED), the non-maximized/non-fullscreen 108 // is DISPLAY_RESIZED), the non-maximized/non-fullscreen
98 // windows are readjusted to make sure the window is completely within the 109 // windows are readjusted to make sure the window is completely within the
99 // display region. Otherwise, it makes sure at least some parts of the window 110 // display region. Otherwise, it makes sure at least some parts of the window
100 // is on display. 111 // is on display.
101 void AdjustAllWindowsBoundsForWorkAreaChange(const wm::WMEvent* event); 112 void AdjustAllWindowsBoundsForWorkAreaChange(const wm::WMEvent* event);
102 113
103 // Updates the visibility state of the shelf. 114 // Updates the visibility state of the shelf.
104 void UpdateShelfVisibility(); 115 void UpdateShelfVisibility();
105 116
106 // Updates the fullscreen state of the workspace and notifies Shell if it 117 // Updates the fullscreen state of the workspace and notifies Shell if it
107 // has changed. 118 // has changed.
108 void UpdateFullscreenState(); 119 void UpdateFullscreenState();
109 120
110 // Updates the bounds of the window for a stte type change from 121 // Updates the always-on-top state for windows managed by this layout
111 // |old_show_type|. 122 // manager.
112 void UpdateBoundsFromStateType(wm::WindowState* window_state, 123 void UpdateAlwaysOnTop(WmWindow* window_on_top);
113 wm::WindowStateType old_state_type);
114
115 // If |window_state| is maximized or fullscreen the bounds of the
116 // window are set and true is returned. Does nothing otherwise.
117 bool SetMaximizedOrFullscreenBounds(wm::WindowState* window_state);
118
119 // Animates the window bounds to |bounds|.
120 void SetChildBoundsAnimated(WmWindow* child, const gfx::Rect& bounds);
121 124
122 WmWindow* window_; 125 WmWindow* window_;
123 WmWindow* root_window_; 126 WmWindow* root_window_;
124 WmRootWindowController* root_window_controller_; 127 WmRootWindowController* root_window_controller_;
125 WmShell* shell_; 128 WmShell* shell_;
126 129
127 std::unique_ptr<wm::WorkspaceLayoutManagerDelegate> delegate_; 130 std::unique_ptr<wm::WorkspaceLayoutManagerDelegate> delegate_;
128 131
129 // Set of windows we're listening to. 132 // Set of windows we're listening to.
130 WindowSet windows_; 133 WindowSet windows_;
131 134
132 // The work area in the coordinates of |window_|. 135 // The work area in the coordinates of |window_|.
133 gfx::Rect work_area_in_parent_; 136 gfx::Rect work_area_in_parent_;
134 137
135 // True if this workspace is currently in fullscreen mode. 138 // True if this workspace is currently in fullscreen mode.
136 bool is_fullscreen_; 139 bool is_fullscreen_;
137 140
138 // A window which covers the full container and which gets inserted behind the 141 // A window which covers the full container and which gets inserted behind the
139 // topmost visible window. 142 // topmost visible window.
140 std::unique_ptr<WorkspaceLayoutManagerBackdropDelegate> backdrop_delegate_; 143 std::unique_ptr<WorkspaceLayoutManagerBackdropDelegate> backdrop_delegate_;
141 144
142 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManager); 145 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManager);
143 }; 146 };
144 147
145 } // namespace ash 148 } // namespace ash
146 149
147 #endif // ASH_COMMON_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_ 150 #endif // ASH_COMMON_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_
OLDNEW
« no previous file with comments | « ash/common/wm/window_state.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