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_SYSTEM_TRAY_SYSTEM_TRAY_ITEM_H_ | 5 #ifndef ASH_SYSTEM_TRAY_SYSTEM_TRAY_ITEM_H_ |
6 #define ASH_SYSTEM_TRAY_SYSTEM_TRAY_ITEM_H_ | 6 #define ASH_SYSTEM_TRAY_SYSTEM_TRAY_ITEM_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/common/shelf/shelf_types.h" | 9 #include "ash/common/shelf/shelf_types.h" |
10 #include "ash/system/user/login_status.h" | 10 #include "ash/system/user/login_status.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 // Create* functions may return NULL if nothing should be displayed for the | 27 // Create* functions may return NULL if nothing should be displayed for the |
28 // type of view. The default implementations return NULL. | 28 // type of view. The default implementations return NULL. |
29 | 29 |
30 // Returns a view to be displayed in the system tray. If this returns NULL, | 30 // Returns a view to be displayed in the system tray. If this returns NULL, |
31 // then this item is not displayed in the tray. | 31 // then this item is not displayed in the tray. |
32 // NOTE: The returned view should almost always be a TrayItemView, which | 32 // NOTE: The returned view should almost always be a TrayItemView, which |
33 // automatically resizes the widget when the size of the view changes, and | 33 // automatically resizes the widget when the size of the view changes, and |
34 // adds animation when the visibility of the view changes. If a view wants to | 34 // adds animation when the visibility of the view changes. If a view wants to |
35 // avoid this behavior, then it should not be a TrayItemView. | 35 // avoid this behavior, then it should not be a TrayItemView. |
36 virtual views::View* CreateTrayView(user::LoginStatus status); | 36 virtual views::View* CreateTrayView(LoginStatus status); |
37 | 37 |
38 // Returns a view for the item to be displayed in the list. This view can be | 38 // Returns a view for the item to be displayed in the list. This view can be |
39 // displayed with a number of other tray items, so this should not be too | 39 // displayed with a number of other tray items, so this should not be too |
40 // big. | 40 // big. |
41 virtual views::View* CreateDefaultView(user::LoginStatus status); | 41 virtual views::View* CreateDefaultView(LoginStatus status); |
42 | 42 |
43 // Returns a detailed view for the item. This view is displayed standalone. | 43 // Returns a detailed view for the item. This view is displayed standalone. |
44 virtual views::View* CreateDetailedView(user::LoginStatus status); | 44 virtual views::View* CreateDetailedView(LoginStatus status); |
45 | 45 |
46 // Returns a notification view for the item. This view is displayed with | 46 // Returns a notification view for the item. This view is displayed with |
47 // other notifications and should be the same size as default views. | 47 // other notifications and should be the same size as default views. |
48 virtual views::View* CreateNotificationView(user::LoginStatus status); | 48 virtual views::View* CreateNotificationView(LoginStatus status); |
49 | 49 |
50 // These functions are called when the corresponding view item is about to be | 50 // These functions are called when the corresponding view item is about to be |
51 // removed. An item should do appropriate cleanup in these functions. | 51 // removed. An item should do appropriate cleanup in these functions. |
52 // The default implementation does nothing. | 52 // The default implementation does nothing. |
53 virtual void DestroyTrayView(); | 53 virtual void DestroyTrayView(); |
54 virtual void DestroyDefaultView(); | 54 virtual void DestroyDefaultView(); |
55 virtual void DestroyDetailedView(); | 55 virtual void DestroyDetailedView(); |
56 virtual void DestroyNotificationView(); | 56 virtual void DestroyNotificationView(); |
57 | 57 |
58 // Updates the tray view (if applicable) when the user's login status changes. | 58 // Updates the tray view (if applicable) when the user's login status changes. |
59 // It is not necessary the update the default or detailed view, since the | 59 // It is not necessary the update the default or detailed view, since the |
60 // default/detailed popup is closed when login status changes. The default | 60 // default/detailed popup is closed when login status changes. The default |
61 // implementation does nothing. | 61 // implementation does nothing. |
62 virtual void UpdateAfterLoginStatusChange(user::LoginStatus status); | 62 virtual void UpdateAfterLoginStatusChange(LoginStatus status); |
63 | 63 |
64 // Updates the tray view (if applicable) when shelf's alignment changes. | 64 // Updates the tray view (if applicable) when shelf's alignment changes. |
65 // The default implementation does nothing. | 65 // The default implementation does nothing. |
66 virtual void UpdateAfterShelfAlignmentChange(ShelfAlignment alignment); | 66 virtual void UpdateAfterShelfAlignmentChange(ShelfAlignment alignment); |
67 | 67 |
68 // Shows the detailed view for this item. If the main popup for the tray is | 68 // Shows the detailed view for this item. If the main popup for the tray is |
69 // currently visible, then making this call would use the existing window to | 69 // currently visible, then making this call would use the existing window to |
70 // display the detailed item. The detailed item will inherit the bounds of the | 70 // display the detailed item. The detailed item will inherit the bounds of the |
71 // existing window. | 71 // existing window. |
72 // If there is no existing view, then this is equivalent to calling | 72 // If there is no existing view, then this is equivalent to calling |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 private: | 112 private: |
113 SystemTray* system_tray_; | 113 SystemTray* system_tray_; |
114 bool restore_focus_; | 114 bool restore_focus_; |
115 | 115 |
116 DISALLOW_COPY_AND_ASSIGN(SystemTrayItem); | 116 DISALLOW_COPY_AND_ASSIGN(SystemTrayItem); |
117 }; | 117 }; |
118 | 118 |
119 } // namespace ash | 119 } // namespace ash |
120 | 120 |
121 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_ITEM_H_ | 121 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_ITEM_H_ |
OLD | NEW |