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_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ | 5 #ifndef ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ |
6 #define ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ | 6 #define ASH_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" |
11 #include "ash/common/shelf/shelf_types.h" | 12 #include "ash/common/shelf/shelf_types.h" |
12 #include "ash/common/system/tray/actionable_view.h" | 13 #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 StatusAreaWidget; | 20 class StatusAreaWidget; |
21 class TrayEventFilter; | 21 class TrayEventFilter; |
22 class TrayBackground; | 22 class TrayBackground; |
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 BackgroundAnimatorDelegate, | 30 public ui::ImplicitAnimationObserver, |
31 public ui::ImplicitAnimationObserver { | 31 public ShelfBackgroundAnimatorObserver { |
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 | |
89 // Called whenever the shelf alignment changes. | 86 // Called whenever the shelf alignment changes. |
90 virtual void SetShelfAlignment(ShelfAlignment alignment); | 87 virtual void SetShelfAlignment(ShelfAlignment alignment); |
91 | 88 |
92 // Called when the anchor (tray or bubble) may have moved or changed. | 89 // Called when the anchor (tray or bubble) may have moved or changed. |
93 virtual void AnchorUpdated() {} | 90 virtual void AnchorUpdated() {} |
94 | 91 |
95 // Called from GetAccessibleState, must return a valid accessible name. | 92 // Called from GetAccessibleState, must return a valid accessible name. |
96 virtual base::string16 GetAccessibleNameForTray() = 0; | 93 virtual base::string16 GetAccessibleNameForTray() = 0; |
97 | 94 |
98 // Called when the bubble is resized. | 95 // Called when the bubble is resized. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 } | 135 } |
139 TrayContainer* tray_container() const { return tray_container_; } | 136 TrayContainer* tray_container() const { return tray_container_; } |
140 ShelfAlignment shelf_alignment() const { return shelf_alignment_; } | 137 ShelfAlignment shelf_alignment() const { return shelf_alignment_; } |
141 TrayEventFilter* tray_event_filter() { return tray_event_filter_.get(); } | 138 TrayEventFilter* tray_event_filter() { return tray_event_filter_.get(); } |
142 | 139 |
143 ShelfLayoutManager* GetShelfLayoutManager(); | 140 ShelfLayoutManager* GetShelfLayoutManager(); |
144 | 141 |
145 // Updates the arrow visibility based on the launcher visibility. | 142 // Updates the arrow visibility based on the launcher visibility. |
146 void UpdateBubbleViewArrow(views::TrayBubbleView* bubble_view); | 143 void UpdateBubbleViewArrow(views::TrayBubbleView* bubble_view); |
147 | 144 |
| 145 // ShelfBackgroundAnimatorObserver: |
| 146 void UpdateShelfItemBackground(int alpha) override; |
| 147 |
148 private: | 148 private: |
149 class TrayWidgetObserver; | 149 class TrayWidgetObserver; |
150 | 150 |
151 // Called from Initialize after all status area trays have been created. | 151 // Called from Initialize after all status area trays have been created. |
152 // Sets the border based on the position of the view. | 152 // Sets the border based on the position of the view. |
153 void SetTrayBorder(); | 153 void SetTrayBorder(); |
154 | 154 |
155 // ui::ImplicitAnimationObserver: | 155 // ui::ImplicitAnimationObserver: |
156 void OnImplicitAnimationsCompleted() override; | 156 void OnImplicitAnimationsCompleted() override; |
157 bool RequiresNotificationWhenAnimatorDestroyed() const override; | 157 bool RequiresNotificationWhenAnimatorDestroyed() const override; |
(...skipping 20 matching lines...) Expand all Loading... |
178 | 178 |
179 std::unique_ptr<TrayWidgetObserver> widget_observer_; | 179 std::unique_ptr<TrayWidgetObserver> widget_observer_; |
180 std::unique_ptr<TrayEventFilter> tray_event_filter_; | 180 std::unique_ptr<TrayEventFilter> tray_event_filter_; |
181 | 181 |
182 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); | 182 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); |
183 }; | 183 }; |
184 | 184 |
185 } // namespace ash | 185 } // namespace ash |
186 | 186 |
187 #endif // ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ | 187 #endif // ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ |
OLD | NEW |