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_SYSTEM_TRAY_H_ | 5 #ifndef ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ |
6 #define ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ | 6 #define ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "ash/launcher/background_animator.h" | 9 #include "ash/launcher/background_animator.h" |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 class NetworkObserver; | 31 class NetworkObserver; |
32 class PowerStatusObserver; | 32 class PowerStatusObserver; |
33 class UpdateObserver; | 33 class UpdateObserver; |
34 class UserObserver; | 34 class UserObserver; |
35 | 35 |
36 class SystemTrayItem; | 36 class SystemTrayItem; |
37 | 37 |
38 namespace internal { | 38 namespace internal { |
39 class SystemTrayBackground; | 39 class SystemTrayBackground; |
40 class SystemTrayBubble; | 40 class SystemTrayBubble; |
| 41 class SystemTrayLayerAnimationObserver; |
41 } | 42 } |
42 | 43 |
43 class ASH_EXPORT SystemTray : public internal::ActionableView, | 44 class ASH_EXPORT SystemTray : public internal::ActionableView, |
44 public internal::BackgroundAnimatorDelegate { | 45 public internal::BackgroundAnimatorDelegate { |
45 public: | 46 public: |
46 SystemTray(); | 47 SystemTray(); |
47 virtual ~SystemTray(); | 48 virtual ~SystemTray(); |
48 | 49 |
49 // Creates the default set of items for the sytem tray. | 50 // Creates the default set of items for the sytem tray. |
50 void CreateItems(); | 51 void CreateItems(); |
(...skipping 13 matching lines...) Expand all Loading... |
64 // Shows details of a particular item. If |close_delay_in_seconds| is | 65 // Shows details of a particular item. If |close_delay_in_seconds| is |
65 // non-zero, then the view is automatically closed after the specified time. | 66 // non-zero, then the view is automatically closed after the specified time. |
66 void ShowDetailedView(SystemTrayItem* item, | 67 void ShowDetailedView(SystemTrayItem* item, |
67 int close_delay_in_seconds, | 68 int close_delay_in_seconds, |
68 bool activate); | 69 bool activate); |
69 | 70 |
70 // Continue showing the existing detailed view, if any, for |close_delay| | 71 // Continue showing the existing detailed view, if any, for |close_delay| |
71 // seconds. | 72 // seconds. |
72 void SetDetailedViewCloseDelay(int close_delay); | 73 void SetDetailedViewCloseDelay(int close_delay); |
73 | 74 |
| 75 // Shows the notification view for |item|. |
| 76 void ShowNotificationView(SystemTrayItem* item); |
| 77 |
| 78 // Hides the notification view for |item|. |
| 79 void HideNotificationView(SystemTrayItem* item); |
| 80 |
74 // Updates the items when the login status of the system changes. | 81 // Updates the items when the login status of the system changes. |
75 void UpdateAfterLoginStatusChange(user::LoginStatus login_status); | 82 void UpdateAfterLoginStatusChange(user::LoginStatus login_status); |
76 | 83 |
77 // Sets whether the tray paints a background. Default is true, but is set to | 84 // Sets whether the tray paints a background. Default is true, but is set to |
78 // false if a window overlaps the shelf. | 85 // false if a window overlaps the shelf. |
79 void SetPaintsBackground( | 86 void SetPaintsBackground( |
80 bool value, | 87 bool value, |
81 internal::BackgroundAnimator::ChangeType change_type); | 88 internal::BackgroundAnimator::ChangeType change_type); |
82 | 89 |
83 // Returns true if the launcher should show. | 90 // Returns true if the launcher should show. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 UserObserver* user_observer() const { | 130 UserObserver* user_observer() const { |
124 return user_observer_; | 131 return user_observer_; |
125 } | 132 } |
126 | 133 |
127 // Accessors for testing. | 134 // Accessors for testing. |
128 | 135 |
129 // Returns true if the bubble exists. | 136 // Returns true if the bubble exists. |
130 bool CloseBubbleForTest() const; | 137 bool CloseBubbleForTest() const; |
131 | 138 |
132 private: | 139 private: |
| 140 friend class internal::SystemTrayLayerAnimationObserver; |
133 friend class internal::SystemTrayBubble; | 141 friend class internal::SystemTrayBubble; |
134 | 142 |
135 // Called when the widget associated with |bubble| closes. |bubble| should | 143 // Called when the widget associated with |bubble| closes. |bubble| should |
136 // always == |bubble_|. This triggers destroying |bubble_| and hiding the | 144 // always == |bubble_|. This triggers destroying |bubble_| and hiding the |
137 // launcher if necessary. | 145 // launcher if necessary. |
138 void RemoveBubble(internal::SystemTrayBubble* bubble); | 146 void RemoveBubble(internal::SystemTrayBubble* bubble); |
139 | 147 |
140 const ScopedVector<SystemTrayItem>& items() const { return items_; } | 148 const ScopedVector<SystemTrayItem>& items() const { return items_; } |
141 | 149 |
| 150 // Constructs or re-constructs |bubble_| and populates it with |items|. |
142 void ShowItems(const std::vector<SystemTrayItem*>& items, | 151 void ShowItems(const std::vector<SystemTrayItem*>& items, |
143 bool details, | 152 bool details, |
144 bool activate); | 153 bool activate); |
145 | 154 |
| 155 // Constructs or re-constructs |notification_bubble_| and populates it with |
| 156 // |notification_items_|, or destroys it if there are no notification items. |
| 157 void ShowNotifications(); |
| 158 |
| 159 // Called when the anchor (tray or bubble) may have moved or changed. |
| 160 void UpdateNotificationAnchor(); |
| 161 |
146 // Overridden from internal::ActionableView. | 162 // Overridden from internal::ActionableView. |
147 virtual bool PerformAction(const views::Event& event) OVERRIDE; | 163 virtual bool PerformAction(const views::Event& event) OVERRIDE; |
148 | 164 |
149 // Overridden from views::View. | 165 // Overridden from views::View. |
150 virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE; | 166 virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE; |
151 virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE; | 167 virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE; |
152 virtual void AboutToRequestFocusFromTabTraversal(bool reverse) OVERRIDE; | 168 virtual void AboutToRequestFocusFromTabTraversal(bool reverse) OVERRIDE; |
153 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 169 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
154 virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE; | 170 virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE; |
155 | 171 |
156 // Overridden from internal::BackgroundAnimatorDelegate. | 172 // Overridden from internal::BackgroundAnimatorDelegate. |
157 virtual void UpdateBackground(int alpha) OVERRIDE; | 173 virtual void UpdateBackground(int alpha) OVERRIDE; |
158 | 174 |
159 ScopedVector<SystemTrayItem> items_; | 175 ScopedVector<SystemTrayItem> items_; |
160 | 176 |
| 177 std::vector<SystemTrayItem*> notification_items_; |
| 178 |
161 // The container for all the tray views of the items. | 179 // The container for all the tray views of the items. |
162 views::View* container_; | 180 views::View* tray_container_; |
163 | 181 |
164 // These observers are not owned by the tray. | 182 // These observers are not owned by the tray. |
165 AccessibilityObserver* accessibility_observer_; | 183 AccessibilityObserver* accessibility_observer_; |
166 AudioObserver* audio_observer_; | 184 AudioObserver* audio_observer_; |
167 BluetoothObserver* bluetooth_observer_; | 185 BluetoothObserver* bluetooth_observer_; |
168 BrightnessObserver* brightness_observer_; | 186 BrightnessObserver* brightness_observer_; |
169 CapsLockObserver* caps_lock_observer_; | 187 CapsLockObserver* caps_lock_observer_; |
170 ClockObserver* clock_observer_; | 188 ClockObserver* clock_observer_; |
171 DriveObserver* drive_observer_; | 189 DriveObserver* drive_observer_; |
172 IMEObserver* ime_observer_; | 190 IMEObserver* ime_observer_; |
173 NetworkObserver* network_observer_; | 191 NetworkObserver* network_observer_; |
174 PowerStatusObserver* power_status_observer_; | 192 PowerStatusObserver* power_status_observer_; |
175 UpdateObserver* update_observer_; | 193 UpdateObserver* update_observer_; |
176 UserObserver* user_observer_; | 194 UserObserver* user_observer_; |
177 | 195 |
178 // The widget hosting the tray. | 196 // The widget hosting the tray. |
179 views::Widget* widget_; | 197 views::Widget* widget_; |
180 | 198 |
181 // The popup widget and the delegate. | 199 // Bubble for default and detailed views. |
182 scoped_ptr<internal::SystemTrayBubble> bubble_; | 200 scoped_ptr<internal::SystemTrayBubble> bubble_; |
183 | 201 |
| 202 // Buble for notifications. |
| 203 scoped_ptr<internal::SystemTrayBubble> notification_bubble_; |
| 204 |
184 // Owned by the view it's installed on. | 205 // Owned by the view it's installed on. |
185 internal::SystemTrayBackground* background_; | 206 internal::SystemTrayBackground* background_; |
186 | 207 |
187 // See description agove getter. | 208 // See description agove getter. |
188 bool should_show_launcher_; | 209 bool should_show_launcher_; |
189 | 210 |
190 internal::BackgroundAnimator hide_background_animator_; | 211 internal::BackgroundAnimator hide_background_animator_; |
191 internal::BackgroundAnimator hover_background_animator_; | 212 internal::BackgroundAnimator hover_background_animator_; |
| 213 scoped_ptr<internal::SystemTrayLayerAnimationObserver> |
| 214 layer_animation_observer_; |
192 | 215 |
193 DISALLOW_COPY_AND_ASSIGN(SystemTray); | 216 DISALLOW_COPY_AND_ASSIGN(SystemTray); |
194 }; | 217 }; |
195 | 218 |
196 } // namespace ash | 219 } // namespace ash |
197 | 220 |
198 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ | 221 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ |
OLD | NEW |