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_PANELS_PANEL_LAYOUT_MANAGER_H_ | 5 #ifndef ASH_WM_PANELS_PANEL_LAYOUT_MANAGER_H_ |
6 #define ASH_WM_PANELS_PANEL_LAYOUT_MANAGER_H_ | 6 #define ASH_WM_PANELS_PANEL_LAYOUT_MANAGER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 | 9 |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
11 #include "ash/display/display_controller.h" | 11 #include "ash/display/display_controller.h" |
12 #include "ash/shelf/shelf_icon_observer.h" | 12 #include "ash/shelf/shelf_icon_observer.h" |
13 #include "ash/shelf/shelf_layout_manager_observer.h" | 13 #include "ash/shelf/shelf_layout_manager_observer.h" |
14 #include "ash/shell_observer.h" | 14 #include "ash/shell_observer.h" |
15 #include "ash/wm/window_state_observer.h" | 15 #include "ash/wm/window_state_observer.h" |
16 #include "base/basictypes.h" | 16 #include "base/basictypes.h" |
17 #include "base/compiler_specific.h" | 17 #include "base/compiler_specific.h" |
18 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
19 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
20 #include "ui/aura/layout_manager.h" | 20 #include "ui/aura/layout_manager.h" |
| 21 #include "ui/aura/window_observer.h" |
21 #include "ui/keyboard/keyboard_controller.h" | 22 #include "ui/keyboard/keyboard_controller.h" |
22 #include "ui/keyboard/keyboard_controller_observer.h" | 23 #include "ui/keyboard/keyboard_controller_observer.h" |
23 #include "ui/wm/public/activation_change_observer.h" | 24 #include "ui/wm/public/activation_change_observer.h" |
24 | 25 |
25 namespace aura { | 26 namespace aura { |
26 class Window; | 27 class Window; |
27 class WindowTracker; | 28 class WindowTracker; |
28 } | 29 } |
29 | 30 |
30 namespace gfx { | 31 namespace gfx { |
(...skipping 15 matching lines...) Expand all Loading... |
46 // added to that container. | 47 // added to that container. |
47 // | 48 // |
48 // The constructor takes a |panel_container| argument which is expected to set | 49 // The constructor takes a |panel_container| argument which is expected to set |
49 // its layout manager to this instance, e.g.: | 50 // its layout manager to this instance, e.g.: |
50 // panel_container->SetLayoutManager(new PanelLayoutManager(panel_container)); | 51 // panel_container->SetLayoutManager(new PanelLayoutManager(panel_container)); |
51 | 52 |
52 class ASH_EXPORT PanelLayoutManager | 53 class ASH_EXPORT PanelLayoutManager |
53 : public aura::LayoutManager, | 54 : public aura::LayoutManager, |
54 public ShelfIconObserver, | 55 public ShelfIconObserver, |
55 public ShellObserver, | 56 public ShellObserver, |
| 57 public aura::WindowObserver, |
| 58 public wm::WindowStateObserver, |
56 public aura::client::ActivationChangeObserver, | 59 public aura::client::ActivationChangeObserver, |
57 public keyboard::KeyboardControllerObserver, | 60 public keyboard::KeyboardControllerObserver, |
58 public DisplayController::Observer, | 61 public DisplayController::Observer, |
59 public ShelfLayoutManagerObserver, | 62 public ShelfLayoutManagerObserver { |
60 public wm::WindowStateObserver { | |
61 public: | 63 public: |
62 explicit PanelLayoutManager(aura::Window* panel_container); | 64 explicit PanelLayoutManager(aura::Window* panel_container); |
63 virtual ~PanelLayoutManager(); | 65 virtual ~PanelLayoutManager(); |
64 | 66 |
65 // Call Shutdown() before deleting children of panel_container. | 67 // Call Shutdown() before deleting children of panel_container. |
66 void Shutdown(); | 68 void Shutdown(); |
67 | 69 |
68 void StartDragging(aura::Window* panel); | 70 void StartDragging(aura::Window* panel); |
69 void FinishDragging(); | 71 void FinishDragging(); |
70 | 72 |
(...skipping 14 matching lines...) Expand all Loading... |
85 bool visibile) OVERRIDE; | 87 bool visibile) OVERRIDE; |
86 virtual void SetChildBounds(aura::Window* child, | 88 virtual void SetChildBounds(aura::Window* child, |
87 const gfx::Rect& requested_bounds) OVERRIDE; | 89 const gfx::Rect& requested_bounds) OVERRIDE; |
88 | 90 |
89 // Overridden from ShelfIconObserver | 91 // Overridden from ShelfIconObserver |
90 virtual void OnShelfIconPositionsChanged() OVERRIDE; | 92 virtual void OnShelfIconPositionsChanged() OVERRIDE; |
91 | 93 |
92 // Overridden from ShellObserver | 94 // Overridden from ShellObserver |
93 virtual void OnShelfAlignmentChanged(aura::Window* root_window) OVERRIDE; | 95 virtual void OnShelfAlignmentChanged(aura::Window* root_window) OVERRIDE; |
94 | 96 |
| 97 // Overridden from aura::WindowObserver |
| 98 virtual void OnWindowPropertyChanged(aura::Window* window, |
| 99 const void* key, |
| 100 intptr_t old) OVERRIDE; |
| 101 |
95 // Overridden from ash::wm::WindowStateObserver | 102 // Overridden from ash::wm::WindowStateObserver |
96 virtual void OnPostWindowStateTypeChange( | 103 virtual void OnPostWindowStateTypeChange( |
97 wm::WindowState* window_state, | 104 wm::WindowState* window_state, |
98 wm::WindowStateType old_type) OVERRIDE; | 105 wm::WindowStateType old_type) OVERRIDE; |
99 | 106 |
100 // Overridden from aura::client::ActivationChangeObserver | 107 // Overridden from aura::client::ActivationChangeObserver |
101 virtual void OnWindowActivated(aura::Window* gained_active, | 108 virtual void OnWindowActivated(aura::Window* gained_active, |
102 aura::Window* lost_active) OVERRIDE; | 109 aura::Window* lost_active) OVERRIDE; |
103 | 110 |
104 // Overridden from DisplayController::Observer | 111 // Overridden from DisplayController::Observer |
(...skipping 20 matching lines...) Expand all Loading... |
125 } | 132 } |
126 | 133 |
127 // A weak pointer to the panel window. | 134 // A weak pointer to the panel window. |
128 aura::Window* window; | 135 aura::Window* window; |
129 // The callout widget for this panel. This pointer must be managed | 136 // The callout widget for this panel. This pointer must be managed |
130 // manually as this structure is used in a std::list. See | 137 // manually as this structure is used in a std::list. See |
131 // http://www.chromium.org/developers/smart-pointer-guidelines | 138 // http://www.chromium.org/developers/smart-pointer-guidelines |
132 PanelCalloutWidget* callout_widget; | 139 PanelCalloutWidget* callout_widget; |
133 | 140 |
134 // True on new and restored panel windows until the panel has been | 141 // True on new and restored panel windows until the panel has been |
135 // positioned. The first time Relayout is called the panel will slide into | 142 // positioned. The first time Relayout is called the panel will be shown, |
136 // position and this will be set to false. | 143 // and slide into position and this will be set to false. |
137 bool slide_in; | 144 bool slide_in; |
138 }; | 145 }; |
139 | 146 |
140 typedef std::list<PanelInfo> PanelList; | 147 typedef std::list<PanelInfo> PanelList; |
141 | 148 |
142 void MinimizePanel(aura::Window* panel); | 149 void MinimizePanel(aura::Window* panel); |
143 void RestorePanel(aura::Window* panel); | 150 void RestorePanel(aura::Window* panel); |
144 | 151 |
145 // Called whenever the panel layout might change. | 152 // Called whenever the panel layout might change. |
146 void Relayout(); | 153 void Relayout(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 // are currently focused. | 187 // are currently focused. |
181 aura::Window* last_active_panel_; | 188 aura::Window* last_active_panel_; |
182 base::WeakPtrFactory<PanelLayoutManager> weak_factory_; | 189 base::WeakPtrFactory<PanelLayoutManager> weak_factory_; |
183 | 190 |
184 DISALLOW_COPY_AND_ASSIGN(PanelLayoutManager); | 191 DISALLOW_COPY_AND_ASSIGN(PanelLayoutManager); |
185 }; | 192 }; |
186 | 193 |
187 } // namespace ash | 194 } // namespace ash |
188 | 195 |
189 #endif // ASH_WM_PANELS_PANEL_LAYOUT_MANAGER_H_ | 196 #endif // ASH_WM_PANELS_PANEL_LAYOUT_MANAGER_H_ |
OLD | NEW |