| 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_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 "base/compiler_specific.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "ui/aura/window_observer.h" | 18 #include "ui/aura/window_observer.h" |
| 19 #include "ui/display/display_observer.h" | 19 #include "ui/display/display_observer.h" |
| 20 #include "ui/events/event_handler.h" | |
| 21 | |
| 22 namespace ui { | |
| 23 class TouchEvent; | |
| 24 } | |
| 25 | 20 |
| 26 namespace ash { | 21 namespace ash { |
| 27 class MaximizeModeController; | 22 class MaximizeModeController; |
| 28 class MaximizeModeWindowState; | 23 class MaximizeModeWindowState; |
| 29 class WmWindow; | 24 class WmWindow; |
| 30 | 25 |
| 26 namespace wm { |
| 27 class MaximizeModeEventHandler; |
| 28 } |
| 29 |
| 31 // A window manager which - when created - will force all windows into maximized | 30 // A window manager which - when created - will force all windows into maximized |
| 32 // mode. Exception are panels and windows which cannot be maximized. | 31 // mode. Exception are panels and windows which cannot be maximized. |
| 33 // Windows which cannot be maximized / resized are centered with a layer placed | 32 // Windows which cannot be maximized / resized are centered with a layer placed |
| 34 // behind the window so that no other windows are visible and/or obscured. | 33 // behind the window so that no other windows are visible and/or obscured. |
| 35 // With the destruction of the manager all windows will be restored to their | 34 // With the destruction of the manager all windows will be restored to their |
| 36 // original state. | 35 // original state. |
| 37 class ASH_EXPORT MaximizeModeWindowManager : public aura::WindowObserver, | 36 class ASH_EXPORT MaximizeModeWindowManager : public aura::WindowObserver, |
| 38 public display::DisplayObserver, | 37 public display::DisplayObserver, |
| 39 public ShellObserver, | 38 public ShellObserver { |
| 40 public ui::EventHandler { | |
| 41 public: | 39 public: |
| 42 // This should only be deleted by the creator (ash::Shell). | 40 // This should only be deleted by the creator (ash::Shell). |
| 43 ~MaximizeModeWindowManager() override; | 41 ~MaximizeModeWindowManager() override; |
| 44 | 42 |
| 45 // Returns the number of maximized & tracked windows by this manager. | 43 // Returns the number of maximized & tracked windows by this manager. |
| 46 int GetNumberOfManagedWindows(); | 44 int GetNumberOfManagedWindows(); |
| 47 | 45 |
| 48 // Adds a window which needs to be maximized. This is used by other window | 46 // Adds a window which needs to be maximized. This is used by other window |
| 49 // managers for windows which needs to get tracked due to (upcoming) state | 47 // managers for windows which needs to get tracked due to (upcoming) state |
| 50 // changes. | 48 // changes. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 67 void OnWindowBoundsChanged(aura::Window* window, | 65 void OnWindowBoundsChanged(aura::Window* window, |
| 68 const gfx::Rect& old_bounds, | 66 const gfx::Rect& old_bounds, |
| 69 const gfx::Rect& new_bounds) override; | 67 const gfx::Rect& new_bounds) override; |
| 70 | 68 |
| 71 // display::DisplayObserver overrides: | 69 // display::DisplayObserver overrides: |
| 72 void OnDisplayAdded(const display::Display& display) override; | 70 void OnDisplayAdded(const display::Display& display) override; |
| 73 void OnDisplayRemoved(const display::Display& display) override; | 71 void OnDisplayRemoved(const display::Display& display) override; |
| 74 void OnDisplayMetricsChanged(const display::Display& display, | 72 void OnDisplayMetricsChanged(const display::Display& display, |
| 75 uint32_t metrics) override; | 73 uint32_t metrics) override; |
| 76 | 74 |
| 77 // ui::EventHandler override: | |
| 78 void OnTouchEvent(ui::TouchEvent* event) override; | |
| 79 | |
| 80 protected: | 75 protected: |
| 81 friend class MaximizeModeController; | 76 friend class MaximizeModeController; |
| 82 | 77 |
| 83 // The object should only be created by the ash::Shell. | 78 // The object should only be created by the ash::Shell. |
| 84 MaximizeModeWindowManager(); | 79 MaximizeModeWindowManager(); |
| 85 | 80 |
| 86 private: | 81 private: |
| 87 typedef std::map<aura::Window*, MaximizeModeWindowState*> WindowToState; | 82 typedef std::map<aura::Window*, MaximizeModeWindowState*> WindowToState; |
| 88 | 83 |
| 89 // Maximize all windows and restore their current state. | 84 // Maximize all windows and restore their current state. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 122 |
| 128 // Every window which got touched by our window manager gets added here. | 123 // Every window which got touched by our window manager gets added here. |
| 129 WindowToState window_state_map_; | 124 WindowToState window_state_map_; |
| 130 | 125 |
| 131 // All container windows which have to be tracked. | 126 // All container windows which have to be tracked. |
| 132 std::set<aura::Window*> observed_container_windows_; | 127 std::set<aura::Window*> observed_container_windows_; |
| 133 | 128 |
| 134 // True if all backdrops are hidden. | 129 // True if all backdrops are hidden. |
| 135 bool backdrops_hidden_; | 130 bool backdrops_hidden_; |
| 136 | 131 |
| 132 std::unique_ptr<wm::MaximizeModeEventHandler> event_handler_; |
| 133 |
| 137 DISALLOW_COPY_AND_ASSIGN(MaximizeModeWindowManager); | 134 DISALLOW_COPY_AND_ASSIGN(MaximizeModeWindowManager); |
| 138 }; | 135 }; |
| 139 | 136 |
| 140 } // namespace ash | 137 } // namespace ash |
| 141 | 138 |
| 142 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_WINDOW_MANAGER_H_ | 139 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_WINDOW_MANAGER_H_ |
| OLD | NEW |