| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BASE_LAYOUT_MANAGER_H_ | 5 #ifndef ASH_WM_BASE_LAYOUT_MANAGER_H_ |
| 6 #define ASH_WM_BASE_LAYOUT_MANAGER_H_ | 6 #define ASH_WM_BASE_LAYOUT_MANAGER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| 11 #include "ash/shell_observer.h" | 11 #include "ash/shell_observer.h" |
| 12 #include "ash/wm/window_state_observer.h" | 12 #include "ash/wm/window_state_observer.h" |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "ui/aura/client/activation_change_observer.h" | 15 #include "ui/aura/client/activation_change_observer.h" |
| 16 #include "ui/aura/layout_manager.h" | 16 #include "ui/aura/layout_manager.h" |
| 17 #include "ui/aura/window_observer.h" | 17 #include "ui/aura/window_observer.h" |
| 18 #include "ui/base/ui_base_types.h" | 18 #include "ui/base/ui_base_types.h" |
| 19 #include "ui/events/event_handler.h" | 19 #include "ui/events/event_handler.h" |
| 20 | 20 |
| 21 namespace aura { | 21 namespace aura { |
| 22 class RootWindow; | |
| 23 class Window; | 22 class Window; |
| 24 } | 23 } |
| 25 | 24 |
| 26 namespace ash { | 25 namespace ash { |
| 27 namespace wm { | 26 namespace wm { |
| 28 class WindowState; | 27 class WindowState; |
| 29 } | 28 } |
| 30 | 29 |
| 31 namespace internal { | 30 namespace internal { |
| 32 | 31 |
| 33 // BaseLayoutManager is the simplest possible implementation for a window | 32 // BaseLayoutManager is the simplest possible implementation for a window |
| 34 // layout manager. It listens for changes to kShowStateKey and resizes the | 33 // layout manager. It listens for changes to kShowStateKey and resizes the |
| 35 // window appropriately. Subclasses should be sure to invoke the base class | 34 // window appropriately. Subclasses should be sure to invoke the base class |
| 36 // for adding and removing windows, otherwise show state will not be tracked | 35 // for adding and removing windows, otherwise show state will not be tracked |
| 37 // properly. | 36 // properly. |
| 38 class ASH_EXPORT BaseLayoutManager | 37 class ASH_EXPORT BaseLayoutManager |
| 39 : public aura::LayoutManager, | 38 : public aura::LayoutManager, |
| 40 public aura::WindowObserver, | 39 public aura::WindowObserver, |
| 41 public aura::client::ActivationChangeObserver, | 40 public aura::client::ActivationChangeObserver, |
| 42 public ShellObserver, | 41 public ShellObserver, |
| 43 public wm::WindowStateObserver { | 42 public wm::WindowStateObserver { |
| 44 public: | 43 public: |
| 45 typedef std::set<aura::Window*> WindowSet; | 44 typedef std::set<aura::Window*> WindowSet; |
| 46 | 45 |
| 47 explicit BaseLayoutManager(aura::RootWindow* root_window); | 46 explicit BaseLayoutManager(aura::Window* root_window); |
| 48 virtual ~BaseLayoutManager(); | 47 virtual ~BaseLayoutManager(); |
| 49 | 48 |
| 50 const WindowSet& windows() const { return windows_; } | 49 const WindowSet& windows() const { return windows_; } |
| 51 | 50 |
| 52 // Given a |window| and tentative |restore_bounds|, returns new bounds that | 51 // Given a |window| and tentative |restore_bounds|, returns new bounds that |
| 53 // ensure that at least a few pixels of the screen background are visible | 52 // ensure that at least a few pixels of the screen background are visible |
| 54 // outside the edges of the window. | 53 // outside the edges of the window. |
| 55 static gfx::Rect BoundsWithScreenEdgeVisible(aura::Window* window, | 54 static gfx::Rect BoundsWithScreenEdgeVisible(aura::Window* window, |
| 56 const gfx::Rect& restore_bounds); | 55 const gfx::Rect& restore_bounds); |
| 57 | 56 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 // is on display. | 101 // is on display. |
| 103 virtual void AdjustAllWindowsBoundsForWorkAreaChange( | 102 virtual void AdjustAllWindowsBoundsForWorkAreaChange( |
| 104 AdjustWindowReason reason); | 103 AdjustWindowReason reason); |
| 105 | 104 |
| 106 // Adjusts the sizes of the specific window in respond to a screen change or | 105 // Adjusts the sizes of the specific window in respond to a screen change or |
| 107 // display-area size change. | 106 // display-area size change. |
| 108 virtual void AdjustWindowBoundsForWorkAreaChange( | 107 virtual void AdjustWindowBoundsForWorkAreaChange( |
| 109 wm::WindowState* window_state, | 108 wm::WindowState* window_state, |
| 110 AdjustWindowReason reason); | 109 AdjustWindowReason reason); |
| 111 | 110 |
| 112 aura::RootWindow* root_window() { return root_window_; } | 111 aura::Window* root_window() { return root_window_; } |
| 113 | 112 |
| 114 private: | 113 private: |
| 115 // Update window bounds based on a change in show state. | 114 // Update window bounds based on a change in show state. |
| 116 void UpdateBoundsFromShowState(wm::WindowState* controller); | 115 void UpdateBoundsFromShowState(wm::WindowState* controller); |
| 117 | 116 |
| 118 // Set of windows we're listening to. | 117 // Set of windows we're listening to. |
| 119 WindowSet windows_; | 118 WindowSet windows_; |
| 120 | 119 |
| 121 aura::RootWindow* root_window_; | 120 aura::Window* root_window_; |
| 122 | 121 |
| 123 DISALLOW_COPY_AND_ASSIGN(BaseLayoutManager); | 122 DISALLOW_COPY_AND_ASSIGN(BaseLayoutManager); |
| 124 }; | 123 }; |
| 125 | 124 |
| 126 } // namespace internal | 125 } // namespace internal |
| 127 } // namespace ash | 126 } // namespace ash |
| 128 | 127 |
| 129 #endif // ASH_WM_BASE_LAYOUT_MANAGER_H_ | 128 #endif // ASH_WM_BASE_LAYOUT_MANAGER_H_ |
| OLD | NEW |