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 // NOTE: These values are used for UMA metrics so do NOT re-order this enum |
| 27 // and only insert items before the COUNT item. |
| 28 enum UmaType { |
| 29 // SystemTrayItem's with this type are not recorded in the histogram. |
| 30 UMA_NOT_RECORDED = 0, |
| 31 // Used for testing purposes only. |
| 32 UMA_TEST = 1, |
| 33 UMA_ACCESSIBILITY = 2, |
| 34 UMA_AUDIO = 3, |
| 35 UMA_BLUETOOTH = 4, |
| 36 UMA_CAPS_LOCK = 5, |
| 37 UMA_CAST = 6, |
| 38 UMA_DATE = 7, |
| 39 UMA_DISPLAY = 8, |
| 40 UMA_DISPLAY_BRIGHTNESS = 9, |
| 41 UMA_ENTERPRISE = 10, |
| 42 UMA_IME = 11, |
| 43 UMA_MULTI_PROFILE_MEDIA = 12, |
| 44 UMA_NETWORK = 13, |
| 45 UMA_SETTINGS = 14, |
| 46 UMA_UPDATE = 15, |
| 47 UMA_POWER = 16, |
| 48 UMA_ROTATION_LOCK = 17, |
| 49 UMA_SCREEN_CAPTURE = 18, |
| 50 UMA_SCREEN_SHARE = 19, |
| 51 UMA_SESSION_LENGTH_LIMIT = 20, |
| 52 UMA_SMS = 21, |
| 53 UMA_SUPERVISED_USER = 22, |
| 54 UMA_TRACING = 23, |
| 55 UMA_USER = 24, |
| 56 UMA_VPN = 25, |
| 57 UMA_COUNT = 26, |
| 58 }; |
| 59 |
| 60 SystemTrayItem(SystemTray* system_tray, UmaType type); |
24 virtual ~SystemTrayItem(); | 61 virtual ~SystemTrayItem(); |
25 | 62 |
26 // Create* functions may return NULL if nothing should be displayed for the | 63 // Create* functions may return NULL if nothing should be displayed for the |
27 // type of view. The default implementations return NULL. | 64 // type of view. The default implementations return NULL. |
28 | 65 |
29 // Returns a view to be displayed in the system tray. If this returns NULL, | 66 // Returns a view to be displayed in the system tray. If this returns NULL, |
30 // then this item is not displayed in the tray. | 67 // then this item is not displayed in the tray. |
31 // NOTE: The returned view should almost always be a TrayItemView, which | 68 // NOTE: The returned view should almost always be a TrayItemView, which |
32 // automatically resizes the widget when the size of the view changes, and | 69 // 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 | 70 // 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. | 137 // the shelf is in the auto-hide state. Default is true. |
101 virtual bool ShouldShowShelf() const; | 138 virtual bool ShouldShowShelf() const; |
102 | 139 |
103 // Returns the system tray that this item belongs to. | 140 // Returns the system tray that this item belongs to. |
104 SystemTray* system_tray() const { return system_tray_; } | 141 SystemTray* system_tray() const { return system_tray_; } |
105 | 142 |
106 bool restore_focus() const { return restore_focus_; } | 143 bool restore_focus() const { return restore_focus_; } |
107 void set_restore_focus(bool restore_focus) { restore_focus_ = restore_focus; } | 144 void set_restore_focus(bool restore_focus) { restore_focus_ = restore_focus; } |
108 | 145 |
109 private: | 146 private: |
| 147 // Accesses uma_type(). |
| 148 friend class SystemTrayBubble; |
| 149 |
| 150 UmaType uma_type() const { return uma_type_; } |
| 151 |
110 SystemTray* system_tray_; | 152 SystemTray* system_tray_; |
| 153 UmaType uma_type_; |
111 bool restore_focus_; | 154 bool restore_focus_; |
112 | 155 |
113 DISALLOW_COPY_AND_ASSIGN(SystemTrayItem); | 156 DISALLOW_COPY_AND_ASSIGN(SystemTrayItem); |
114 }; | 157 }; |
115 | 158 |
116 } // namespace ash | 159 } // namespace ash |
117 | 160 |
118 #endif // ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_ITEM_H_ | 161 #endif // ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_ITEM_H_ |
OLD | NEW |