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_ITEM_H_ | 5 #ifndef ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_ITEM_H_ |
6 #define ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_ITEM_H_ | 6 #define ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_ITEM_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/common/login_status.h" | 9 #include "ash/common/login_status.h" |
10 #include "ash/common/shelf/shelf_types.h" | 10 #include "ash/common/shelf/shelf_types.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 | 12 |
13 namespace views { | 13 namespace views { |
14 class View; | 14 class View; |
15 } | 15 } |
16 | 16 |
17 namespace ash { | 17 namespace ash { |
18 class SystemTray; | 18 class SystemTray; |
19 class SystemTrayBubble; | |
19 class TrayItemView; | 20 class TrayItemView; |
20 | 21 |
21 class ASH_EXPORT SystemTrayItem { | 22 class ASH_EXPORT SystemTrayItem { |
22 public: | 23 public: |
23 explicit SystemTrayItem(SystemTray* system_tray); | 24 // The different types of SystemTrayItems. |
25 // | |
26 // *** IMPORTANT *** - These values are used for UMA metrics so do NOT | |
James Cook
2016/07/20 20:13:49
nit: This probably doesn't need to be "**** IMPORT
bruthig
2016/07/21 14:34:58
Done.
| |
27 // re-order this enum and only insert items before the COUNT item. | |
28 enum UmaType { | |
29 TEST, // 0 - Used for test only. | |
James Cook
2016/07/20 20:13:49
I would either give these all a prefix (like UMA_T
bruthig
2016/07/21 14:34:58
Done.
| |
30 ACCESSIBILITY, // 1 | |
James Cook
2016/07/20 20:13:49
nit: Don't explicitly number the enum in comments.
bruthig
2016/07/21 14:34:58
Done.
| |
31 AUDIO, // 2 | |
32 BLUETOOTH, // 3 | |
33 CAPS_LOCK, // 4 | |
34 CAST, // 5 | |
35 DATE, // 6 | |
36 DISPLAY, // 7 | |
37 DISPLAY_BRIGHTNESS, // 8 | |
38 ENTERPRISE, // 9 | |
39 IME, // 10 | |
40 MULTI_PROFILE_MEDIA, // 11 | |
41 NETWORK, // 12 | |
42 SETTINGS, // 13 | |
43 UPDATE, // 14 | |
44 POWER, // 15 | |
45 ROTATION_LOCK, // 16 | |
46 SCREEN_CAPTURE, // 17 | |
47 SCREEN_SHARE, // 18 | |
48 SESSION_LENGTH_LIMIT, // 19 | |
49 SMS, // 20 | |
50 SUPERVISED_USER, // 21 | |
51 TRACING, // 22 | |
52 USER, // 23 | |
53 USER_SEPARATOR, // 24 | |
54 VPN, // 25 | |
55 COUNT // 26 | |
56 }; | |
57 | |
58 SystemTrayItem(SystemTray* system_tray, UmaType type); | |
24 virtual ~SystemTrayItem(); | 59 virtual ~SystemTrayItem(); |
25 | 60 |
26 // Create* functions may return NULL if nothing should be displayed for the | 61 // Create* functions may return NULL if nothing should be displayed for the |
27 // type of view. The default implementations return NULL. | 62 // type of view. The default implementations return NULL. |
28 | 63 |
29 // Returns a view to be displayed in the system tray. If this returns NULL, | 64 // Returns a view to be displayed in the system tray. If this returns NULL, |
30 // then this item is not displayed in the tray. | 65 // then this item is not displayed in the tray. |
31 // NOTE: The returned view should almost always be a TrayItemView, which | 66 // NOTE: The returned view should almost always be a TrayItemView, which |
32 // automatically resizes the widget when the size of the view changes, and | 67 // automatically resizes the widget when the size of the view changes, and |
33 // adds animation when the visibility of the view changes. If a view wants to | 68 // adds animation when the visibility of the view changes. If a view wants to |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
100 // the shelf is in the auto-hide state. Default is true. | 135 // the shelf is in the auto-hide state. Default is true. |
101 virtual bool ShouldShowShelf() const; | 136 virtual bool ShouldShowShelf() const; |
102 | 137 |
103 // Returns the system tray that this item belongs to. | 138 // Returns the system tray that this item belongs to. |
104 SystemTray* system_tray() const { return system_tray_; } | 139 SystemTray* system_tray() const { return system_tray_; } |
105 | 140 |
106 bool restore_focus() const { return restore_focus_; } | 141 bool restore_focus() const { return restore_focus_; } |
107 void set_restore_focus(bool restore_focus) { restore_focus_ = restore_focus; } | 142 void set_restore_focus(bool restore_focus) { restore_focus_ = restore_focus; } |
108 | 143 |
109 private: | 144 private: |
145 // Accesses uma_type(). | |
146 friend class SystemTrayBubble; | |
147 | |
148 UmaType uma_type() const { return uma_type_; } | |
James Cook
2016/07/20 20:13:49
nit: If this is only used in test, eliminate and d
bruthig
2016/07/21 14:34:58
This is used by the SystemTrayBubble class in prod
| |
149 | |
110 SystemTray* system_tray_; | 150 SystemTray* system_tray_; |
151 UmaType uma_type_; | |
111 bool restore_focus_; | 152 bool restore_focus_; |
112 | 153 |
113 DISALLOW_COPY_AND_ASSIGN(SystemTrayItem); | 154 DISALLOW_COPY_AND_ASSIGN(SystemTrayItem); |
114 }; | 155 }; |
115 | 156 |
116 } // namespace ash | 157 } // namespace ash |
117 | 158 |
118 #endif // ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_ITEM_H_ | 159 #endif // ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_ITEM_H_ |
OLD | NEW |