OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_UI_PANELS_PANEL_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_MANAGER_H_ |
6 #define CHROME_BROWSER_UI_PANELS_PANEL_MANAGER_H_ | 6 #define CHROME_BROWSER_UI_PANELS_PANEL_MANAGER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
94 } | 94 } |
95 | 95 |
96 void enable_auto_sizing(bool enabled) { | 96 void enable_auto_sizing(bool enabled) { |
97 auto_sizing_enabled_ = enabled; | 97 auto_sizing_enabled_ = enabled; |
98 } | 98 } |
99 | 99 |
100 void SetWorkAreaForTesting(const gfx::Rect& work_area) { | 100 void SetWorkAreaForTesting(const gfx::Rect& work_area) { |
101 SetWorkArea(work_area); | 101 SetWorkArea(work_area); |
102 } | 102 } |
103 | 103 |
104 void remove_delays_for_testing() { | |
105 remove_delays_for_testing_ = true; | |
106 } | |
107 | |
104 int minimized_panel_count() { | 108 int minimized_panel_count() { |
105 return minimized_panel_count_; | 109 return minimized_panel_count_; |
106 } | 110 } |
107 | 111 |
108 // Tests should disable mouse watching if mouse movements will be simulated. | 112 // Tests should disable mouse watching if mouse movements will be simulated. |
109 void disable_mouse_watching() { | 113 void disable_mouse_watching() { |
110 mouse_watching_disabled_ = true; | 114 mouse_watching_disabled_ = true; |
111 } | 115 } |
112 #endif | 116 #endif |
113 | 117 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
145 | 149 |
146 // Rearranges the positions of the panels starting from the given iterator. | 150 // Rearranges the positions of the panels starting from the given iterator. |
147 // This is called when the display space has been changed, i.e. working | 151 // This is called when the display space has been changed, i.e. working |
148 // area being changed or a panel being closed. | 152 // area being changed or a panel being closed. |
149 void Rearrange(Panels::iterator iter_to_start, int rightmost_position); | 153 void Rearrange(Panels::iterator iter_to_start, int rightmost_position); |
150 | 154 |
151 // Help functions to drag the given panel. | 155 // Help functions to drag the given panel. |
152 void DragLeft(); | 156 void DragLeft(); |
153 void DragRight(); | 157 void DragRight(); |
154 | 158 |
155 // Checks if the titlebars have been brought up or down. If not, do not wait | |
156 // for the notifications to trigger it any more, and start to bring them up or | |
157 // down immediately. | |
158 void DelayedBringUpOrDownTitlebarsCheck(); | |
159 | |
160 // Does the real job of bringing up or down the titlebars. | 159 // Does the real job of bringing up or down the titlebars. |
161 void DoBringUpOrDownTitlebars(bool bring_up); | 160 void DoBringUpOrDownTitlebars(bool bring_up); |
162 | 161 |
163 int GetMaxPanelWidth() const; | 162 int GetMaxPanelWidth() const; |
164 int GetMaxPanelHeight() const; | 163 int GetMaxPanelHeight() const; |
165 int GetRightMostAvailablePosition() const; | 164 int GetRightMostAvailablePosition() const; |
166 | 165 |
166 void DelayedBringUpOrDownTitlebarsCheck(); | |
jennb
2011/10/29 00:16:51
If old comment is no longer correct, could you put
Dmitry Titov
2011/10/29 00:41:58
Done.
| |
167 | |
167 Panels panels_; | 168 Panels panels_; |
168 | 169 |
169 // Stores the panels that are pending to remove. We want to delay the removal | 170 // Stores the panels that are pending to remove. We want to delay the removal |
170 // when we're in the process of the dragging. | 171 // when we're in the process of the dragging. |
171 Panels panels_pending_to_remove_; | 172 Panels panels_pending_to_remove_; |
172 | 173 |
173 // Use a mouse watcher to know when to bring up titlebars to "peek" at | 174 // Use a mouse watcher to know when to bring up titlebars to "peek" at |
174 // minimized panels. Mouse movement is only tracked when there is a minimized | 175 // minimized panels. Mouse movement is only tracked when there is a minimized |
175 // panel. | 176 // panel. |
176 scoped_ptr<PanelMouseWatcher> panel_mouse_watcher_; | 177 scoped_ptr<PanelMouseWatcher> panel_mouse_watcher_; |
(...skipping 17 matching lines...) Expand all Loading... | |
194 // the original position when we cancel the dragging. | 195 // the original position when we cancel the dragging. |
195 int dragging_panel_original_x_; | 196 int dragging_panel_original_x_; |
196 | 197 |
197 // Bounds of the panel to drag. It is first set to the original bounds when | 198 // Bounds of the panel to drag. It is first set to the original bounds when |
198 // the dragging happens. Then it is updated to the position that will be set | 199 // the dragging happens. Then it is updated to the position that will be set |
199 // to when the dragging ends. | 200 // to when the dragging ends. |
200 gfx::Rect dragging_panel_bounds_; | 201 gfx::Rect dragging_panel_bounds_; |
201 | 202 |
202 scoped_refptr<AutoHidingDesktopBar> auto_hiding_desktop_bar_; | 203 scoped_refptr<AutoHidingDesktopBar> auto_hiding_desktop_bar_; |
203 | 204 |
205 // Delayed transitions support. Sometimes transitions between minimized and | |
206 // title-only states are delayed, for better usability with Taskbars/Docks. | |
204 TitlebarAction delayed_titlebar_action_; | 207 TitlebarAction delayed_titlebar_action_; |
205 | 208 bool remove_delays_for_testing_; |
209 CancelableTask* bring_up_down_task_; // Owned by MessageLoop after posting. | |
jianli
2011/10/29 00:19:18
For consistency, perhaps we can rename it somethin
Dmitry Titov
2011/10/29 00:41:58
Done.
| |
206 ScopedRunnableMethodFactory<PanelManager> method_factory_; | 210 ScopedRunnableMethodFactory<PanelManager> method_factory_; |
jianli
2011/10/29 00:19:18
Seems that this is not needed any more.
Also, do
Dmitry Titov
2011/10/29 00:41:58
Removed factory and refcounting.
Added DISABLE_RUN
| |
207 | 211 |
208 // Whether or not bounds will be updated when the preferred content size is | 212 // Whether or not bounds will be updated when the preferred content size is |
209 // changed. The testing code could set this flag to false so that other tests | 213 // changed. The testing code could set this flag to false so that other tests |
210 // will not be affected. | 214 // will not be affected. |
211 bool auto_sizing_enabled_; | 215 bool auto_sizing_enabled_; |
212 | 216 |
213 bool mouse_watching_disabled_; // For tests to simulate mouse movements. | 217 bool mouse_watching_disabled_; // For tests to simulate mouse movements. |
214 | 218 |
215 static const int kPanelsHorizontalSpacing = 4; | 219 static const int kPanelsHorizontalSpacing = 4; |
216 | 220 |
217 // Minimum width and height of a panel. | 221 // Minimum width and height of a panel. |
218 // Note: The minimum size of a widget (see widget.cc) is fixed to 100x100. | 222 // Note: The minimum size of a widget (see widget.cc) is fixed to 100x100. |
219 // TODO(jianli): Need to fix this to support smaller panel. | 223 // TODO(jianli): Need to fix this to support smaller panel. |
220 static const int kPanelMinWidth = 100; | 224 static const int kPanelMinWidth = 100; |
221 static const int kPanelMinHeight = 100; | 225 static const int kPanelMinHeight = 100; |
222 | 226 |
223 DISALLOW_COPY_AND_ASSIGN(PanelManager); | 227 DISALLOW_COPY_AND_ASSIGN(PanelManager); |
224 }; | 228 }; |
225 | 229 |
230 DISABLE_RUNNABLE_METHOD_REFCOUNT(PanelManager); | |
jennb
2011/10/29 00:16:51
Could you add comment explaining why we need this?
Dmitry Titov
2011/10/29 00:41:58
Done.
| |
231 | |
226 #endif // CHROME_BROWSER_UI_PANELS_PANEL_MANAGER_H_ | 232 #endif // CHROME_BROWSER_UI_PANELS_PANEL_MANAGER_H_ |
OLD | NEW |