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

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

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