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

Side by Side Diff: ash/wm/maximize_mode/maximize_mode_window_manager.h

Issue 2103913003: Converts MaximizeModeWindowManager to use ash/common types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@maximize_mode_event_handler
Patch Set: fix chrome Created 4 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_WINDOW_MANAGER_H_ 5 #ifndef ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_WINDOW_MANAGER_H_
6 #define ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_WINDOW_MANAGER_H_ 6 #define ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_WINDOW_MANAGER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
11 #include <set> 11 #include <set>
12 12
13 #include "ash/ash_export.h" 13 #include "ash/ash_export.h"
14 #include "ash/common/shell_observer.h" 14 #include "ash/common/shell_observer.h"
15 #include "ash/common/wm/window_state.h" 15 #include "ash/common/wm/window_state.h"
16 #include "base/compiler_specific.h" 16 #include "ash/common/wm_window_observer.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "ui/aura/window_observer.h"
19 #include "ui/display/display_observer.h" 18 #include "ui/display/display_observer.h"
20 19
21 namespace ash { 20 namespace ash {
22 class MaximizeModeController; 21 class MaximizeModeController;
23 class MaximizeModeWindowState; 22 class MaximizeModeWindowState;
24 class WmWindow;
25 23
26 namespace wm { 24 namespace wm {
27 class MaximizeModeEventHandler; 25 class MaximizeModeEventHandler;
28 } 26 }
29 27
30 // A window manager which - when created - will force all windows into maximized 28 // A window manager which - when created - will force all windows into maximized
31 // mode. Exception are panels and windows which cannot be maximized. 29 // mode. Exception are panels and windows which cannot be maximized.
32 // Windows which cannot be maximized / resized are centered with a layer placed 30 // Windows which cannot be maximized / resized are centered with a layer placed
33 // behind the window so that no other windows are visible and/or obscured. 31 // behind the window so that no other windows are visible and/or obscured.
34 // With the destruction of the manager all windows will be restored to their 32 // With the destruction of the manager all windows will be restored to their
35 // original state. 33 // original state.
36 class ASH_EXPORT MaximizeModeWindowManager : public aura::WindowObserver, 34 class ASH_EXPORT MaximizeModeWindowManager : public WmWindowObserver,
37 public display::DisplayObserver, 35 public display::DisplayObserver,
38 public ShellObserver { 36 public ShellObserver {
39 public: 37 public:
40 // This should only be deleted by the creator (ash::Shell). 38 // This should only be deleted by the creator (ash::Shell).
41 ~MaximizeModeWindowManager() override; 39 ~MaximizeModeWindowManager() override;
42 40
43 // Returns the number of maximized & tracked windows by this manager. 41 // Returns the number of maximized & tracked windows by this manager.
44 int GetNumberOfManagedWindows(); 42 int GetNumberOfManagedWindows();
45 43
46 // Adds a window which needs to be maximized. This is used by other window 44 // Adds a window which needs to be maximized. This is used by other window
47 // managers for windows which needs to get tracked due to (upcoming) state 45 // managers for windows which needs to get tracked due to (upcoming) state
48 // changes. 46 // changes.
49 // The call gets ignored if the window was already or should not be handled. 47 // The call gets ignored if the window was already or should not be handled.
50 void AddWindow(aura::Window* window); 48 void AddWindow(WmWindow* window);
51 49
52 // Called from a window state object when it gets destroyed. 50 // Called from a window state object when it gets destroyed.
53 void WindowStateDestroyed(WmWindow* wm_window); 51 void WindowStateDestroyed(WmWindow* window);
54 52
55 // ShellObserver overrides: 53 // ShellObserver overrides:
56 void OnOverviewModeStarting() override; 54 void OnOverviewModeStarting() override;
57 void OnOverviewModeEnded() override; 55 void OnOverviewModeEnded() override;
58 56
59 // Overridden from WindowObserver: 57 // Overridden from WindowObserver:
60 void OnWindowDestroying(aura::Window* window) override; 58 void OnWindowDestroying(WmWindow* window) override;
61 void OnWindowAdded(aura::Window* window) override; 59 void OnWindowTreeChanged(WmWindow* window,
62 void OnWindowPropertyChanged(aura::Window* window, 60 const TreeChangeParams& params) override;
63 const void* key, 61 void OnWindowPropertyChanged(WmWindow* window,
64 intptr_t old) override; 62 WmWindowProperty window_property) override;
65 void OnWindowBoundsChanged(aura::Window* window, 63 void OnWindowBoundsChanged(WmWindow* window,
66 const gfx::Rect& old_bounds, 64 const gfx::Rect& old_bounds,
67 const gfx::Rect& new_bounds) override; 65 const gfx::Rect& new_bounds) override;
68 66
69 // display::DisplayObserver overrides: 67 // display::DisplayObserver overrides:
70 void OnDisplayAdded(const display::Display& display) override; 68 void OnDisplayAdded(const display::Display& display) override;
71 void OnDisplayRemoved(const display::Display& display) override; 69 void OnDisplayRemoved(const display::Display& display) override;
72 void OnDisplayMetricsChanged(const display::Display& display, 70 void OnDisplayMetricsChanged(const display::Display& display,
73 uint32_t metrics) override; 71 uint32_t metrics) override;
74 72
75 protected: 73 protected:
76 friend class MaximizeModeController; 74 friend class MaximizeModeController;
77 75
78 // The object should only be created by the ash::Shell. 76 // The object should only be created by the ash::Shell.
79 MaximizeModeWindowManager(); 77 MaximizeModeWindowManager();
80 78
81 private: 79 private:
82 typedef std::map<aura::Window*, MaximizeModeWindowState*> WindowToState; 80 using WindowToState = std::map<WmWindow*, MaximizeModeWindowState*>;
83 81
84 // Maximize all windows and restore their current state. 82 // Maximize all windows and restore their current state.
85 void MaximizeAllWindows(); 83 void MaximizeAllWindows();
86 84
87 // Restore all windows to their previous state. 85 // Restore all windows to their previous state.
88 void RestoreAllWindows(); 86 void RestoreAllWindows();
89 87
90 // Set whether to defer bounds updates on all tracked windows. When set to 88 // Set whether to defer bounds updates on all tracked windows. When set to
91 // false bounds will be updated as they may be stale. 89 // false bounds will be updated as they may be stale.
92 void SetDeferBoundsUpdates(bool defer_bounds_updates); 90 void SetDeferBoundsUpdates(bool defer_bounds_updates);
93 91
94 // If the given window should be handled by us, this function will maximize it 92 // If the given window should be handled by us, this function will maximize it
95 // and add it to the list of known windows (remembering the initial show 93 // and add it to the list of known windows (remembering the initial show
96 // state). 94 // state).
97 // Note: If the given window cannot be handled by us the function will return 95 // Note: If the given window cannot be handled by us the function will return
98 // immediately. 96 // immediately.
99 void MaximizeAndTrackWindow(aura::Window* window); 97 void MaximizeAndTrackWindow(WmWindow* window);
100 98
101 // Remove a window from our tracking list. 99 // Remove a window from our tracking list.
102 void ForgetWindow(aura::Window* window); 100 void ForgetWindow(WmWindow* window);
103 101
104 // Returns true when the given window should be modified in any way by us. 102 // Returns true when the given window should be modified in any way by us.
105 bool ShouldHandleWindow(aura::Window* window); 103 bool ShouldHandleWindow(WmWindow* window);
106 104
107 // Add window creation observers to track creation of new windows. 105 // Add window creation observers to track creation of new windows.
108 void AddWindowCreationObservers(); 106 void AddWindowCreationObservers();
109 107
110 // Remove Window creation observers. 108 // Remove Window creation observers.
111 void RemoveWindowCreationObservers(); 109 void RemoveWindowCreationObservers();
112 110
113 // Change the internal state (e.g. observers) when the display configuration 111 // Change the internal state (e.g. observers) when the display configuration
114 // changes. 112 // changes.
115 void DisplayConfigurationChanged(); 113 void DisplayConfigurationChanged();
116 114
117 // Returns true when the |window| is a container window. 115 // Returns true when the |window| is a container window.
118 bool IsContainerWindow(aura::Window* window); 116 bool IsContainerWindow(WmWindow* window);
119 117
120 // Add a backdrop behind the currently active window on each desktop. 118 // Add a backdrop behind the currently active window on each desktop.
121 void EnableBackdropBehindTopWindowOnEachDisplay(bool enable); 119 void EnableBackdropBehindTopWindowOnEachDisplay(bool enable);
122 120
123 // Every window which got touched by our window manager gets added here. 121 // Every window which got touched by our window manager gets added here.
124 WindowToState window_state_map_; 122 WindowToState window_state_map_;
125 123
126 // All container windows which have to be tracked. 124 // All container windows which have to be tracked.
127 std::set<aura::Window*> observed_container_windows_; 125 std::set<WmWindow*> observed_container_windows_;
128 126
129 // True if all backdrops are hidden. 127 // True if all backdrops are hidden.
130 bool backdrops_hidden_; 128 bool backdrops_hidden_;
131 129
132 std::unique_ptr<wm::MaximizeModeEventHandler> event_handler_; 130 std::unique_ptr<wm::MaximizeModeEventHandler> event_handler_;
133 131
134 DISALLOW_COPY_AND_ASSIGN(MaximizeModeWindowManager); 132 DISALLOW_COPY_AND_ASSIGN(MaximizeModeWindowManager);
135 }; 133 };
136 134
137 } // namespace ash 135 } // namespace ash
138 136
139 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_WINDOW_MANAGER_H_ 137 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_WINDOW_MANAGER_H_
OLDNEW
« no previous file with comments | « ash/wm/maximize_mode/maximize_mode_controller.cc ('k') | ash/wm/maximize_mode/maximize_mode_window_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698