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_SYSTEM_TRAY_H_ | 5 #ifndef ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_H_ |
6 #define ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_H_ | 6 #define ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "ash/ash_export.h" | 12 #include "ash/ash_export.h" |
13 #include "ash/common/system/tray/system_tray_bubble.h" | 13 #include "ash/common/system/tray/system_tray_bubble.h" |
14 #include "ash/common/system/tray/tray_background_view.h" | 14 #include "ash/common/system/tray/tray_background_view.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/memory/scoped_vector.h" | 16 #include "base/memory/scoped_vector.h" |
17 #include "ui/views/bubble/tray_bubble_view.h" | 17 #include "ui/views/bubble/tray_bubble_view.h" |
18 #include "ui/views/view.h" | 18 #include "ui/views/view.h" |
19 | 19 |
20 namespace ash { | 20 namespace ash { |
21 | 21 |
22 enum class LoginStatus; | 22 enum class LoginStatus; |
23 class ScreenTrayItem; | 23 class ScreenTrayItem; |
24 class SystemBubbleWrapper; | 24 class SystemBubbleWrapper; |
25 class SystemTrayDelegate; | 25 class SystemTrayDelegate; |
26 class SystemTrayItem; | 26 class SystemTrayItem; |
27 class TrayAccessibility; | 27 class TrayAccessibility; |
| 28 class TrayAudio; |
28 class TrayCast; | 29 class TrayCast; |
29 class TrayDate; | 30 class TrayDate; |
30 class TrayUpdate; | 31 class TrayUpdate; |
31 class TrayUser; | 32 class TrayUser; |
32 class WebNotificationTray; | 33 class WebNotificationTray; |
33 | 34 |
34 // There are different methods for creating bubble views. | 35 // There are different methods for creating bubble views. |
35 enum BubbleCreationType { | 36 enum BubbleCreationType { |
36 BUBBLE_CREATE_NEW, // Closes any existing bubble and creates a new one. | 37 BUBBLE_CREATE_NEW, // Closes any existing bubble and creates a new one. |
37 BUBBLE_USE_EXISTING, // Uses any existing bubble, or creates a new one. | 38 BUBBLE_USE_EXISTING, // Uses any existing bubble, or creates a new one. |
(...skipping 29 matching lines...) Expand all Loading... |
67 // non-zero, then the view is automatically closed after the specified time. | 68 // non-zero, then the view is automatically closed after the specified time. |
68 void ShowDetailedView(SystemTrayItem* item, | 69 void ShowDetailedView(SystemTrayItem* item, |
69 int close_delay_in_seconds, | 70 int close_delay_in_seconds, |
70 bool activate, | 71 bool activate, |
71 BubbleCreationType creation_type); | 72 BubbleCreationType creation_type); |
72 | 73 |
73 // Continue showing the existing detailed view, if any, for |close_delay| | 74 // Continue showing the existing detailed view, if any, for |close_delay| |
74 // seconds. | 75 // seconds. |
75 void SetDetailedViewCloseDelay(int close_delay); | 76 void SetDetailedViewCloseDelay(int close_delay); |
76 | 77 |
77 // Hides the detailed view for |item|. | 78 // Hides the detailed view for |item|. If |animate| is false, disable |
78 void HideDetailedView(SystemTrayItem* item); | 79 // the hiding animation for hiding |item|. |
| 80 void HideDetailedView(SystemTrayItem* item, bool animate); |
79 | 81 |
80 // Shows the notification view for |item|. | 82 // Shows the notification view for |item|. |
81 void ShowNotificationView(SystemTrayItem* item); | 83 void ShowNotificationView(SystemTrayItem* item); |
82 | 84 |
83 // Hides the notification view for |item|. | 85 // Hides the notification view for |item|. |
84 void HideNotificationView(SystemTrayItem* item); | 86 void HideNotificationView(SystemTrayItem* item); |
85 | 87 |
86 // Updates the items when the login status of the system changes. | 88 // Updates the items when the login status of the system changes. |
87 void UpdateAfterLoginStatusChange(LoginStatus login_status); | 89 void UpdateAfterLoginStatusChange(LoginStatus login_status); |
88 | 90 |
(...skipping 25 matching lines...) Expand all Loading... |
114 // Returns true if the mouse is inside the notification bubble. | 116 // Returns true if the mouse is inside the notification bubble. |
115 bool IsMouseInNotificationBubble() const; | 117 bool IsMouseInNotificationBubble() const; |
116 | 118 |
117 // Closes system bubble and returns true if it did exist. | 119 // Closes system bubble and returns true if it did exist. |
118 bool CloseSystemBubble() const; | 120 bool CloseSystemBubble() const; |
119 | 121 |
120 // Returns view for help button if default view is shown. Returns NULL | 122 // Returns view for help button if default view is shown. Returns NULL |
121 // otherwise. | 123 // otherwise. |
122 views::View* GetHelpButtonView() const; | 124 views::View* GetHelpButtonView() const; |
123 | 125 |
| 126 // Returns TrayAudio object if present or null otherwise. |
| 127 TrayAudio* GetTrayAudio() const; |
| 128 |
124 // Accessors for testing. | 129 // Accessors for testing. |
125 | 130 |
126 // Returns true if the bubble exists. | 131 // Returns true if the bubble exists. |
127 bool CloseNotificationBubbleForTest() const; | 132 bool CloseNotificationBubbleForTest() const; |
128 | 133 |
129 // Overridden from TrayBackgroundView. | 134 // Overridden from TrayBackgroundView. |
130 void SetShelfAlignment(ShelfAlignment alignment) override; | 135 void SetShelfAlignment(ShelfAlignment alignment) override; |
131 void AnchorUpdated() override; | 136 void AnchorUpdated() override; |
132 base::string16 GetAccessibleNameForTray() override; | 137 base::string16 GetAccessibleNameForTray() override; |
133 void BubbleResized(const views::TrayBubbleView* bubble_view) override; | 138 void BubbleResized(const views::TrayBubbleView* bubble_view) override; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 | 245 |
241 // Set to true when system notifications should be hidden (e.g. web | 246 // Set to true when system notifications should be hidden (e.g. web |
242 // notification bubble is visible). | 247 // notification bubble is visible). |
243 bool hide_notifications_; | 248 bool hide_notifications_; |
244 | 249 |
245 // This is true when the displayed system tray menu is a full tray menu, | 250 // This is true when the displayed system tray menu is a full tray menu, |
246 // otherwise a single line item menu like the volume slider is shown. | 251 // otherwise a single line item menu like the volume slider is shown. |
247 // Note that the value is only valid when |system_bubble_| is true. | 252 // Note that the value is only valid when |system_bubble_| is true. |
248 bool full_system_tray_menu_; | 253 bool full_system_tray_menu_; |
249 | 254 |
250 TrayAccessibility* tray_accessibility_; // not owned | 255 // These objects are not owned by this class. |
| 256 TrayAccessibility* tray_accessibility_; |
| 257 TrayAudio* tray_audio_; // May be null. |
251 TrayCast* tray_cast_; | 258 TrayCast* tray_cast_; |
252 TrayDate* tray_date_; | 259 TrayDate* tray_date_; |
253 TrayUpdate* tray_update_; | 260 TrayUpdate* tray_update_; |
254 | 261 |
255 // A reference to the Screen share and capture item. | 262 // A reference to the Screen share and capture item. |
256 ScreenTrayItem* screen_capture_tray_item_; // not owned | 263 ScreenTrayItem* screen_capture_tray_item_; // not owned |
257 ScreenTrayItem* screen_share_tray_item_; // not owned | 264 ScreenTrayItem* screen_share_tray_item_; // not owned |
258 | 265 |
259 DISALLOW_COPY_AND_ASSIGN(SystemTray); | 266 DISALLOW_COPY_AND_ASSIGN(SystemTray); |
260 }; | 267 }; |
261 | 268 |
262 } // namespace ash | 269 } // namespace ash |
263 | 270 |
264 #endif // ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_H_ | 271 #endif // ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_H_ |
OLD | NEW |