Chromium Code Reviews| 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 TrayItemView; | 19 class TrayItemView; |
| 20 | 20 |
| 21 class ASH_EXPORT SystemTrayItem { | 21 class ASH_EXPORT SystemTrayItem { |
| 22 public: | 22 public: |
| 23 explicit SystemTrayItem(SystemTray* system_tray); | 23 // The different types of SystemTrayItems. |
| 24 // | |
| 25 // *** IMPORTANT *** - These values are used for UMA metrics so do NOT | |
| 26 // re-order | |
| 27 // this enum and only insert items before the COUNT item. | |
|
tdanderson
2016/07/19 21:58:40
nit: awkward line break.
bruthig
2016/07/20 18:15:52
Done.
| |
| 28 enum ItemType { | |
| 29 ACCESSIBILITY, // 0 | |
|
tdanderson
2016/07/19 21:58:40
Consider making UNKNOWN/NONE the 0-element, and us
bruthig
2016/07/20 18:15:52
Added TEST at 0.
| |
| 30 AUDIO, // 1 | |
| 31 BLUETOOTH, // 2 | |
| 32 CAPS_LOCK, // 3 | |
| 33 CAST, // 4 | |
| 34 DATE_POWER_LOCK, // 5 | |
| 35 DISPLAY, // 6 | |
| 36 DISPLAY_BRIGHTNESS, // 7 | |
| 37 ENTERPRISE, // 8 | |
| 38 IME, // 9 | |
| 39 MULTI_PROFILE_MEDIA, // 10 | |
| 40 NETWORK, // 11 | |
| 41 OS_SETTINGS, // 12 | |
| 42 OS_UPDATE, // 13 | |
| 43 POWER, // 14 | |
| 44 ROTATION_LOCK, // 15 | |
| 45 SCREEN_CAPTURE, // 16 | |
| 46 SCREEN_SHARE, // 17 | |
| 47 SESSION_LENGTH_LIMIT, // 18 | |
| 48 SMS, // 19 | |
| 49 SUPERVISED_USER, // 20 | |
| 50 TRACING, // 21 | |
| 51 USER, // 22 | |
| 52 USER_SEPARATOR, // 23 | |
| 53 VPN, // 24 | |
| 54 COUNT // 25 | |
| 55 }; | |
| 56 | |
| 57 SystemTrayItem(SystemTray* system_tray, ItemType type); | |
| 24 virtual ~SystemTrayItem(); | 58 virtual ~SystemTrayItem(); |
| 25 | 59 |
| 60 ItemType type() const { return item_type_; } | |
|
tdanderson
2016/07/19 21:58:40
I'm a bit concerned that having a public type() in
bruthig
2016/07/20 18:15:52
Renamed ItemType as UmaType, moved uma_type() to p
| |
| 61 | |
| 26 // Create* functions may return NULL if nothing should be displayed for the | 62 // Create* functions may return NULL if nothing should be displayed for the |
| 27 // type of view. The default implementations return NULL. | 63 // type of view. The default implementations return NULL. |
| 28 | 64 |
| 29 // Returns a view to be displayed in the system tray. If this returns NULL, | 65 // Returns a view to be displayed in the system tray. If this returns NULL, |
| 30 // then this item is not displayed in the tray. | 66 // then this item is not displayed in the tray. |
| 31 // NOTE: The returned view should almost always be a TrayItemView, which | 67 // NOTE: The returned view should almost always be a TrayItemView, which |
| 32 // automatically resizes the widget when the size of the view changes, and | 68 // 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 | 69 // adds animation when the visibility of the view changes. If a view wants to |
| 34 // avoid this behavior, then it should not be a TrayItemView. | 70 // avoid this behavior, then it should not be a TrayItemView. |
| 35 virtual views::View* CreateTrayView(LoginStatus status); | 71 virtual views::View* CreateTrayView(LoginStatus status); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 101 virtual bool ShouldShowShelf() const; | 137 virtual bool ShouldShowShelf() const; |
| 102 | 138 |
| 103 // Returns the system tray that this item belongs to. | 139 // Returns the system tray that this item belongs to. |
| 104 SystemTray* system_tray() const { return system_tray_; } | 140 SystemTray* system_tray() const { return system_tray_; } |
| 105 | 141 |
| 106 bool restore_focus() const { return restore_focus_; } | 142 bool restore_focus() const { return restore_focus_; } |
| 107 void set_restore_focus(bool restore_focus) { restore_focus_ = restore_focus; } | 143 void set_restore_focus(bool restore_focus) { restore_focus_ = restore_focus; } |
| 108 | 144 |
| 109 private: | 145 private: |
| 110 SystemTray* system_tray_; | 146 SystemTray* system_tray_; |
| 147 ItemType item_type_; | |
| 111 bool restore_focus_; | 148 bool restore_focus_; |
| 112 | 149 |
| 113 DISALLOW_COPY_AND_ASSIGN(SystemTrayItem); | 150 DISALLOW_COPY_AND_ASSIGN(SystemTrayItem); |
| 114 }; | 151 }; |
| 115 | 152 |
| 116 } // namespace ash | 153 } // namespace ash |
| 117 | 154 |
| 118 #endif // ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_ITEM_H_ | 155 #endif // ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_ITEM_H_ |
| OLD | NEW |