Chromium Code Reviews| 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 reduce_delays_for_testing() { | |
| 105 reduced_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 |
| 167 Panels panels_; | 166 Panels panels_; |
| 168 | 167 |
| 169 // Stores the panels that are pending to remove. We want to delay the removal | 168 // Stores the panels that are pending to remove. We want to delay the removal |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 194 // the original position when we cancel the dragging. | 193 // the original position when we cancel the dragging. |
| 195 int dragging_panel_original_x_; | 194 int dragging_panel_original_x_; |
| 196 | 195 |
| 197 // Bounds of the panel to drag. It is first set to the original bounds when | 196 // 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 | 197 // the dragging happens. Then it is updated to the position that will be set |
| 199 // to when the dragging ends. | 198 // to when the dragging ends. |
| 200 gfx::Rect dragging_panel_bounds_; | 199 gfx::Rect dragging_panel_bounds_; |
| 201 | 200 |
| 202 scoped_refptr<AutoHidingDesktopBar> auto_hiding_desktop_bar_; | 201 scoped_refptr<AutoHidingDesktopBar> auto_hiding_desktop_bar_; |
| 203 | 202 |
| 203 // Delayed transitions support. Sometimes transitions between minimized and | |
| 204 // title-only states are delayed, for better usability with Taskbars/Docks. | |
| 204 TitlebarAction delayed_titlebar_action_; | 205 TitlebarAction delayed_titlebar_action_; |
| 205 | 206 bool reduced_delays_for_testing_; |
| 207 static int s_last_task_index; | |
| 206 ScopedRunnableMethodFactory<PanelManager> method_factory_; | 208 ScopedRunnableMethodFactory<PanelManager> method_factory_; |
| 209 void DelayedBringUpOrDownTitlebarsCheck(int task_index); | |
|
jianli
2011/10/28 21:31:33
This method should stay with all other methods.
Dmitry Titov
2011/10/29 00:04:56
Done.
| |
| 207 | 210 |
| 208 // Whether or not bounds will be updated when the preferred content size is | 211 // 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 | 212 // changed. The testing code could set this flag to false so that other tests |
| 210 // will not be affected. | 213 // will not be affected. |
| 211 bool auto_sizing_enabled_; | 214 bool auto_sizing_enabled_; |
| 212 | 215 |
| 213 bool mouse_watching_disabled_; // For tests to simulate mouse movements. | 216 bool mouse_watching_disabled_; // For tests to simulate mouse movements. |
| 214 | 217 |
| 215 static const int kPanelsHorizontalSpacing = 4; | 218 static const int kPanelsHorizontalSpacing = 4; |
| 216 | 219 |
| 217 // Minimum width and height of a panel. | 220 // Minimum width and height of a panel. |
| 218 // Note: The minimum size of a widget (see widget.cc) is fixed to 100x100. | 221 // 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. | 222 // TODO(jianli): Need to fix this to support smaller panel. |
| 220 static const int kPanelMinWidth = 100; | 223 static const int kPanelMinWidth = 100; |
| 221 static const int kPanelMinHeight = 100; | 224 static const int kPanelMinHeight = 100; |
| 222 | 225 |
| 223 DISALLOW_COPY_AND_ASSIGN(PanelManager); | 226 DISALLOW_COPY_AND_ASSIGN(PanelManager); |
| 224 }; | 227 }; |
| 225 | 228 |
| 226 #endif // CHROME_BROWSER_UI_PANELS_PANEL_MANAGER_H_ | 229 #endif // CHROME_BROWSER_UI_PANELS_PANEL_MANAGER_H_ |
| OLD | NEW |