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> |
| 9 |
8 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
9 #include "ash/common/login_status.h" | 11 #include "ash/common/login_status.h" |
10 #include "ash/public/cpp/shelf_types.h" | 12 #include "ash/public/cpp/shelf_types.h" |
11 #include "base/macros.h" | 13 #include "base/macros.h" |
12 | 14 |
| 15 namespace base { |
| 16 class OneShotTimer; |
| 17 } // namespace base |
| 18 |
13 namespace views { | 19 namespace views { |
14 class View; | 20 class View; |
15 } | 21 } |
16 | 22 |
17 namespace ash { | 23 namespace ash { |
18 class SystemTray; | 24 class SystemTray; |
19 class SystemTrayBubble; | 25 class SystemTrayBubble; |
20 class TrayItemView; | 26 class TrayItemView; |
21 | 27 |
22 class ASH_EXPORT SystemTrayItem { | 28 class ASH_EXPORT SystemTrayItem { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 virtual void UpdateAfterLoginStatusChange(LoginStatus status); | 104 virtual void UpdateAfterLoginStatusChange(LoginStatus status); |
99 | 105 |
100 // Updates the tray view (if applicable) when shelf's alignment changes. | 106 // Updates the tray view (if applicable) when shelf's alignment changes. |
101 // The default implementation does nothing. | 107 // The default implementation does nothing. |
102 virtual void UpdateAfterShelfAlignmentChange(ShelfAlignment alignment); | 108 virtual void UpdateAfterShelfAlignmentChange(ShelfAlignment alignment); |
103 | 109 |
104 // Shows the detailed view for this item. If the main popup for the tray is | 110 // Shows the detailed view for this item. If the main popup for the tray is |
105 // currently visible, then making this call would use the existing window to | 111 // currently visible, then making this call would use the existing window to |
106 // display the detailed item. The detailed item will inherit the bounds of the | 112 // display the detailed item. The detailed item will inherit the bounds of the |
107 // existing window. | 113 // existing window. |
108 // If there is no existing view, then this is equivalent to calling | 114 // |
109 // PopupDetailedView(0, true). | 115 // In Material Design the actual transition is intentionally delayed to allow |
| 116 // the user to perceive the ink drop animation on the clicked target. |
110 void TransitionDetailedView(); | 117 void TransitionDetailedView(); |
111 | 118 |
112 // Pops up the detailed view for this item. An item can request to show its | 119 // Pops up the detailed view for this item. An item can request to show its |
113 // detailed view using this function (e.g. from an observer callback when | 120 // detailed view using this function (e.g. from an observer callback when |
114 // something, e.g. volume, network availability etc. changes). If | 121 // something, e.g. volume, network availability etc. changes). If |
115 // |for_seconds| is non-zero, then the popup is closed after the specified | 122 // |for_seconds| is non-zero, then the popup is closed after the specified |
116 // time. | 123 // time. |
117 void PopupDetailedView(int for_seconds, bool activate); | 124 void PopupDetailedView(int for_seconds, bool activate); |
118 | 125 |
119 // Continue showing the currently-shown detailed view, if any, for | 126 // Continue showing the currently-shown detailed view, if any, for |
(...skipping 15 matching lines...) Expand all Loading... |
135 // the shelf is in the auto-hide state. Default is true. | 142 // the shelf is in the auto-hide state. Default is true. |
136 virtual bool ShouldShowShelf() const; | 143 virtual bool ShouldShowShelf() const; |
137 | 144 |
138 // Returns the system tray that this item belongs to. | 145 // Returns the system tray that this item belongs to. |
139 SystemTray* system_tray() const { return system_tray_; } | 146 SystemTray* system_tray() const { return system_tray_; } |
140 | 147 |
141 bool restore_focus() const { return restore_focus_; } | 148 bool restore_focus() const { return restore_focus_; } |
142 void set_restore_focus(bool restore_focus) { restore_focus_ = restore_focus; } | 149 void set_restore_focus(bool restore_focus) { restore_focus_ = restore_focus; } |
143 | 150 |
144 private: | 151 private: |
| 152 // Actually transitions to the detailed view. |
| 153 void DoTransitionToDetailedView(); |
| 154 |
145 // Accesses uma_type(). | 155 // Accesses uma_type(). |
146 friend class SystemTrayBubble; | 156 friend class SystemTrayBubble; |
147 | 157 |
148 UmaType uma_type() const { return uma_type_; } | 158 UmaType uma_type() const { return uma_type_; } |
149 | 159 |
150 SystemTray* system_tray_; | 160 SystemTray* system_tray_; |
151 UmaType uma_type_; | 161 UmaType uma_type_; |
152 bool restore_focus_; | 162 bool restore_focus_; |
153 | 163 |
| 164 // Used to delay the transition to the detailed view. |
| 165 std::unique_ptr<base::OneShotTimer> transition_delay_timer_; |
| 166 |
154 DISALLOW_COPY_AND_ASSIGN(SystemTrayItem); | 167 DISALLOW_COPY_AND_ASSIGN(SystemTrayItem); |
155 }; | 168 }; |
156 | 169 |
157 } // namespace ash | 170 } // namespace ash |
158 | 171 |
159 #endif // ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_ITEM_H_ | 172 #endif // ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_ITEM_H_ |
OLD | NEW |