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_WM_SHELF_LAYOUT_MANAGER_H_ | 5 #ifndef ASH_WM_SHELF_LAYOUT_MANAGER_H_ |
6 #define ASH_WM_SHELF_LAYOUT_MANAGER_H_ | 6 #define ASH_WM_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" |
(...skipping 10 matching lines...) Expand all Loading... |
21 namespace ash { | 21 namespace ash { |
22 namespace internal { | 22 namespace internal { |
23 | 23 |
24 // ShelfLayoutManager is the layout manager responsible for the launcher and | 24 // ShelfLayoutManager is the layout manager responsible for the launcher and |
25 // status widgets. The launcher is given the total available width and told the | 25 // status widgets. The launcher is given the total available width and told the |
26 // width of the status area. This allows the launcher to draw the background and | 26 // width of the status area. This allows the launcher to draw the background and |
27 // layout to the status area. | 27 // layout to the status area. |
28 // To respond to bounds changes in the status area StatusAreaLayoutManager works | 28 // To respond to bounds changes in the status area StatusAreaLayoutManager works |
29 // closely with ShelfLayoutManager. | 29 // closely with ShelfLayoutManager. |
30 class ASH_EXPORT ShelfLayoutManager : public aura::LayoutManager, | 30 class ASH_EXPORT ShelfLayoutManager : public aura::LayoutManager, |
31 public ui::ImplicitAnimationObserver { | 31 public ui::LayerAnimationObserver { |
32 public: | 32 public: |
33 ShelfLayoutManager(views::Widget* launcher, views::Widget* status); | 33 ShelfLayoutManager(views::Widget* launcher, views::Widget* status); |
34 virtual ~ShelfLayoutManager(); | 34 virtual ~ShelfLayoutManager(); |
35 | 35 |
36 bool in_layout() const { return in_layout_; } | 36 bool in_layout() const { return in_layout_; } |
37 | 37 |
38 // Stops any animations and sets the bounds of the launcher and status | 38 // Stops any animations and sets the bounds of the launcher and status |
39 // widgets. | 39 // widgets. |
40 void LayoutShelf(); | 40 void LayoutShelf(); |
41 | 41 |
42 // Sets the visibility of the shelf to |visible|. | 42 // Sets the visibility of the shelf to |visible|. |
43 void SetVisible(bool visible); | 43 void SetVisible(bool visible); |
44 bool visible() const { return visible_; } | 44 bool visible() const { return animating_ ? !visible_ : visible_; } |
45 | 45 |
46 views::Widget* launcher() { return launcher_; } | 46 views::Widget* launcher() { return launcher_; } |
47 views::Widget* status() { return status_; } | 47 views::Widget* status() { return status_; } |
48 | 48 |
49 // See description above field. | 49 // See description above field. |
50 int max_height() const { return max_height_; } | 50 int max_height() const { return max_height_; } |
51 | 51 |
52 // Overridden from aura::LayoutManager: | 52 // Overridden from aura::LayoutManager: |
53 virtual void OnWindowResized() OVERRIDE; | 53 virtual void OnWindowResized() OVERRIDE; |
54 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; | 54 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; |
(...skipping 10 matching lines...) Expand all Loading... |
65 gfx::Insets work_area_insets; | 65 gfx::Insets work_area_insets; |
66 }; | 66 }; |
67 | 67 |
68 // Stops any animations. | 68 // Stops any animations. |
69 void StopAnimating(); | 69 void StopAnimating(); |
70 | 70 |
71 // Calculates the target bounds assuming visibility of |visible|. | 71 // Calculates the target bounds assuming visibility of |visible|. |
72 void CalculateTargetBounds(bool visible, | 72 void CalculateTargetBounds(bool visible, |
73 TargetBounds* target_bounds); | 73 TargetBounds* target_bounds); |
74 | 74 |
75 // Implementation of ImplicitAnimationObserver | 75 // Animates |widget| to the specified bounds and opacity. |
76 virtual void OnImplicitAnimationsCompleted() OVERRIDE; | 76 void AnimateWidgetTo(views::Widget* widget, |
| 77 const gfx::Rect& target_bounds, |
| 78 float target_opacity); |
| 79 |
| 80 // LayerAnimationObserver overrides: |
| 81 virtual void OnLayerAnimationEnded( |
| 82 const ui::LayerAnimationSequence* sequence) OVERRIDE; |
| 83 virtual void OnLayerAnimationAborted( |
| 84 const ui::LayerAnimationSequence* sequence) OVERRIDE {} |
| 85 virtual void OnLayerAnimationScheduled( |
| 86 const ui::LayerAnimationSequence* sequence) OVERRIDE {} |
| 87 |
| 88 // Are we animating? |
| 89 bool animating_; |
77 | 90 |
78 // True when inside LayoutShelf method. Used to prevent calling LayoutShelf | 91 // True when inside LayoutShelf method. Used to prevent calling LayoutShelf |
79 // again from SetChildBounds(). | 92 // again from SetChildBounds(). |
80 bool in_layout_; | 93 bool in_layout_; |
81 | 94 |
82 // Current visibility. When the visibility changes this field is reset once | 95 // Current visibility. When the visibility changes this field is reset once |
83 // the animation completes. | 96 // the animation completes. |
84 bool visible_; | 97 bool visible_; |
85 | 98 |
86 // Max height needed. | 99 // Max height needed. |
87 int max_height_; | 100 int max_height_; |
88 | 101 |
89 views::Widget* launcher_; | 102 views::Widget* launcher_; |
90 views::Widget* status_; | 103 views::Widget* status_; |
91 | 104 |
92 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager); | 105 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager); |
93 }; | 106 }; |
94 | 107 |
95 } // namespace internal | 108 } // namespace internal |
96 } // namespace ash | 109 } // namespace ash |
97 | 110 |
98 #endif // ASH_WM_SHELF_LAYOUT_MANAGER_H_ | 111 #endif // ASH_WM_SHELF_LAYOUT_MANAGER_H_ |
OLD | NEW |