| OLD | NEW |
| 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_COMMON_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_WINDOW_MANAGER_H_ | 5 #ifndef ASH_COMMON_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_WINDOW_MANAGER_H_ |
| 6 #define ASH_COMMON_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_WINDOW_MANAGER_H_ | 6 #define ASH_COMMON_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 <unordered_set> | 11 #include <unordered_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 "ash/common/wm_window_observer.h" | |
| 17 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "ui/aura/window_observer.h" |
| 18 #include "ui/display/display_observer.h" | 18 #include "ui/display/display_observer.h" |
| 19 | 19 |
| 20 namespace ash { | 20 namespace ash { |
| 21 class MaximizeModeController; | 21 class MaximizeModeController; |
| 22 class MaximizeModeWindowState; | 22 class MaximizeModeWindowState; |
| 23 | 23 |
| 24 namespace wm { | 24 namespace wm { |
| 25 class MaximizeModeEventHandler; | 25 class MaximizeModeEventHandler; |
| 26 } | 26 } |
| 27 | 27 |
| 28 // 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 |
| 29 // mode. Exception are panels and windows which cannot be 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 | 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. | 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 | 32 // With the destruction of the manager all windows will be restored to their |
| 33 // original state. | 33 // original state. |
| 34 class ASH_EXPORT MaximizeModeWindowManager : public WmWindowObserver, | 34 class ASH_EXPORT MaximizeModeWindowManager : public aura::WindowObserver, |
| 35 public display::DisplayObserver, | 35 public display::DisplayObserver, |
| 36 public ShellObserver { | 36 public ShellObserver { |
| 37 public: | 37 public: |
| 38 // This should only be deleted by the creator (ash::Shell). | 38 // This should only be deleted by the creator (ash::Shell). |
| 39 ~MaximizeModeWindowManager() override; | 39 ~MaximizeModeWindowManager() override; |
| 40 | 40 |
| 41 // Returns the number of maximized & tracked windows by this manager. | 41 // Returns the number of maximized & tracked windows by this manager. |
| 42 int GetNumberOfManagedWindows(); | 42 int GetNumberOfManagedWindows(); |
| 43 | 43 |
| 44 // 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 |
| 45 // 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 |
| 46 // changes. | 46 // changes. |
| 47 // 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. |
| 48 void AddWindow(WmWindow* window); | 48 void AddWindow(WmWindow* window); |
| 49 | 49 |
| 50 // Called from a window state object when it gets destroyed. | 50 // Called from a window state object when it gets destroyed. |
| 51 void WindowStateDestroyed(WmWindow* window); | 51 void WindowStateDestroyed(WmWindow* window); |
| 52 | 52 |
| 53 // ShellObserver overrides: | 53 // ShellObserver overrides: |
| 54 void OnOverviewModeStarting() override; | 54 void OnOverviewModeStarting() override; |
| 55 void OnOverviewModeEnded() override; | 55 void OnOverviewModeEnded() override; |
| 56 | 56 |
| 57 // Overridden from WindowObserver: | 57 // Overridden from WindowObserver: |
| 58 void OnWindowDestroying(WmWindow* window) override; | 58 void OnWindowDestroying(aura::Window* window) override; |
| 59 void OnWindowTreeChanged(WmWindow* window, | 59 void OnWindowHierarchyChanged(const HierarchyChangeParams& params) override; |
| 60 const TreeChangeParams& params) override; | 60 void OnWindowPropertyChanged(aura::Window* window, |
| 61 void OnWindowPropertyChanged(WmWindow* window, | 61 const void* key, |
| 62 WmWindowProperty window_property) override; | 62 intptr_t old) override; |
| 63 void OnWindowBoundsChanged(WmWindow* window, | 63 void OnWindowBoundsChanged(aura::Window* window, |
| 64 const gfx::Rect& old_bounds, | 64 const gfx::Rect& old_bounds, |
| 65 const gfx::Rect& new_bounds) override; | 65 const gfx::Rect& new_bounds) override; |
| 66 void OnWindowVisibilityChanged(WmWindow* window, bool visible) override; | 66 void OnWindowVisibilityChanged(aura::Window* window, bool visible) override; |
| 67 | 67 |
| 68 // display::DisplayObserver overrides: | 68 // display::DisplayObserver overrides: |
| 69 void OnDisplayAdded(const display::Display& display) override; | 69 void OnDisplayAdded(const display::Display& display) override; |
| 70 void OnDisplayRemoved(const display::Display& display) override; | 70 void OnDisplayRemoved(const display::Display& display) override; |
| 71 void OnDisplayMetricsChanged(const display::Display& display, | 71 void OnDisplayMetricsChanged(const display::Display& display, |
| 72 uint32_t metrics) override; | 72 uint32_t metrics) override; |
| 73 | 73 |
| 74 protected: | 74 protected: |
| 75 friend class MaximizeModeController; | 75 friend class MaximizeModeController; |
| 76 | 76 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 107 void AddWindowCreationObservers(); | 107 void AddWindowCreationObservers(); |
| 108 | 108 |
| 109 // Remove Window creation observers. | 109 // Remove Window creation observers. |
| 110 void RemoveWindowCreationObservers(); | 110 void RemoveWindowCreationObservers(); |
| 111 | 111 |
| 112 // Change the internal state (e.g. observers) when the display configuration | 112 // Change the internal state (e.g. observers) when the display configuration |
| 113 // changes. | 113 // changes. |
| 114 void DisplayConfigurationChanged(); | 114 void DisplayConfigurationChanged(); |
| 115 | 115 |
| 116 // Returns true when the |window| is a container window. | 116 // Returns true when the |window| is a container window. |
| 117 bool IsContainerWindow(WmWindow* window); | 117 bool IsContainerWindow(aura::Window* window); |
| 118 | 118 |
| 119 // Add a backdrop behind the currently active window on each desktop. | 119 // Add a backdrop behind the currently active window on each desktop. |
| 120 void EnableBackdropBehindTopWindowOnEachDisplay(bool enable); | 120 void EnableBackdropBehindTopWindowOnEachDisplay(bool enable); |
| 121 | 121 |
| 122 // Every window which got touched by our window manager gets added here. | 122 // Every window which got touched by our window manager gets added here. |
| 123 WindowToState window_state_map_; | 123 WindowToState window_state_map_; |
| 124 | 124 |
| 125 // All container windows which have to be tracked. | 125 // All container windows which have to be tracked. |
| 126 std::unordered_set<WmWindow*> observed_container_windows_; | 126 std::unordered_set<aura::Window*> observed_container_windows_; |
| 127 | 127 |
| 128 // Windows added to the container, but not yet shown. | 128 // Windows added to the container, but not yet shown. |
| 129 std::unordered_set<WmWindow*> added_windows_; | 129 std::unordered_set<aura::Window*> added_windows_; |
| 130 | 130 |
| 131 // True if all backdrops are hidden. | 131 // True if all backdrops are hidden. |
| 132 bool backdrops_hidden_; | 132 bool backdrops_hidden_; |
| 133 | 133 |
| 134 std::unique_ptr<wm::MaximizeModeEventHandler> event_handler_; | 134 std::unique_ptr<wm::MaximizeModeEventHandler> event_handler_; |
| 135 | 135 |
| 136 DISALLOW_COPY_AND_ASSIGN(MaximizeModeWindowManager); | 136 DISALLOW_COPY_AND_ASSIGN(MaximizeModeWindowManager); |
| 137 }; | 137 }; |
| 138 | 138 |
| 139 } // namespace ash | 139 } // namespace ash |
| 140 | 140 |
| 141 #endif // ASH_COMMON_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_WINDOW_MANAGER_H_ | 141 #endif // ASH_COMMON_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_WINDOW_MANAGER_H_ |
| OLD | NEW |