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_SHELF_SHELF_LAYOUT_MANAGER_H_ | 5 #ifndef ASH_SHELF_SHELF_LAYOUT_MANAGER_H_ |
6 #define ASH_SHELF_SHELF_LAYOUT_MANAGER_H_ | 6 #define ASH_SHELF_SHELF_LAYOUT_MANAGER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
11 #include "ash/launcher/launcher.h" | 11 #include "ash/launcher/launcher.h" |
12 #include "ash/shelf/background_animator.h" | 12 #include "ash/shelf/background_animator.h" |
13 #include "ash/shelf/shelf_types.h" | 13 #include "ash/shelf/shelf_types.h" |
14 #include "ash/shell_observer.h" | 14 #include "ash/shell_observer.h" |
15 #include "ash/system/status_area_widget.h" | 15 #include "ash/system/status_area_widget.h" |
| 16 #include "ash/wm/workspace/workspace_types.h" |
16 #include "base/basictypes.h" | 17 #include "base/basictypes.h" |
17 #include "base/compiler_specific.h" | 18 #include "base/compiler_specific.h" |
18 #include "base/logging.h" | 19 #include "base/logging.h" |
19 #include "base/observer_list.h" | 20 #include "base/observer_list.h" |
20 #include "base/timer/timer.h" | 21 #include "base/timer/timer.h" |
21 #include "ui/aura/client/activation_change_observer.h" | 22 #include "ui/aura/client/activation_change_observer.h" |
22 #include "ui/aura/layout_manager.h" | 23 #include "ui/aura/layout_manager.h" |
23 #include "ui/gfx/insets.h" | 24 #include "ui/gfx/insets.h" |
24 #include "ui/gfx/rect.h" | 25 #include "ui/gfx/rect.h" |
25 #include "ui/keyboard/keyboard_controller.h" | 26 #include "ui/keyboard/keyboard_controller.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 // returns false. | 87 // returns false. |
87 bool SetAlignment(ShelfAlignment alignment); | 88 bool SetAlignment(ShelfAlignment alignment); |
88 ShelfAlignment GetAlignment() const { return alignment_; } | 89 ShelfAlignment GetAlignment() const { return alignment_; } |
89 | 90 |
90 void set_workspace_controller(WorkspaceController* controller) { | 91 void set_workspace_controller(WorkspaceController* controller) { |
91 workspace_controller_ = controller; | 92 workspace_controller_ = controller; |
92 } | 93 } |
93 | 94 |
94 bool in_layout() const { return in_layout_; } | 95 bool in_layout() const { return in_layout_; } |
95 | 96 |
| 97 // Clears internal data for shutdown process. |
| 98 void PrepareForShutdown(); |
| 99 |
96 // Returns whether the shelf and its contents (launcher, status) are visible | 100 // Returns whether the shelf and its contents (launcher, status) are visible |
97 // on the screen. | 101 // on the screen. |
98 bool IsVisible() const; | 102 bool IsVisible() const; |
99 | 103 |
100 // Returns the ideal bounds of the shelf assuming it is visible. | 104 // Returns the ideal bounds of the shelf assuming it is visible. |
101 gfx::Rect GetIdealBounds(); | 105 gfx::Rect GetIdealBounds(); |
102 | 106 |
103 // Stops any animations and sets the bounds of the launcher and status | 107 // Stops any animations and sets the bounds of the launcher and status |
104 // widgets. | 108 // widgets. |
105 void LayoutShelf(); | 109 void LayoutShelf(); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 float status_opacity; | 214 float status_opacity; |
211 gfx::Rect shelf_bounds_in_root; | 215 gfx::Rect shelf_bounds_in_root; |
212 gfx::Rect launcher_bounds_in_shelf; | 216 gfx::Rect launcher_bounds_in_shelf; |
213 gfx::Rect status_bounds_in_shelf; | 217 gfx::Rect status_bounds_in_shelf; |
214 gfx::Insets work_area_insets; | 218 gfx::Insets work_area_insets; |
215 }; | 219 }; |
216 | 220 |
217 struct State { | 221 struct State { |
218 State() : visibility_state(SHELF_VISIBLE), | 222 State() : visibility_state(SHELF_VISIBLE), |
219 auto_hide_state(SHELF_AUTO_HIDE_HIDDEN), | 223 auto_hide_state(SHELF_AUTO_HIDE_HIDDEN), |
| 224 window_state(WORKSPACE_WINDOW_STATE_DEFAULT), |
220 is_screen_locked(false) {} | 225 is_screen_locked(false) {} |
221 | 226 |
222 // Returns true if the two states are considered equal. As | 227 // Returns true if the two states are considered equal. As |
223 // |auto_hide_state| only matters if |visibility_state| is | 228 // |auto_hide_state| only matters if |visibility_state| is |
224 // |SHELF_AUTO_HIDE|, Equals() ignores the |auto_hide_state| as | 229 // |SHELF_AUTO_HIDE|, Equals() ignores the |auto_hide_state| as |
225 // appropriate. | 230 // appropriate. |
226 bool Equals(const State& other) const { | 231 bool Equals(const State& other) const { |
227 return other.visibility_state == visibility_state && | 232 return other.visibility_state == visibility_state && |
228 (visibility_state != SHELF_AUTO_HIDE || | 233 (visibility_state != SHELF_AUTO_HIDE || |
229 other.auto_hide_state == auto_hide_state) && | 234 other.auto_hide_state == auto_hide_state) && |
| 235 other.window_state == window_state && |
230 other.is_screen_locked == is_screen_locked; | 236 other.is_screen_locked == is_screen_locked; |
231 } | 237 } |
232 | 238 |
233 ShelfVisibilityState visibility_state; | 239 ShelfVisibilityState visibility_state; |
234 ShelfAutoHideState auto_hide_state; | 240 ShelfAutoHideState auto_hide_state; |
| 241 WorkspaceWindowState window_state; |
235 bool is_screen_locked; | 242 bool is_screen_locked; |
236 }; | 243 }; |
237 | 244 |
238 // Sets the visibility of the shelf to |state|. | 245 // Sets the visibility of the shelf to |state|. |
239 void SetState(ShelfVisibilityState visibility_state); | 246 void SetState(ShelfVisibilityState visibility_state); |
240 | 247 |
241 // Stops any animations and progresses them to the end. | 248 // Stops any animations and progresses them to the end. |
242 void StopAnimating(); | 249 void StopAnimating(); |
243 | 250 |
244 // Returns the width (if aligned to the side) or height (if aligned to the | 251 // Returns the width (if aligned to the side) or height (if aligned to the |
245 // bottom). | 252 // bottom). |
246 void GetShelfSize(int* width, int* height); | 253 void GetShelfSize(int* width, int* height); |
247 | 254 |
248 // Insets |bounds| by |inset| on the edge the shelf is aligned to. | 255 // Insets |bounds| by |inset| on the edge the shelf is aligned to. |
249 void AdjustBoundsBasedOnAlignment(int inset, gfx::Rect* bounds) const; | 256 void AdjustBoundsBasedOnAlignment(int inset, gfx::Rect* bounds) const; |
250 | 257 |
251 // Calculates the target bounds assuming visibility of |visible|. | 258 // Calculates the target bounds assuming visibility of |visible|. |
252 void CalculateTargetBounds(const State& state, TargetBounds* target_bounds); | 259 void CalculateTargetBounds(const State& state, TargetBounds* target_bounds); |
253 | 260 |
254 // Updates the target bounds if a gesture-drag is in progress. This is only | 261 // Updates the target bounds if a gesture-drag is in progress. This is only |
255 // used by |CalculateTargetBounds()|. | 262 // used by |CalculateTargetBounds()|. |
256 void UpdateTargetBoundsForGesture(TargetBounds* target_bounds) const; | 263 void UpdateTargetBoundsForGesture(TargetBounds* target_bounds) const; |
257 | 264 |
258 // Updates the background of the shelf. | 265 // Updates the background of the shelf. |
259 void UpdateShelfBackground(BackgroundAnimator::ChangeType type); | 266 void UpdateShelfBackground(BackgroundAnimator::ChangeType type); |
260 | 267 |
261 // Returns whether the launcher should draw a background. | 268 // Returns how the shelf background is painted. |
262 bool GetLauncherPaintsBackground() const; | 269 ShelfBackgroundType GetShelfBackgroundType() const; |
263 | 270 |
264 // Updates the auto hide state immediately. | 271 // Updates the auto hide state immediately. |
265 void UpdateAutoHideStateNow(); | 272 void UpdateAutoHideStateNow(); |
266 | 273 |
267 // Returns the AutoHideState. This value is determined from the launcher and | 274 // Returns the AutoHideState. This value is determined from the launcher and |
268 // tray. | 275 // tray. |
269 ShelfAutoHideState CalculateAutoHideState( | 276 ShelfAutoHideState CalculateAutoHideState( |
270 ShelfVisibilityState visibility_state) const; | 277 ShelfVisibilityState visibility_state) const; |
271 | 278 |
272 // Updates the hit test bounds override for launcher and status area. | 279 // Updates the hit test bounds override for launcher and status area. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 // The bounds of the keyboard. | 354 // The bounds of the keyboard. |
348 gfx::Rect keyboard_bounds_; | 355 gfx::Rect keyboard_bounds_; |
349 | 356 |
350 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager); | 357 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager); |
351 }; | 358 }; |
352 | 359 |
353 } // namespace internal | 360 } // namespace internal |
354 } // namespace ash | 361 } // namespace ash |
355 | 362 |
356 #endif // ASH_SHELF_SHELF_LAYOUT_MANAGER_H_ | 363 #endif // ASH_SHELF_SHELF_LAYOUT_MANAGER_H_ |
OLD | NEW |