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 23 matching lines...) Expand all Loading... |
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 class SystemTrayLayerAnimationObserver; |
42 } | 42 } |
43 | 43 |
| 44 // There are different methods for creating bubble views. |
| 45 enum BubbleCreationType { |
| 46 BUBBLE_CREATE_NEW, // Closes any existing bubble and creates a new one. |
| 47 BUBBLE_USE_EXISTING, // Uses any existing bubble, or creates a new one. |
| 48 }; |
| 49 |
44 class ASH_EXPORT SystemTray : public internal::ActionableView, | 50 class ASH_EXPORT SystemTray : public internal::ActionableView, |
45 public internal::BackgroundAnimatorDelegate { | 51 public internal::BackgroundAnimatorDelegate { |
46 public: | 52 public: |
47 SystemTray(); | 53 SystemTray(); |
48 virtual ~SystemTray(); | 54 virtual ~SystemTray(); |
49 | 55 |
50 // Creates the default set of items for the sytem tray. | 56 // Creates the default set of items for the sytem tray. |
51 void CreateItems(); | 57 void CreateItems(); |
52 | 58 |
53 // Creates the widget for the tray. | 59 // Creates the widget for the tray. |
54 void CreateWidget(); | 60 void CreateWidget(); |
55 | 61 |
56 // Adds a new item in the tray. | 62 // Adds a new item in the tray. |
57 void AddTrayItem(SystemTrayItem* item); | 63 void AddTrayItem(SystemTrayItem* item); |
58 | 64 |
59 // Removes an existing tray item. | 65 // Removes an existing tray item. |
60 void RemoveTrayItem(SystemTrayItem* item); | 66 void RemoveTrayItem(SystemTrayItem* item); |
61 | 67 |
62 // Shows the default view of all items. | 68 // Shows the default view of all items. |
63 void ShowDefaultView(); | 69 void ShowDefaultView(BubbleCreationType creation_type); |
64 | 70 |
65 // Shows details of a particular item. If |close_delay_in_seconds| is | 71 // Shows details of a particular item. If |close_delay_in_seconds| is |
66 // non-zero, then the view is automatically closed after the specified time. | 72 // non-zero, then the view is automatically closed after the specified time. |
67 void ShowDetailedView(SystemTrayItem* item, | 73 void ShowDetailedView(SystemTrayItem* item, |
68 int close_delay_in_seconds, | 74 int close_delay_in_seconds, |
69 bool activate); | 75 bool activate, |
| 76 BubbleCreationType creation_type); |
70 | 77 |
71 // Continue showing the existing detailed view, if any, for |close_delay| | 78 // Continue showing the existing detailed view, if any, for |close_delay| |
72 // seconds. | 79 // seconds. |
73 void SetDetailedViewCloseDelay(int close_delay); | 80 void SetDetailedViewCloseDelay(int close_delay); |
74 | 81 |
75 // Shows the notification view for |item|. | 82 // Shows the notification view for |item|. |
76 void ShowNotificationView(SystemTrayItem* item); | 83 void ShowNotificationView(SystemTrayItem* item); |
77 | 84 |
78 // Hides the notification view for |item|. | 85 // Hides the notification view for |item|. |
79 void HideNotificationView(SystemTrayItem* item); | 86 void HideNotificationView(SystemTrayItem* item); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // Called when the widget associated with |bubble| closes. |bubble| should | 150 // Called when the widget associated with |bubble| closes. |bubble| should |
144 // always == |bubble_|. This triggers destroying |bubble_| and hiding the | 151 // always == |bubble_|. This triggers destroying |bubble_| and hiding the |
145 // launcher if necessary. | 152 // launcher if necessary. |
146 void RemoveBubble(internal::SystemTrayBubble* bubble); | 153 void RemoveBubble(internal::SystemTrayBubble* bubble); |
147 | 154 |
148 const ScopedVector<SystemTrayItem>& items() const { return items_; } | 155 const ScopedVector<SystemTrayItem>& items() const { return items_; } |
149 | 156 |
150 // Constructs or re-constructs |bubble_| and populates it with |items|. | 157 // Constructs or re-constructs |bubble_| and populates it with |items|. |
151 void ShowItems(const std::vector<SystemTrayItem*>& items, | 158 void ShowItems(const std::vector<SystemTrayItem*>& items, |
152 bool details, | 159 bool details, |
153 bool activate); | 160 bool activate, |
| 161 BubbleCreationType creation_type); |
154 | 162 |
155 // Constructs or re-constructs |notification_bubble_| and populates it with | 163 // Constructs or re-constructs |notification_bubble_| and populates it with |
156 // |notification_items_|, or destroys it if there are no notification items. | 164 // |notification_items_|, or destroys it if there are no notification items. |
157 void UpdateNotificationBubble(); | 165 void UpdateNotificationBubble(); |
158 | 166 |
159 // Called when the anchor (tray or bubble) may have moved or changed. | 167 // Called when the anchor (tray or bubble) may have moved or changed. |
160 void UpdateNotificationAnchor(); | 168 void UpdateNotificationAnchor(); |
161 | 169 |
162 // Overridden from internal::ActionableView. | 170 // Overridden from internal::ActionableView. |
163 virtual bool PerformAction(const views::Event& event) OVERRIDE; | 171 virtual bool PerformAction(const views::Event& event) OVERRIDE; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 internal::BackgroundAnimator hover_background_animator_; | 220 internal::BackgroundAnimator hover_background_animator_; |
213 scoped_ptr<internal::SystemTrayLayerAnimationObserver> | 221 scoped_ptr<internal::SystemTrayLayerAnimationObserver> |
214 layer_animation_observer_; | 222 layer_animation_observer_; |
215 | 223 |
216 DISALLOW_COPY_AND_ASSIGN(SystemTray); | 224 DISALLOW_COPY_AND_ASSIGN(SystemTray); |
217 }; | 225 }; |
218 | 226 |
219 } // namespace ash | 227 } // namespace ash |
220 | 228 |
221 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ | 229 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ |
OLD | NEW |