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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 PanelStrip* panel_strip() const { | 82 PanelStrip* panel_strip() const { |
83 return panel_strip_.get(); | 83 return panel_strip_.get(); |
84 } | 84 } |
85 | 85 |
86 bool is_full_screen() const { return is_full_screen_; } | 86 bool is_full_screen() const { return is_full_screen_; } |
87 PanelOverflowStrip* panel_overflow_strip() const { | 87 PanelOverflowStrip* panel_overflow_strip() const { |
88 return panel_overflow_strip_.get(); | 88 return panel_overflow_strip_.get(); |
89 } | 89 } |
90 | 90 |
| 91 // Reduces time interval in tests to shorten test run time. |
| 92 // Wrapper should be used around all time intervals in panels code. |
| 93 static inline double AdjustTimeInterval(double interval) { |
| 94 if (shorten_time_intervals_) |
| 95 return interval / 100.0; |
| 96 else |
| 97 return interval; |
| 98 } |
| 99 |
91 #ifdef UNIT_TEST | 100 #ifdef UNIT_TEST |
| 101 static void shorten_time_intervals_for_testing() { |
| 102 shorten_time_intervals_ = true; |
| 103 } |
| 104 |
92 void set_auto_hiding_desktop_bar( | 105 void set_auto_hiding_desktop_bar( |
93 AutoHidingDesktopBar* auto_hiding_desktop_bar) { | 106 AutoHidingDesktopBar* auto_hiding_desktop_bar) { |
94 auto_hiding_desktop_bar_ = auto_hiding_desktop_bar; | 107 auto_hiding_desktop_bar_ = auto_hiding_desktop_bar; |
95 } | 108 } |
96 | 109 |
97 void enable_auto_sizing(bool enabled) { | 110 void enable_auto_sizing(bool enabled) { |
98 auto_sizing_enabled_ = enabled; | 111 auto_sizing_enabled_ = enabled; |
99 } | 112 } |
100 | 113 |
101 const gfx::Rect& work_area() const { | 114 const gfx::Rect& work_area() const { |
(...skipping 30 matching lines...) Expand all Loading... |
132 | 145 |
133 // Positions the various groupings of panels. | 146 // Positions the various groupings of panels. |
134 void Layout(); | 147 void Layout(); |
135 | 148 |
136 // Tests if the current active app is in full screen mode. | 149 // Tests if the current active app is in full screen mode. |
137 void CheckFullScreenMode(); | 150 void CheckFullScreenMode(); |
138 | 151 |
139 // Tests may want to use a mock panel mouse watcher. | 152 // Tests may want to use a mock panel mouse watcher. |
140 void SetMouseWatcher(PanelMouseWatcher* watcher); | 153 void SetMouseWatcher(PanelMouseWatcher* watcher); |
141 | 154 |
| 155 // Tests may want to shorten time intervals to reduce running time. |
| 156 static bool shorten_time_intervals_; |
| 157 |
142 scoped_ptr<PanelStrip> panel_strip_; | 158 scoped_ptr<PanelStrip> panel_strip_; |
143 scoped_ptr<PanelOverflowStrip> panel_overflow_strip_; | 159 scoped_ptr<PanelOverflowStrip> panel_overflow_strip_; |
144 | 160 |
145 // Use a mouse watcher to know when to bring up titlebars to "peek" at | 161 // Use a mouse watcher to know when to bring up titlebars to "peek" at |
146 // minimized panels. Mouse movement is only tracked when there is a minimized | 162 // minimized panels. Mouse movement is only tracked when there is a minimized |
147 // panel. | 163 // panel. |
148 scoped_ptr<PanelMouseWatcher> panel_mouse_watcher_; | 164 scoped_ptr<PanelMouseWatcher> panel_mouse_watcher_; |
149 | 165 |
150 // The maximum work area avaialble. This area does not include the area taken | 166 // The maximum work area avaialble. This area does not include the area taken |
151 // by the always-visible (non-auto-hiding) desktop bars. | 167 // by the always-visible (non-auto-hiding) desktop bars. |
(...skipping 15 matching lines...) Expand all Loading... |
167 // Timer used to track if the current active app is in full screen mode. | 183 // Timer used to track if the current active app is in full screen mode. |
168 base::RepeatingTimer<PanelManager> full_screen_mode_timer_; | 184 base::RepeatingTimer<PanelManager> full_screen_mode_timer_; |
169 | 185 |
170 // True if current active app is in full screen mode. | 186 // True if current active app is in full screen mode. |
171 bool is_full_screen_; | 187 bool is_full_screen_; |
172 | 188 |
173 DISALLOW_COPY_AND_ASSIGN(PanelManager); | 189 DISALLOW_COPY_AND_ASSIGN(PanelManager); |
174 }; | 190 }; |
175 | 191 |
176 #endif // CHROME_BROWSER_UI_PANELS_PANEL_MANAGER_H_ | 192 #endif // CHROME_BROWSER_UI_PANELS_PANEL_MANAGER_H_ |
OLD | NEW |