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_COMMON_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ | 5 #ifndef ASH_COMMON_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ |
6 #define ASH_COMMON_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ | 6 #define ASH_COMMON_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
11 #include "ash/common/shelf/shelf_background_animator_observer.h" | |
12 #include "ash/common/shelf/shelf_types.h" | 11 #include "ash/common/shelf/shelf_types.h" |
13 #include "ash/common/system/tray/actionable_view.h" | 12 #include "ash/common/system/tray/actionable_view.h" |
| 13 #include "ash/common/wm/background_animator.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "ui/compositor/layer_animation_observer.h" | 15 #include "ui/compositor/layer_animation_observer.h" |
16 #include "ui/views/bubble/tray_bubble_view.h" | 16 #include "ui/views/bubble/tray_bubble_view.h" |
17 | 17 |
18 namespace ash { | 18 namespace ash { |
19 class ShelfLayoutManager; | 19 class ShelfLayoutManager; |
20 class TrayEventFilter; | 20 class TrayEventFilter; |
21 class TrayBackground; | 21 class TrayBackground; |
22 class WmShelf; | 22 class WmShelf; |
23 | 23 |
24 // Base class for children of StatusAreaWidget: SystemTray, WebNotificationTray, | 24 // Base class for children of StatusAreaWidget: SystemTray, WebNotificationTray, |
25 // LogoutButtonTray, OverviewButtonTray. | 25 // LogoutButtonTray, OverviewButtonTray. |
26 // This class handles setting and animating the background when the Launcher | 26 // This class handles setting and animating the background when the Launcher |
27 // his shown/hidden. It also inherits from ActionableView so that the tray | 27 // his shown/hidden. It also inherits from ActionableView so that the tray |
28 // items can override PerformAction when clicked on. | 28 // items can override PerformAction when clicked on. |
29 class ASH_EXPORT TrayBackgroundView : public ActionableView, | 29 class ASH_EXPORT TrayBackgroundView : public ActionableView, |
30 public ui::ImplicitAnimationObserver, | 30 public BackgroundAnimatorDelegate, |
31 public ShelfBackgroundAnimatorObserver { | 31 public ui::ImplicitAnimationObserver { |
32 public: | 32 public: |
33 static const char kViewClassName[]; | 33 static const char kViewClassName[]; |
34 | 34 |
35 // Base class for tray containers. Sets the border and layout. The container | 35 // Base class for tray containers. Sets the border and layout. The container |
36 // auto-resizes the widget when necessary. | 36 // auto-resizes the widget when necessary. |
37 class TrayContainer : public views::View { | 37 class TrayContainer : public views::View { |
38 public: | 38 public: |
39 explicit TrayContainer(ShelfAlignment alignment); | 39 explicit TrayContainer(ShelfAlignment alignment); |
40 ~TrayContainer() override {} | 40 ~TrayContainer() override {} |
41 | 41 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 const char* GetClassName() const override; | 76 const char* GetClassName() const override; |
77 void ChildPreferredSizeChanged(views::View* child) override; | 77 void ChildPreferredSizeChanged(views::View* child) override; |
78 void GetAccessibleState(ui::AXViewState* state) override; | 78 void GetAccessibleState(ui::AXViewState* state) override; |
79 void AboutToRequestFocusFromTabTraversal(bool reverse) override; | 79 void AboutToRequestFocusFromTabTraversal(bool reverse) override; |
80 | 80 |
81 // ActionableView: | 81 // ActionableView: |
82 bool PerformAction(const ui::Event& event) override; | 82 bool PerformAction(const ui::Event& event) override; |
83 gfx::Rect GetFocusBounds() override; | 83 gfx::Rect GetFocusBounds() override; |
84 void OnGestureEvent(ui::GestureEvent* event) override; | 84 void OnGestureEvent(ui::GestureEvent* event) override; |
85 | 85 |
| 86 // BackgroundAnimatorDelegate: |
| 87 void UpdateBackground(int alpha) override; |
| 88 |
86 // Called whenever the shelf alignment changes. | 89 // Called whenever the shelf alignment changes. |
87 virtual void SetShelfAlignment(ShelfAlignment alignment); | 90 virtual void SetShelfAlignment(ShelfAlignment alignment); |
88 | 91 |
89 // Called when the anchor (tray or bubble) may have moved or changed. | 92 // Called when the anchor (tray or bubble) may have moved or changed. |
90 virtual void AnchorUpdated() {} | 93 virtual void AnchorUpdated() {} |
91 | 94 |
92 // Called from GetAccessibleState, must return a valid accessible name. | 95 // Called from GetAccessibleState, must return a valid accessible name. |
93 virtual base::string16 GetAccessibleNameForTray() = 0; | 96 virtual base::string16 GetAccessibleNameForTray() = 0; |
94 | 97 |
95 // Called when the bubble is resized. | 98 // Called when the bubble is resized. |
(...skipping 29 matching lines...) Expand all Loading... |
125 bool draw_background_as_active() const { return draw_background_as_active_; } | 128 bool draw_background_as_active() const { return draw_background_as_active_; } |
126 | 129 |
127 TrayContainer* tray_container() const { return tray_container_; } | 130 TrayContainer* tray_container() const { return tray_container_; } |
128 ShelfAlignment shelf_alignment() const { return shelf_alignment_; } | 131 ShelfAlignment shelf_alignment() const { return shelf_alignment_; } |
129 TrayEventFilter* tray_event_filter() { return tray_event_filter_.get(); } | 132 TrayEventFilter* tray_event_filter() { return tray_event_filter_.get(); } |
130 WmShelf* shelf() { return wm_shelf_; } | 133 WmShelf* shelf() { return wm_shelf_; } |
131 | 134 |
132 // Updates the arrow visibility based on the launcher visibility. | 135 // Updates the arrow visibility based on the launcher visibility. |
133 void UpdateBubbleViewArrow(views::TrayBubbleView* bubble_view); | 136 void UpdateBubbleViewArrow(views::TrayBubbleView* bubble_view); |
134 | 137 |
135 // ShelfBackgroundAnimatorObserver: | |
136 void UpdateShelfItemBackground(int alpha) override; | |
137 | |
138 private: | 138 private: |
139 class TrayWidgetObserver; | 139 class TrayWidgetObserver; |
140 | 140 |
141 // Called from Initialize after all status area trays have been created. | 141 // Called from Initialize after all status area trays have been created. |
142 // Sets the border based on the position of the view. | 142 // Sets the border based on the position of the view. |
143 void SetTrayBorder(); | 143 void SetTrayBorder(); |
144 | 144 |
145 // ui::ImplicitAnimationObserver: | 145 // ui::ImplicitAnimationObserver: |
146 void OnImplicitAnimationsCompleted() override; | 146 void OnImplicitAnimationsCompleted() override; |
147 bool RequiresNotificationWhenAnimatorDestroyed() const override; | 147 bool RequiresNotificationWhenAnimatorDestroyed() const override; |
(...skipping 21 matching lines...) Expand all Loading... |
169 | 169 |
170 std::unique_ptr<TrayWidgetObserver> widget_observer_; | 170 std::unique_ptr<TrayWidgetObserver> widget_observer_; |
171 std::unique_ptr<TrayEventFilter> tray_event_filter_; | 171 std::unique_ptr<TrayEventFilter> tray_event_filter_; |
172 | 172 |
173 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); | 173 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); |
174 }; | 174 }; |
175 | 175 |
176 } // namespace ash | 176 } // namespace ash |
177 | 177 |
178 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ | 178 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ |
OLD | NEW |