Chromium Code Reviews| 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 |
| 40 // Hide the default workspace container backdrops temporarily when |hide| is | |
| 41 // set. | |
| 42 void HideBackdrops(bool hide); | |
|
sky
2014/03/06 01:03:18
Do you really need the 'hide' variable? If you do,
Mr4D (OOO till 08-26)
2014/03/06 17:17:16
Removed.
| |
| 43 | |
| 38 // Overridden from WindowObserver: | 44 // Overridden from WindowObserver: |
| 39 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; | 45 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; |
| 40 virtual void OnWindowAdded(aura::Window* window) OVERRIDE; | 46 virtual void OnWindowAdded(aura::Window* window) OVERRIDE; |
| 41 virtual void OnWindowBoundsChanged(aura::Window* window, | 47 virtual void OnWindowBoundsChanged(aura::Window* window, |
| 42 const gfx::Rect& old_bounds, | 48 const gfx::Rect& old_bounds, |
| 43 const gfx::Rect& new_bounds) OVERRIDE; | 49 const gfx::Rect& new_bounds) OVERRIDE; |
| 44 | 50 |
| 45 // aura::DisplayObserver overrides: | 51 // aura::DisplayObserver overrides: |
| 46 virtual void OnDisplayBoundsChanged( | 52 virtual void OnDisplayBoundsChanged( |
| 47 const gfx::Display& display) OVERRIDE; | 53 const gfx::Display& display) OVERRIDE; |
| 48 virtual void OnDisplayAdded(const gfx::Display& display) OVERRIDE; | 54 virtual void OnDisplayAdded(const gfx::Display& display) OVERRIDE; |
| 49 virtual void OnDisplayRemoved(const gfx::Display& display) OVERRIDE; | 55 virtual void OnDisplayRemoved(const gfx::Display& display) OVERRIDE; |
| 50 | 56 |
| 57 // ShellObserver overrides: | |
| 58 void OnOverviewModeStarted(); | |
| 59 void OnOverviewModeEnded(); | |
| 60 | |
| 51 protected: | 61 protected: |
| 52 friend class ash::Shell; | 62 friend class ash::Shell; |
| 53 | 63 |
| 54 // The object should only be created by the ash::Shell. | 64 // The object should only be created by the ash::Shell. |
| 55 MaximizeModeWindowManager(); | 65 MaximizeModeWindowManager(); |
| 56 | 66 |
| 57 private: | 67 private: |
| 58 typedef std::map<aura::Window*, ui::WindowShowState> WindowToShowState; | 68 typedef std::map<aura::Window*, ui::WindowShowState> WindowToShowState; |
| 59 | 69 |
| 60 // Maximize all windows and restore their current state. | 70 // Maximize all windows and restore their current state. |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 84 | 94 |
| 85 // Maximize the window on the screen's workspace. | 95 // Maximize the window on the screen's workspace. |
| 86 void CenterWindow(aura::Window* window); | 96 void CenterWindow(aura::Window* window); |
| 87 | 97 |
| 88 // Add window creation observers to track creation of new windows. | 98 // Add window creation observers to track creation of new windows. |
| 89 void AddWindowCreationObservers(); | 99 void AddWindowCreationObservers(); |
| 90 | 100 |
| 91 // Remove Window creation observers. | 101 // Remove Window creation observers. |
| 92 void RemoveWindowCreationObservers(); | 102 void RemoveWindowCreationObservers(); |
| 93 | 103 |
| 104 // Add a backdrop behind the currently active window on each desktop. | |
| 105 void EnableBackdropBehindTopWindowOnEachDisplay(bool enable); | |
| 106 | |
| 94 // Returns true when the |window| is a container window. | 107 // Returns true when the |window| is a container window. |
| 95 bool IsContainerWindow(aura::Window* window); | 108 bool IsContainerWindow(aura::Window* window); |
| 96 | 109 |
| 110 // Apply a display configuration change. | |
| 111 void DisplayConfigurationChanged(); | |
| 112 | |
| 97 // Every window which got touched by our window manager gets added here. | 113 // Every window which got touched by our window manager gets added here. |
| 98 WindowToShowState initial_show_state_; | 114 WindowToShowState initial_show_state_; |
| 99 | 115 |
| 100 // All container windows which have to be tracked. | 116 // All container windows which have to be tracked. |
| 101 std::set<aura::Window*> observed_container_windows_; | 117 std::set<aura::Window*> observed_container_windows_; |
| 102 | 118 |
| 119 // True if all backdrops are hidden. | |
| 120 bool backdrops_hidden_; | |
| 121 | |
| 103 DISALLOW_COPY_AND_ASSIGN(MaximizeModeWindowManager); | 122 DISALLOW_COPY_AND_ASSIGN(MaximizeModeWindowManager); |
| 104 }; | 123 }; |
| 105 | 124 |
| 106 } // namespace internal | 125 } // namespace internal |
| 107 } // namespace ash | 126 } // namespace ash |
| 108 | 127 |
| 109 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_WINDOW_MANAGER_H_ | 128 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_WINDOW_MANAGER_H_ |
| OLD | NEW |