Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(687)

Side by Side Diff: ash/common/system/tray/system_tray.h

Issue 2583393002: Send notification to users upon receiving sms messages (Closed)
Patch Set: address comments Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_H_ 5 #ifndef ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_H_
6 #define ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_H_ 6 #define ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 BubbleCreationType creation_type); 76 BubbleCreationType creation_type);
77 77
78 // Continue showing the existing detailed view, if any, for |close_delay| 78 // Continue showing the existing detailed view, if any, for |close_delay|
79 // seconds. 79 // seconds.
80 void SetDetailedViewCloseDelay(int close_delay); 80 void SetDetailedViewCloseDelay(int close_delay);
81 81
82 // Hides the detailed view for |item|. If |animate| is false, disable 82 // Hides the detailed view for |item|. If |animate| is false, disable
83 // the hiding animation for hiding |item|. 83 // the hiding animation for hiding |item|.
84 void HideDetailedView(SystemTrayItem* item, bool animate); 84 void HideDetailedView(SystemTrayItem* item, bool animate);
85 85
86 // Shows the notification view for |item|.
87 void ShowNotificationView(SystemTrayItem* item);
88
89 // Hides the notification view for |item|.
90 void HideNotificationView(SystemTrayItem* item);
91
92 // Updates the items when the login status of the system changes. 86 // Updates the items when the login status of the system changes.
93 void UpdateAfterLoginStatusChange(LoginStatus login_status); 87 void UpdateAfterLoginStatusChange(LoginStatus login_status);
94 88
95 // Updates the items when the shelf alignment changes. 89 // Updates the items when the shelf alignment changes.
96 void UpdateAfterShelfAlignmentChange(ShelfAlignment alignment); 90 void UpdateAfterShelfAlignmentChange(ShelfAlignment alignment);
97 91
98 // Temporarily hides/unhides the notification bubble.
99 void SetHideNotifications(bool hidden);
100
101 // Returns true if the shelf should be forced visible when auto-hidden. 92 // Returns true if the shelf should be forced visible when auto-hidden.
102 bool ShouldShowShelf() const; 93 bool ShouldShowShelf() const;
103 94
104 // Returns true if there is a system bubble (already visible or in the process 95 // Returns true if there is a system bubble (already visible or in the process
105 // of being created). 96 // of being created).
106 bool HasSystemBubble() const; 97 bool HasSystemBubble() const;
107 98
108 // Returns true if there is a notification bubble.
109 bool HasNotificationBubble() const;
110
111 // Returns true if the system_bubble_ exists and is of type |type|. 99 // Returns true if the system_bubble_ exists and is of type |type|.
112 bool HasSystemBubbleType(SystemTrayBubble::BubbleType type); 100 bool HasSystemBubbleType(SystemTrayBubble::BubbleType type);
113 101
114 // Returns a pointer to the system bubble or NULL if none. 102 // Returns a pointer to the system bubble or NULL if none.
115 SystemTrayBubble* GetSystemBubble(); 103 SystemTrayBubble* GetSystemBubble();
116 104
117 // Returns true if any bubble is visible. 105 // Returns true if SystemBubble is visible.
tdanderson 2017/02/07 00:15:46 nit: "the system bubble" instead of the class name
yiyix 2017/02/07 22:03:22 Done.
118 bool IsAnyBubbleVisible() const; 106 bool IsSystemBubbleVisible() const;
119
120 // Returns true if the mouse is inside the notification bubble.
121 bool IsMouseInNotificationBubble() const;
122 107
123 // Closes system bubble and returns true if it did exist. 108 // Closes system bubble and returns true if it did exist.
124 bool CloseSystemBubble() const; 109 bool CloseSystemBubble() const;
125 110
126 // Returns view for help button if default view is shown. Returns NULL 111 // Returns view for help button if default view is shown. Returns NULL
127 // otherwise. 112 // otherwise.
128 views::View* GetHelpButtonView() const; 113 views::View* GetHelpButtonView() const;
129 114
130 // Returns TrayAudio object if present or null otherwise. 115 // Returns TrayAudio object if present or null otherwise.
131 TrayAudio* GetTrayAudio() const; 116 TrayAudio* GetTrayAudio() const;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // Creates the key event watcher. See |ShowItems()| for why key events are 165 // Creates the key event watcher. See |ShowItems()| for why key events are
181 // observed. 166 // observed.
182 void CreateKeyEventWatcher(); 167 void CreateKeyEventWatcher();
183 168
184 // Creates the default set of items for the sytem tray. 169 // Creates the default set of items for the sytem tray.
185 void CreateItems(SystemTrayDelegate* delegate); 170 void CreateItems(SystemTrayDelegate* delegate);
186 171
187 // Resets |system_bubble_| and clears any related state. 172 // Resets |system_bubble_| and clears any related state.
188 void DestroySystemBubble(); 173 void DestroySystemBubble();
189 174
190 // Resets |notification_bubble_| and clears any related state.
191 void DestroyNotificationBubble();
192
193 // Returns a string with the current time for accessibility on the status 175 // Returns a string with the current time for accessibility on the status
194 // tray bar. 176 // tray bar.
195 base::string16 GetAccessibleTimeString(const base::Time& now) const; 177 base::string16 GetAccessibleTimeString(const base::Time& now) const;
196 178
197 // Constructs or re-constructs |system_bubble_| and populates it with |items|. 179 // Constructs or re-constructs |system_bubble_| and populates it with |items|.
198 // Specify |change_tray_status| to true if want to change the tray background 180 // Specify |change_tray_status| to true if want to change the tray background
199 // status. The bubble will be opened in inactive state. If |can_activate| is 181 // status. The bubble will be opened in inactive state. If |can_activate| is
200 // true, the bubble will be activated by one of following means. 182 // true, the bubble will be activated by one of following means.
201 // * When alt/alt-tab acclerator is used to start navigation. 183 // * When alt/alt-tab acclerator is used to start navigation.
202 // * When the bubble is opened by accelerator. 184 // * When the bubble is opened by accelerator.
203 // * When the tray item is set to be focused. 185 // * When the tray item is set to be focused.
204 void ShowItems(const std::vector<SystemTrayItem*>& items, 186 void ShowItems(const std::vector<SystemTrayItem*>& items,
205 bool details, 187 bool details,
206 bool can_activate, 188 bool can_activate,
207 BubbleCreationType creation_type, 189 BubbleCreationType creation_type,
208 bool persistent); 190 bool persistent);
209 191
210 // Constructs or re-constructs |notification_bubble_| and populates it with
211 // |notification_items_|, or destroys it if there are no notification items.
212 void UpdateNotificationBubble();
213
214 // Checks the current status of the system tray and updates the web 192 // Checks the current status of the system tray and updates the web
215 // notification tray according to the current status. 193 // notification tray according to the current status.
216 void UpdateWebNotifications(); 194 void UpdateWebNotifications();
217 195
218 // Deactivate the system tray in the shelf if it was active before. 196 // Deactivate the system tray in the shelf if it was active before.
219 void CloseSystemBubbleAndDeactivateSystemTray(); 197 void CloseSystemBubbleAndDeactivateSystemTray();
220 198
221 // Records UMA metrics for the number of user-visible rows in the system menu 199 // Records UMA metrics for the number of user-visible rows in the system menu
222 // and the percentage of the work area height covered by the system menu. 200 // and the percentage of the work area height covered by the system menu.
223 void RecordSystemMenuMetrics(); 201 void RecordSystemMenuMetrics();
224 202
225 // Overridden from ActionableView. 203 // Overridden from ActionableView.
226 bool PerformAction(const ui::Event& event) override; 204 bool PerformAction(const ui::Event& event) override;
227 205
228 // The web notification tray view that appears adjacent to this view. 206 // The web notification tray view that appears adjacent to this view.
229 WebNotificationTray* web_notification_tray_; 207 WebNotificationTray* web_notification_tray_;
230 208
231 // Items. 209 // Items.
232 std::vector<std::unique_ptr<SystemTrayItem>> items_; 210 std::vector<std::unique_ptr<SystemTrayItem>> items_;
233 211
234 // Pointers to members of |items_|. 212 // Pointers to members of |items_|.
235 SystemTrayItem* detailed_item_; 213 SystemTrayItem* detailed_item_;
236 std::vector<SystemTrayItem*> notification_items_;
237 214
238 // Mappings of system tray item and it's view in the tray. 215 // Mappings of system tray item and it's view in the tray.
239 std::map<SystemTrayItem*, views::View*> tray_item_map_; 216 std::map<SystemTrayItem*, views::View*> tray_item_map_;
240 217
241 // Bubble for default and detailed views. 218 // Bubble for default and detailed views.
242 std::unique_ptr<SystemBubbleWrapper> system_bubble_; 219 std::unique_ptr<SystemBubbleWrapper> system_bubble_;
243 220
244 // Bubble for notifications.
245 std::unique_ptr<SystemBubbleWrapper> notification_bubble_;
246
247 // Keep track of the default view height so that when we create detailed 221 // Keep track of the default view height so that when we create detailed
248 // views directly (e.g. from a notification) we know what height to use. 222 // views directly (e.g. from a notification) we know what height to use.
249 int default_bubble_height_; 223 int default_bubble_height_;
250 224
251 // Set to true when system notifications should be hidden (e.g. web
252 // notification bubble is visible).
253 bool hide_notifications_;
254
255 // This is true when the displayed system tray menu is a full tray menu, 225 // This is true when the displayed system tray menu is a full tray menu,
256 // otherwise a single line item menu like the volume slider is shown. 226 // otherwise a single line item menu like the volume slider is shown.
257 // Note that the value is only valid when |system_bubble_| is true. 227 // Note that the value is only valid when |system_bubble_| is true.
258 bool full_system_tray_menu_; 228 bool full_system_tray_menu_;
259 229
260 // These objects are not owned by this class. 230 // These objects are not owned by this class.
261 TrayAccessibility* tray_accessibility_; 231 TrayAccessibility* tray_accessibility_;
262 TrayAudio* tray_audio_; // May be null. 232 TrayAudio* tray_audio_; // May be null.
263 TrayCast* tray_cast_; 233 TrayCast* tray_cast_;
264 TrayDate* tray_date_; // null for material design. 234 TrayDate* tray_date_; // null for material design.
(...skipping 12 matching lines...) Expand all
277 std::unique_ptr<KeyEventWatcher> key_event_watcher_; 247 std::unique_ptr<KeyEventWatcher> key_event_watcher_;
278 248
279 std::unique_ptr<ActivationObserver> activation_observer_; 249 std::unique_ptr<ActivationObserver> activation_observer_;
280 250
281 DISALLOW_COPY_AND_ASSIGN(SystemTray); 251 DISALLOW_COPY_AND_ASSIGN(SystemTray);
282 }; 252 };
283 253
284 } // namespace ash 254 } // namespace ash
285 255
286 #endif // ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_H_ 256 #endif // ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698