| 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 <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| 11 #include "ash/ash_export.h" | 11 #include "ash/ash_export.h" |
| 12 #include "ash/shell_observer.h" |
| 12 #include "ash/wm/window_state.h" | 13 #include "ash/wm/window_state.h" |
| 13 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 14 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
| 15 #include "ui/aura/window_observer.h" | 16 #include "ui/aura/window_observer.h" |
| 16 #include "ui/gfx/display_observer.h" | 17 #include "ui/gfx/display_observer.h" |
| 17 | 18 |
| 18 namespace ash { | 19 namespace ash { |
| 19 class Shell; | 20 class Shell; |
| 20 | 21 |
| 21 namespace internal{ | 22 namespace internal{ |
| 22 | 23 |
| 23 // A window manager which - when created - will force all windows into maximized | 24 // A window manager which - when created - will force all windows into maximized |
| 24 // mode. Exception are panels and windows which cannot be maximized. | 25 // mode. Exception are panels and windows which cannot be maximized. |
| 25 // Windows which cannot be maximized / resized are centered with a layer placed | 26 // Windows which cannot be maximized / resized are centered with a layer placed |
| 26 // behind the window so that no other windows are visible and/or obscured. | 27 // behind the window so that no other windows are visible and/or obscured. |
| 27 // With the destruction of the manager all windows will be restored to their | 28 // With the destruction of the manager all windows will be restored to their |
| 28 // original state. | 29 // original state. |
| 29 class ASH_EXPORT MaximizeModeWindowManager : public aura::WindowObserver, | 30 class ASH_EXPORT MaximizeModeWindowManager : public aura::WindowObserver, |
| 30 public gfx::DisplayObserver { | 31 public gfx::DisplayObserver, |
| 32 public ShellObserver { |
| 31 public: | 33 public: |
| 32 // This should only be deleted by the creator (ash::Shell). | 34 // This should only be deleted by the creator (ash::Shell). |
| 33 virtual ~MaximizeModeWindowManager(); | 35 virtual ~MaximizeModeWindowManager(); |
| 34 | 36 |
| 35 // Returns the number of maximized & tracked windows by this manager. | 37 // Returns the number of maximized & tracked windows by this manager. |
| 36 int GetNumberOfManagedWindows(); | 38 int GetNumberOfManagedWindows(); |
| 37 | 39 |
| 38 // Overridden from WindowObserver: | 40 // Overridden from WindowObserver: |
| 39 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; | 41 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; |
| 40 virtual void OnWindowAdded(aura::Window* window) OVERRIDE; | 42 virtual void OnWindowAdded(aura::Window* window) OVERRIDE; |
| 41 virtual void OnWindowBoundsChanged(aura::Window* window, | 43 virtual void OnWindowBoundsChanged(aura::Window* window, |
| 42 const gfx::Rect& old_bounds, | 44 const gfx::Rect& old_bounds, |
| 43 const gfx::Rect& new_bounds) OVERRIDE; | 45 const gfx::Rect& new_bounds) OVERRIDE; |
| 44 | 46 |
| 45 // aura::DisplayObserver overrides: | 47 // aura::DisplayObserver overrides: |
| 46 virtual void OnDisplayBoundsChanged( | 48 virtual void OnDisplayBoundsChanged( |
| 47 const gfx::Display& display) OVERRIDE; | 49 const gfx::Display& display) OVERRIDE; |
| 48 virtual void OnDisplayAdded(const gfx::Display& display) OVERRIDE; | 50 virtual void OnDisplayAdded(const gfx::Display& display) OVERRIDE; |
| 49 virtual void OnDisplayRemoved(const gfx::Display& display) OVERRIDE; | 51 virtual void OnDisplayRemoved(const gfx::Display& display) OVERRIDE; |
| 50 | 52 |
| 53 // ShellObserver overrides: |
| 54 void OnOverviewModeStarted(); |
| 55 void OnOverviewModeEnded(); |
| 56 |
| 51 protected: | 57 protected: |
| 52 friend class ash::Shell; | 58 friend class ash::Shell; |
| 53 | 59 |
| 54 // The object should only be created by the ash::Shell. | 60 // The object should only be created by the ash::Shell. |
| 55 MaximizeModeWindowManager(); | 61 MaximizeModeWindowManager(); |
| 56 | 62 |
| 57 private: | 63 private: |
| 58 typedef std::map<aura::Window*, wm::WindowStateType> WindowToStateType; | 64 typedef std::map<aura::Window*, wm::WindowStateType> WindowToStateType; |
| 59 | 65 |
| 60 // Maximize all windows and restore their current state. | 66 // Maximize all windows and restore their current state. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 91 // Remove Window creation observers. | 97 // Remove Window creation observers. |
| 92 void RemoveWindowCreationObservers(); | 98 void RemoveWindowCreationObservers(); |
| 93 | 99 |
| 94 // Change the internal state (e.g. observers) when the display configuration | 100 // Change the internal state (e.g. observers) when the display configuration |
| 95 // changes. | 101 // changes. |
| 96 void DisplayConfigurationChanged(); | 102 void DisplayConfigurationChanged(); |
| 97 | 103 |
| 98 // Returns true when the |window| is a container window. | 104 // Returns true when the |window| is a container window. |
| 99 bool IsContainerWindow(aura::Window* window); | 105 bool IsContainerWindow(aura::Window* window); |
| 100 | 106 |
| 107 // Add a backdrop behind the currently active window on each desktop. |
| 108 void EnableBackdropBehindTopWindowOnEachDisplay(bool enable); |
| 109 |
| 101 // Every window which got touched by our window manager gets added here. | 110 // Every window which got touched by our window manager gets added here. |
| 102 WindowToStateType initial_state_type_; | 111 WindowToStateType initial_state_type_; |
| 103 | 112 |
| 104 // All container windows which have to be tracked. | 113 // All container windows which have to be tracked. |
| 105 std::set<aura::Window*> observed_container_windows_; | 114 std::set<aura::Window*> observed_container_windows_; |
| 106 | 115 |
| 116 // True if all backdrops are hidden. |
| 117 bool backdrops_hidden_; |
| 118 |
| 107 DISALLOW_COPY_AND_ASSIGN(MaximizeModeWindowManager); | 119 DISALLOW_COPY_AND_ASSIGN(MaximizeModeWindowManager); |
| 108 }; | 120 }; |
| 109 | 121 |
| 110 } // namespace internal | 122 } // namespace internal |
| 111 } // namespace ash | 123 } // namespace ash |
| 112 | 124 |
| 113 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_WINDOW_MANAGER_H_ | 125 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_WINDOW_MANAGER_H_ |
| OLD | NEW |