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 "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/shelf/background_animator.h" | 9 #include "ash/shelf/background_animator.h" |
10 #include "ash/shelf/shelf_types.h" | 10 #include "ash/shelf/shelf_types.h" |
11 #include "ash/system/tray/actionable_view.h" | 11 #include "ash/system/tray/actionable_view.h" |
12 #include "ui/views/bubble/tray_bubble_view.h" | 12 #include "ui/views/bubble/tray_bubble_view.h" |
13 | 13 |
14 namespace ash { | 14 namespace ash { |
15 namespace internal { | |
16 | |
17 class ShelfLayoutManager; | 15 class ShelfLayoutManager; |
18 class StatusAreaWidget; | 16 class StatusAreaWidget; |
19 class TrayEventFilter; | 17 class TrayEventFilter; |
20 class TrayBackground; | 18 class TrayBackground; |
21 | 19 |
22 // Base class for children of StatusAreaWidget: SystemTray, WebNotificationTray, | 20 // Base class for children of StatusAreaWidget: SystemTray, WebNotificationTray, |
23 // LogoutButtonTray. | 21 // LogoutButtonTray. |
24 // This class handles setting and animating the background when the Launcher | 22 // This class handles setting and animating the background when the Launcher |
25 // his shown/hidden. It also inherits from ActionableView so that the tray | 23 // his shown/hidden. It also inherits from ActionableView so that the tray |
26 // items can override PerformAction when clicked on. | 24 // items can override PerformAction when clicked on. |
(...skipping 25 matching lines...) Expand all Loading... |
52 | 50 |
53 private: | 51 private: |
54 void UpdateLayout(); | 52 void UpdateLayout(); |
55 | 53 |
56 ShelfAlignment alignment_; | 54 ShelfAlignment alignment_; |
57 gfx::Size size_; | 55 gfx::Size size_; |
58 | 56 |
59 DISALLOW_COPY_AND_ASSIGN(TrayContainer); | 57 DISALLOW_COPY_AND_ASSIGN(TrayContainer); |
60 }; | 58 }; |
61 | 59 |
62 explicit TrayBackgroundView(internal::StatusAreaWidget* status_area_widget); | 60 explicit TrayBackgroundView(StatusAreaWidget* status_area_widget); |
63 virtual ~TrayBackgroundView(); | 61 virtual ~TrayBackgroundView(); |
64 | 62 |
65 // Called after the tray has been added to the widget containing it. | 63 // Called after the tray has been added to the widget containing it. |
66 virtual void Initialize(); | 64 virtual void Initialize(); |
67 | 65 |
68 // Overridden from views::View. | 66 // Overridden from views::View. |
69 virtual const char* GetClassName() const OVERRIDE; | 67 virtual const char* GetClassName() const OVERRIDE; |
70 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; | 68 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; |
71 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; | 69 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; |
72 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; | 70 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; |
73 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; | 71 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; |
74 virtual void AboutToRequestFocusFromTabTraversal(bool reverse) OVERRIDE; | 72 virtual void AboutToRequestFocusFromTabTraversal(bool reverse) OVERRIDE; |
75 | 73 |
76 // Overridden from internal::ActionableView. | 74 // Overridden from ActionableView. |
77 virtual bool PerformAction(const ui::Event& event) OVERRIDE; | 75 virtual bool PerformAction(const ui::Event& event) OVERRIDE; |
78 virtual gfx::Rect GetFocusBounds() OVERRIDE; | 76 virtual gfx::Rect GetFocusBounds() OVERRIDE; |
79 | 77 |
80 // Overridden from internal::BackgroundAnimatorDelegate. | 78 // Overridden from BackgroundAnimatorDelegate. |
81 virtual void UpdateBackground(int alpha) OVERRIDE; | 79 virtual void UpdateBackground(int alpha) OVERRIDE; |
82 | 80 |
83 // Called whenever the shelf alignment changes. | 81 // Called whenever the shelf alignment changes. |
84 virtual void SetShelfAlignment(ShelfAlignment alignment); | 82 virtual void SetShelfAlignment(ShelfAlignment alignment); |
85 | 83 |
86 // Called when the anchor (tray or bubble) may have moved or changed. | 84 // Called when the anchor (tray or bubble) may have moved or changed. |
87 virtual void AnchorUpdated() {} | 85 virtual void AnchorUpdated() {} |
88 | 86 |
89 // Called from GetAccessibleState, must return a valid accessible name. | 87 // Called from GetAccessibleState, must return a valid accessible name. |
90 virtual base::string16 GetAccessibleNameForTray() = 0; | 88 virtual base::string16 GetAccessibleNameForTray() = 0; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 // Unowned pointer to parent widget. | 155 // Unowned pointer to parent widget. |
158 StatusAreaWidget* status_area_widget_; | 156 StatusAreaWidget* status_area_widget_; |
159 | 157 |
160 // Convenience pointer to the contents view. | 158 // Convenience pointer to the contents view. |
161 TrayContainer* tray_container_; | 159 TrayContainer* tray_container_; |
162 | 160 |
163 // Shelf alignment. | 161 // Shelf alignment. |
164 ShelfAlignment shelf_alignment_; | 162 ShelfAlignment shelf_alignment_; |
165 | 163 |
166 // Owned by the view passed to SetContents(). | 164 // Owned by the view passed to SetContents(). |
167 internal::TrayBackground* background_; | 165 TrayBackground* background_; |
168 | 166 |
169 // Animators for the background. They are only used for the old shelf layout. | 167 // Animators for the background. They are only used for the old shelf layout. |
170 internal::BackgroundAnimator hide_background_animator_; | 168 BackgroundAnimator hide_background_animator_; |
171 internal::BackgroundAnimator hover_background_animator_; | 169 BackgroundAnimator hover_background_animator_; |
172 | 170 |
173 // True if the background gets hovered. | 171 // True if the background gets hovered. |
174 bool hovered_; | 172 bool hovered_; |
175 | 173 |
176 // This variable stores the activation override which will tint the background | 174 // This variable stores the activation override which will tint the background |
177 // differently if set to true. | 175 // differently if set to true. |
178 bool draw_background_as_active_; | 176 bool draw_background_as_active_; |
179 | 177 |
180 scoped_ptr<TrayWidgetObserver> widget_observer_; | 178 scoped_ptr<TrayWidgetObserver> widget_observer_; |
181 scoped_ptr<TrayEventFilter> tray_event_filter_; | 179 scoped_ptr<TrayEventFilter> tray_event_filter_; |
182 | 180 |
183 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); | 181 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); |
184 }; | 182 }; |
185 | 183 |
186 } // namespace internal | |
187 } // namespace ash | 184 } // namespace ash |
188 | 185 |
189 #endif // ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ | 186 #endif // ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ |
OLD | NEW |