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

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

Issue 2583393002: Send notification to users upon receiving sms messages (Closed)
Patch Set: Created 3 years, 11 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. 92 // Temporarily hides/unhides the notification bubble.
99 void SetHideNotifications(bool hidden); 93 void SetHideNotifications(bool hidden);
tdanderson 2017/01/26 22:19:07 Is this still needed?
yiyix 2017/02/02 20:43:57 You are totally correct, I removed the function in
100 94
101 // Returns true if the shelf should be forced visible when auto-hidden. 95 // Returns true if the shelf should be forced visible when auto-hidden.
102 bool ShouldShowShelf() const; 96 bool ShouldShowShelf() const;
103 97
104 // Returns true if there is a system bubble (already visible or in the process 98 // Returns true if there is a system bubble (already visible or in the process
105 // of being created). 99 // of being created).
106 bool HasSystemBubble() const; 100 bool HasSystemBubble() const;
107 101
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|. 102 // Returns true if the system_bubble_ exists and is of type |type|.
112 bool HasSystemBubbleType(SystemTrayBubble::BubbleType type); 103 bool HasSystemBubbleType(SystemTrayBubble::BubbleType type);
113 104
114 // Returns a pointer to the system bubble or NULL if none. 105 // Returns a pointer to the system bubble or NULL if none.
115 SystemTrayBubble* GetSystemBubble(); 106 SystemTrayBubble* GetSystemBubble();
116 107
117 // Returns true if any bubble is visible. 108 // Returns true if any bubble is visible.
118 bool IsAnyBubbleVisible() const; 109 bool IsAnyBubbleVisible() const;
119 110
120 // Returns true if the mouse is inside the notification bubble.
121 bool IsMouseInNotificationBubble() const;
122
123 // Closes system bubble and returns true if it did exist. 111 // Closes system bubble and returns true if it did exist.
124 bool CloseSystemBubble() const; 112 bool CloseSystemBubble() const;
125 113
126 // Returns view for help button if default view is shown. Returns NULL 114 // Returns view for help button if default view is shown. Returns NULL
127 // otherwise. 115 // otherwise.
128 views::View* GetHelpButtonView() const; 116 views::View* GetHelpButtonView() const;
129 117
130 // Returns TrayAudio object if present or null otherwise. 118 // Returns TrayAudio object if present or null otherwise.
131 TrayAudio* GetTrayAudio() const; 119 TrayAudio* GetTrayAudio() const;
132 120
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // Creates the key event watcher. See |ShowItems()| for why key events are 168 // Creates the key event watcher. See |ShowItems()| for why key events are
181 // observed. 169 // observed.
182 void CreateKeyEventWatcher(); 170 void CreateKeyEventWatcher();
183 171
184 // Creates the default set of items for the sytem tray. 172 // Creates the default set of items for the sytem tray.
185 void CreateItems(SystemTrayDelegate* delegate); 173 void CreateItems(SystemTrayDelegate* delegate);
186 174
187 // Resets |system_bubble_| and clears any related state. 175 // Resets |system_bubble_| and clears any related state.
188 void DestroySystemBubble(); 176 void DestroySystemBubble();
189 177
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 178 // Returns a string with the current time for accessibility on the status
194 // tray bar. 179 // tray bar.
195 base::string16 GetAccessibleTimeString(const base::Time& now) const; 180 base::string16 GetAccessibleTimeString(const base::Time& now) const;
196 181
197 // Constructs or re-constructs |system_bubble_| and populates it with |items|. 182 // 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 183 // 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 184 // 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. 185 // true, the bubble will be activated by one of following means.
201 // * When alt/alt-tab acclerator is used to start navigation. 186 // * When alt/alt-tab acclerator is used to start navigation.
202 // * When the bubble is opened by accelerator. 187 // * When the bubble is opened by accelerator.
203 // * When the tray item is set to be focused. 188 // * When the tray item is set to be focused.
204 void ShowItems(const std::vector<SystemTrayItem*>& items, 189 void ShowItems(const std::vector<SystemTrayItem*>& items,
205 bool details, 190 bool details,
206 bool can_activate, 191 bool can_activate,
207 BubbleCreationType creation_type, 192 BubbleCreationType creation_type,
208 bool persistent); 193 bool persistent);
209 194
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 195 // Checks the current status of the system tray and updates the web
215 // notification tray according to the current status. 196 // notification tray according to the current status.
216 void UpdateWebNotifications(); 197 void UpdateWebNotifications();
217 198
218 // Deactivate the system tray in the shelf if it was active before. 199 // Deactivate the system tray in the shelf if it was active before.
219 void CloseSystemBubbleAndDeactivateSystemTray(); 200 void CloseSystemBubbleAndDeactivateSystemTray();
220 201
221 // Records UMA metrics for the number of user-visible rows in the system menu 202 // 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. 203 // and the percentage of the work area height covered by the system menu.
223 void RecordSystemMenuMetrics(); 204 void RecordSystemMenuMetrics();
224 205
225 // Overridden from ActionableView. 206 // Overridden from ActionableView.
226 bool PerformAction(const ui::Event& event) override; 207 bool PerformAction(const ui::Event& event) override;
227 208
228 // The web notification tray view that appears adjacent to this view. 209 // The web notification tray view that appears adjacent to this view.
229 WebNotificationTray* web_notification_tray_; 210 WebNotificationTray* web_notification_tray_;
230 211
231 // Items. 212 // Items.
232 std::vector<std::unique_ptr<SystemTrayItem>> items_; 213 std::vector<std::unique_ptr<SystemTrayItem>> items_;
233 214
234 // Pointers to members of |items_|. 215 // Pointers to members of |items_|.
235 SystemTrayItem* detailed_item_; 216 SystemTrayItem* detailed_item_;
236 std::vector<SystemTrayItem*> notification_items_;
237 217
238 // Mappings of system tray item and it's view in the tray. 218 // Mappings of system tray item and it's view in the tray.
239 std::map<SystemTrayItem*, views::View*> tray_item_map_; 219 std::map<SystemTrayItem*, views::View*> tray_item_map_;
240 220
241 // Bubble for default and detailed views. 221 // Bubble for default and detailed views.
242 std::unique_ptr<SystemBubbleWrapper> system_bubble_; 222 std::unique_ptr<SystemBubbleWrapper> system_bubble_;
243 223
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 224 // 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. 225 // views directly (e.g. from a notification) we know what height to use.
249 int default_bubble_height_; 226 int default_bubble_height_;
250 227
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, 228 // 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. 229 // 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. 230 // Note that the value is only valid when |system_bubble_| is true.
258 bool full_system_tray_menu_; 231 bool full_system_tray_menu_;
259 232
260 // These objects are not owned by this class. 233 // These objects are not owned by this class.
261 TrayAccessibility* tray_accessibility_; 234 TrayAccessibility* tray_accessibility_;
262 TrayAudio* tray_audio_; // May be null. 235 TrayAudio* tray_audio_; // May be null.
263 TrayCast* tray_cast_; 236 TrayCast* tray_cast_;
264 TrayDate* tray_date_; // null for material design. 237 TrayDate* tray_date_; // null for material design.
(...skipping 12 matching lines...) Expand all
277 std::unique_ptr<KeyEventWatcher> key_event_watcher_; 250 std::unique_ptr<KeyEventWatcher> key_event_watcher_;
278 251
279 std::unique_ptr<ActivationObserver> activation_observer_; 252 std::unique_ptr<ActivationObserver> activation_observer_;
280 253
281 DISALLOW_COPY_AND_ASSIGN(SystemTray); 254 DISALLOW_COPY_AND_ASSIGN(SystemTray);
282 }; 255 };
283 256
284 } // namespace ash 257 } // namespace ash
285 258
286 #endif // ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_H_ 259 #endif // ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698