| 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 <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| 11 #include "ash/common/login_status.h" | 11 #include "ash/common/login_status.h" |
| 12 #include "ash/public/cpp/shelf_types.h" | 12 #include "ash/public/cpp/shelf_types.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 | 14 |
| 15 namespace base { | 15 namespace base { |
| 16 class OneShotTimer; | 16 class OneShotTimer; |
| 17 } // namespace base | 17 } // namespace base |
| 18 | 18 |
| 19 namespace views { | 19 namespace views { |
| 20 class View; | 20 class View; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace ash { | 23 namespace ash { |
| 24 class SystemTray; | 24 class SystemTray; |
| 25 class SystemTrayBubble; | 25 class SystemTrayBubble; |
| 26 class TrayItemView; | 26 class TrayItemView; |
| 27 | 27 |
| 28 // Controller for an item in the system tray. Each item can create these views: | |
| 29 // Tray view - The icon in the status area in the shelf. | |
| 30 // Default view - The row in the top-level menu. | |
| 31 // Detailed view - The submenu shown when the top-level menu row is clicked. | |
| 32 class ASH_EXPORT SystemTrayItem { | 28 class ASH_EXPORT SystemTrayItem { |
| 33 public: | 29 public: |
| 34 // The different types of SystemTrayItems. | 30 // The different types of SystemTrayItems. |
| 35 // | 31 // |
| 36 // NOTE: These values are used for UMA metrics so do NOT re-order this enum | 32 // NOTE: These values are used for UMA metrics so do NOT re-order this enum |
| 37 // and only insert items before the COUNT item. | 33 // and only insert items before the COUNT item. |
| 38 enum UmaType { | 34 enum UmaType { |
| 39 // SystemTrayItem's with this type are not recorded in the histogram. | 35 // SystemTrayItem's with this type are not recorded in the histogram. |
| 40 UMA_NOT_RECORDED = 0, | 36 UMA_NOT_RECORDED = 0, |
| 41 // Used for testing purposes only. | 37 // Used for testing purposes only. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 // Returns a view for the item to be displayed in the list. This view can be | 80 // Returns a view for the item to be displayed in the list. This view can be |
| 85 // displayed with a number of other tray items, so this should not be too | 81 // displayed with a number of other tray items, so this should not be too |
| 86 // big. | 82 // big. |
| 87 virtual views::View* CreateDefaultView(LoginStatus status); | 83 virtual views::View* CreateDefaultView(LoginStatus status); |
| 88 | 84 |
| 89 // Returns a detailed view for the item. This view is displayed standalone. | 85 // Returns a detailed view for the item. This view is displayed standalone. |
| 90 virtual views::View* CreateDetailedView(LoginStatus status); | 86 virtual views::View* CreateDetailedView(LoginStatus status); |
| 91 | 87 |
| 92 // Returns a notification view for the item. This view is displayed with | 88 // Returns a notification view for the item. This view is displayed with |
| 93 // other notifications and should be the same size as default views. | 89 // other notifications and should be the same size as default views. |
| 94 // DEPRECATED. Use the message center instead. | |
| 95 virtual views::View* CreateNotificationView(LoginStatus status); | 90 virtual views::View* CreateNotificationView(LoginStatus status); |
| 96 | 91 |
| 97 // These functions are called when the corresponding view item is about to be | 92 // These functions are called when the corresponding view item is about to be |
| 98 // removed. An item should do appropriate cleanup in these functions. | 93 // removed. An item should do appropriate cleanup in these functions. |
| 99 // The default implementation does nothing. | 94 // The default implementation does nothing. |
| 100 virtual void DestroyTrayView(); | 95 virtual void DestroyTrayView(); |
| 101 virtual void DestroyDefaultView(); | 96 virtual void DestroyDefaultView(); |
| 102 virtual void DestroyDetailedView(); | 97 virtual void DestroyDetailedView(); |
| 103 virtual void DestroyNotificationView(); | 98 virtual void DestroyNotificationView(); |
| 104 | 99 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 | 163 |
| 169 // Used to delay the transition to the detailed view. | 164 // Used to delay the transition to the detailed view. |
| 170 std::unique_ptr<base::OneShotTimer> transition_delay_timer_; | 165 std::unique_ptr<base::OneShotTimer> transition_delay_timer_; |
| 171 | 166 |
| 172 DISALLOW_COPY_AND_ASSIGN(SystemTrayItem); | 167 DISALLOW_COPY_AND_ASSIGN(SystemTrayItem); |
| 173 }; | 168 }; |
| 174 | 169 |
| 175 } // namespace ash | 170 } // namespace ash |
| 176 | 171 |
| 177 #endif // ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_ITEM_H_ | 172 #endif // ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_ITEM_H_ |
| OLD | NEW |