| 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 UI_AURA_SHELL_SHELF_LAYOUT_CONTROLLER_H_ | 5 #ifndef UI_AURA_SHELL_SHELF_LAYOUT_MANAGER_H_ |
| 6 #define UI_AURA_SHELL_SHELF_LAYOUT_CONTROLLER_H_ | 6 #define UI_AURA_SHELL_SHELF_LAYOUT_MANAGER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "ui/aura/layout_manager.h" |
| 11 #include "ui/gfx/compositor/layer_animation_observer.h" | 12 #include "ui/gfx/compositor/layer_animation_observer.h" |
| 12 #include "ui/gfx/insets.h" | 13 #include "ui/gfx/insets.h" |
| 13 #include "ui/gfx/rect.h" | 14 #include "ui/gfx/rect.h" |
| 14 | 15 |
| 15 namespace views { | 16 namespace views { |
| 16 class Widget; | 17 class Widget; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace aura_shell { | 20 namespace aura_shell { |
| 20 namespace internal { | 21 namespace internal { |
| 21 | 22 |
| 22 // ShelfLayoutController is responsible for showing and hiding the launcher and | 23 // ShelfLayoutManager is a layout manager responsible for the launcher. |
| 23 // status area as well as positioning them. | 24 // Also supports showing and hiding the launcher/status area |
| 24 class ShelfLayoutController : public ui::LayerAnimationObserver { | 25 // as well as positioning them. |
| 26 class ShelfLayoutManager : public aura::LayoutManager, |
| 27 public ui::LayerAnimationObserver { |
| 25 public: | 28 public: |
| 26 ShelfLayoutController(views::Widget* launcher, | 29 ShelfLayoutManager(views::Widget* launcher, |
| 27 views::Widget* status); | 30 views::Widget* status); |
| 28 virtual ~ShelfLayoutController(); | 31 virtual ~ShelfLayoutManager(); |
| 29 | 32 |
| 30 // Stops any animations and sets the bounds of the launcher and status | 33 // Stops any animations and sets the bounds of the launcher and status |
| 31 // widgets. | 34 // widgets. |
| 32 void LayoutShelf(); | 35 void LayoutShelf(); |
| 33 | 36 |
| 34 // Sets the visbility of the shelf to |visible|. | 37 // Sets the visbility of the shelf to |visible|. |
| 35 void SetVisible(bool visible); | 38 void SetVisible(bool visible); |
| 36 | 39 |
| 40 // Overridden from aura::LayoutManager: |
| 41 virtual void OnWindowResized() OVERRIDE; |
| 42 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; |
| 43 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE; |
| 44 virtual void OnChildWindowVisibilityChanged(aura::Window* child, |
| 45 bool visible) OVERRIDE; |
| 46 virtual void SetChildBounds(aura::Window* child, |
| 47 const gfx::Rect& requested_bounds) OVERRIDE; |
| 48 |
| 37 private: | 49 private: |
| 38 struct TargetBounds { | 50 struct TargetBounds { |
| 39 gfx::Rect launcher_bounds; | 51 gfx::Rect launcher_bounds; |
| 40 gfx::Rect status_bounds; | 52 gfx::Rect status_bounds; |
| 41 gfx::Insets work_area_insets; | 53 gfx::Insets work_area_insets; |
| 42 }; | 54 }; |
| 43 | 55 |
| 44 // Stops any animations. | 56 // Stops any animations. |
| 45 void StopAnimating(); | 57 void StopAnimating(); |
| 46 | 58 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 57 virtual void OnLayerAnimationEnded( | 69 virtual void OnLayerAnimationEnded( |
| 58 const ui::LayerAnimationSequence* sequence) OVERRIDE; | 70 const ui::LayerAnimationSequence* sequence) OVERRIDE; |
| 59 virtual void OnLayerAnimationAborted( | 71 virtual void OnLayerAnimationAborted( |
| 60 const ui::LayerAnimationSequence* sequence) OVERRIDE {} | 72 const ui::LayerAnimationSequence* sequence) OVERRIDE {} |
| 61 virtual void OnLayerAnimationScheduled( | 73 virtual void OnLayerAnimationScheduled( |
| 62 const ui::LayerAnimationSequence* sequence) OVERRIDE {} | 74 const ui::LayerAnimationSequence* sequence) OVERRIDE {} |
| 63 | 75 |
| 64 // Are we animating? | 76 // Are we animating? |
| 65 bool animating_; | 77 bool animating_; |
| 66 | 78 |
| 79 // True when inside LayoutShelf method. Used to prevent calling LayoutShelf |
| 80 // again from SetChildBounds(). |
| 81 bool in_layout_; |
| 82 |
| 67 // Current visibility. When the visibility changes this field is reset once | 83 // Current visibility. When the visibility changes this field is reset once |
| 68 // the animation completes. | 84 // the animation completes. |
| 69 bool visible_; | 85 bool visible_; |
| 70 | 86 |
| 71 // Max height needed. | 87 // Max height needed. |
| 72 int max_height_; | 88 int max_height_; |
| 73 | 89 |
| 74 views::Widget* launcher_; | 90 views::Widget* launcher_; |
| 75 views::Widget* status_; | 91 views::Widget* status_; |
| 76 | 92 |
| 77 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutController); | 93 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager); |
| 78 }; | 94 }; |
| 79 | 95 |
| 80 } // namespace internal | 96 } // namespace internal |
| 81 } // namespace aura_shell | 97 } // namespace aura_shell |
| 82 | 98 |
| 83 #endif // UI_AURA_SHELL_SHELF_LAYOUT_CONTROLLER_H_ | 99 #endif // UI_AURA_SHELL_SHELF_LAYOUT_MANAGER_H_ |
| OLD | NEW |