| 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" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "ui/gfx/rect.h" | 26 #include "ui/gfx/rect.h" |
| 27 #include "ui/keyboard/keyboard_controller.h" | 27 #include "ui/keyboard/keyboard_controller.h" |
| 28 #include "ui/keyboard/keyboard_controller_observer.h" | 28 #include "ui/keyboard/keyboard_controller_observer.h" |
| 29 | 29 |
| 30 namespace aura { | 30 namespace aura { |
| 31 class RootWindow; | 31 class RootWindow; |
| 32 } | 32 } |
| 33 | 33 |
| 34 namespace ui { | 34 namespace ui { |
| 35 class GestureEvent; | 35 class GestureEvent; |
| 36 class ImplicitAnimationObserver; |
| 36 } | 37 } |
| 37 | 38 |
| 38 namespace ash { | 39 namespace ash { |
| 39 class ScreenAsh; | 40 class ScreenAsh; |
| 40 class ShelfLayoutManagerObserver; | 41 class ShelfLayoutManagerObserver; |
| 41 class ShelfWidget; | 42 class ShelfWidget; |
| 42 namespace internal { | 43 namespace internal { |
| 43 | 44 |
| 44 class PanelLayoutManagerTest; | 45 class PanelLayoutManagerTest; |
| 45 class ShelfBezelEventFilter; | 46 class ShelfBezelEventFilter; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 92 |
| 92 // Sets the alignment. Returns true if the alignment is changed. Otherwise, | 93 // Sets the alignment. Returns true if the alignment is changed. Otherwise, |
| 93 // returns false. | 94 // returns false. |
| 94 bool SetAlignment(ShelfAlignment alignment); | 95 bool SetAlignment(ShelfAlignment alignment); |
| 95 ShelfAlignment GetAlignment() const { return alignment_; } | 96 ShelfAlignment GetAlignment() const { return alignment_; } |
| 96 | 97 |
| 97 void set_workspace_controller(WorkspaceController* controller) { | 98 void set_workspace_controller(WorkspaceController* controller) { |
| 98 workspace_controller_ = controller; | 99 workspace_controller_ = controller; |
| 99 } | 100 } |
| 100 | 101 |
| 101 bool in_layout() const { return in_layout_; } | 102 bool updating_bounds() const { return updating_bounds_; } |
| 102 | 103 |
| 103 // Clears internal data for shutdown process. | 104 // Clears internal data for shutdown process. |
| 104 void PrepareForShutdown(); | 105 void PrepareForShutdown(); |
| 105 | 106 |
| 106 // Returns whether the shelf and its contents (launcher, status) are visible | 107 // Returns whether the shelf and its contents (launcher, status) are visible |
| 107 // on the screen. | 108 // on the screen. |
| 108 bool IsVisible() const; | 109 bool IsVisible() const; |
| 109 | 110 |
| 110 // Returns the ideal bounds of the shelf assuming it is visible. | 111 // Returns the ideal bounds of the shelf assuming it is visible. |
| 111 gfx::Rect GetIdealBounds(); | 112 gfx::Rect GetIdealBounds(); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 | 245 |
| 245 ShelfVisibilityState visibility_state; | 246 ShelfVisibilityState visibility_state; |
| 246 ShelfAutoHideState auto_hide_state; | 247 ShelfAutoHideState auto_hide_state; |
| 247 WorkspaceWindowState window_state; | 248 WorkspaceWindowState window_state; |
| 248 bool is_screen_locked; | 249 bool is_screen_locked; |
| 249 }; | 250 }; |
| 250 | 251 |
| 251 // Sets the visibility of the shelf to |state|. | 252 // Sets the visibility of the shelf to |state|. |
| 252 void SetState(ShelfVisibilityState visibility_state); | 253 void SetState(ShelfVisibilityState visibility_state); |
| 253 | 254 |
| 255 // Updates the bounds and opacity of the launcher and status widgets. |
| 256 // If |observer| is specified, it will be called back when the animations, if |
| 257 // any, are complete. |
| 258 void UpdateBoundsAndOpacity(const TargetBounds& target_bounds, |
| 259 bool animate, |
| 260 ui::ImplicitAnimationObserver* observer); |
| 261 |
| 254 // Stops any animations and progresses them to the end. | 262 // Stops any animations and progresses them to the end. |
| 255 void StopAnimating(); | 263 void StopAnimating(); |
| 256 | 264 |
| 257 // Returns the width (if aligned to the side) or height (if aligned to the | 265 // Returns the width (if aligned to the side) or height (if aligned to the |
| 258 // bottom). | 266 // bottom). |
| 259 void GetShelfSize(int* width, int* height); | 267 void GetShelfSize(int* width, int* height); |
| 260 | 268 |
| 261 // Insets |bounds| by |inset| on the edge the shelf is aligned to. | 269 // Insets |bounds| by |inset| on the edge the shelf is aligned to. |
| 262 void AdjustBoundsBasedOnAlignment(int inset, gfx::Rect* bounds) const; | 270 void AdjustBoundsBasedOnAlignment(int inset, gfx::Rect* bounds) const; |
| 263 | 271 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 virtual void OnDockBoundsChanging(const gfx::Rect& dock_bounds) OVERRIDE; | 320 virtual void OnDockBoundsChanging(const gfx::Rect& dock_bounds) OVERRIDE; |
| 313 | 321 |
| 314 // Generates insets for inward edge based on the current shelf alignment. | 322 // Generates insets for inward edge based on the current shelf alignment. |
| 315 gfx::Insets GetInsetsForAlignment(int distance) const; | 323 gfx::Insets GetInsetsForAlignment(int distance) const; |
| 316 | 324 |
| 317 // The RootWindow is cached so that we don't invoke Shell::GetInstance() from | 325 // The RootWindow is cached so that we don't invoke Shell::GetInstance() from |
| 318 // our destructor. We avoid that as at the time we're deleted Shell is being | 326 // our destructor. We avoid that as at the time we're deleted Shell is being |
| 319 // deleted too. | 327 // deleted too. |
| 320 aura::RootWindow* root_window_; | 328 aura::RootWindow* root_window_; |
| 321 | 329 |
| 322 // True when inside LayoutShelf method. Used to prevent calling LayoutShelf | 330 // True when inside UpdateBoundsAndOpacity() method. Used to prevent calling |
| 323 // again from SetChildBounds(). | 331 // UpdateBoundsAndOpacity() from SetChildBounds(). |
| 324 bool in_layout_; | 332 bool updating_bounds_; |
| 325 | 333 |
| 326 // See description above setter. | 334 // See description above setter. |
| 327 ShelfAutoHideBehavior auto_hide_behavior_; | 335 ShelfAutoHideBehavior auto_hide_behavior_; |
| 328 | 336 |
| 329 ShelfAlignment alignment_; | 337 ShelfAlignment alignment_; |
| 330 | 338 |
| 331 // Current state. | 339 // Current state. |
| 332 State state_; | 340 State state_; |
| 333 | 341 |
| 334 ShelfWidget* shelf_; | 342 ShelfWidget* shelf_; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 353 | 361 |
| 354 ObserverList<ShelfLayoutManagerObserver> observers_; | 362 ObserverList<ShelfLayoutManagerObserver> observers_; |
| 355 | 363 |
| 356 // The shelf reacts to gesture-drags, and can be set to auto-hide for certain | 364 // The shelf reacts to gesture-drags, and can be set to auto-hide for certain |
| 357 // gestures. Some shelf behaviour (e.g. visibility state, background color | 365 // gestures. Some shelf behaviour (e.g. visibility state, background color |
| 358 // etc.) are affected by various stages of the drag. The enum keeps track of | 366 // etc.) are affected by various stages of the drag. The enum keeps track of |
| 359 // the present status of the gesture drag. | 367 // the present status of the gesture drag. |
| 360 enum GestureDragStatus { | 368 enum GestureDragStatus { |
| 361 GESTURE_DRAG_NONE, | 369 GESTURE_DRAG_NONE, |
| 362 GESTURE_DRAG_IN_PROGRESS, | 370 GESTURE_DRAG_IN_PROGRESS, |
| 371 GESTURE_DRAG_CANCEL_IN_PROGRESS, |
| 363 GESTURE_DRAG_COMPLETE_IN_PROGRESS | 372 GESTURE_DRAG_COMPLETE_IN_PROGRESS |
| 364 }; | 373 }; |
| 365 GestureDragStatus gesture_drag_status_; | 374 GestureDragStatus gesture_drag_status_; |
| 366 | 375 |
| 367 // Tracks the amount of the drag. The value is only valid when | 376 // Tracks the amount of the drag. The value is only valid when |
| 368 // |gesture_drag_status_| is set to GESTURE_DRAG_IN_PROGRESS. | 377 // |gesture_drag_status_| is set to GESTURE_DRAG_IN_PROGRESS. |
| 369 float gesture_drag_amount_; | 378 float gesture_drag_amount_; |
| 370 | 379 |
| 371 // Manage the auto-hide state during the gesture. | 380 // Manage the auto-hide state during the gesture. |
| 372 ShelfAutoHideState gesture_drag_auto_hide_state_; | 381 ShelfAutoHideState gesture_drag_auto_hide_state_; |
| 373 | 382 |
| 374 // Used to delay updating shelf background. | 383 // Used to delay updating shelf background. |
| 375 UpdateShelfObserver* update_shelf_observer_; | 384 UpdateShelfObserver* update_shelf_observer_; |
| 376 | 385 |
| 377 // The bounds of the keyboard. | 386 // The bounds of the keyboard. |
| 378 gfx::Rect keyboard_bounds_; | 387 gfx::Rect keyboard_bounds_; |
| 379 | 388 |
| 380 // The bounds of the dock. | 389 // The bounds of the dock. |
| 381 gfx::Rect dock_bounds_; | 390 gfx::Rect dock_bounds_; |
| 382 | 391 |
| 383 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager); | 392 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager); |
| 384 }; | 393 }; |
| 385 | 394 |
| 386 } // namespace internal | 395 } // namespace internal |
| 387 } // namespace ash | 396 } // namespace ash |
| 388 | 397 |
| 389 #endif // ASH_SHELF_SHELF_LAYOUT_MANAGER_H_ | 398 #endif // ASH_SHELF_SHELF_LAYOUT_MANAGER_H_ |
| OLD | NEW |