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