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

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

Issue 2330403002: Do not activate system tray bubble by default (Closed)
Patch Set: Do not activate system tray bubble by default Created 4 years, 3 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
« no previous file with comments | « ash/common/system/tray/hover_highlight_view.cc ('k') | ash/common/system/tray/system_tray.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
11 11
12 #include "ash/ash_export.h" 12 #include "ash/ash_export.h"
13 #include "ash/common/system/tray/system_tray_bubble.h" 13 #include "ash/common/system/tray/system_tray_bubble.h"
14 #include "ash/common/system/tray/tray_background_view.h" 14 #include "ash/common/system/tray/tray_background_view.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/scoped_vector.h" 16 #include "base/memory/scoped_vector.h"
17 #include "ui/views/bubble/tray_bubble_view.h" 17 #include "ui/views/bubble/tray_bubble_view.h"
18 #include "ui/views/view.h" 18 #include "ui/views/view.h"
19 19
20 namespace ash { 20 namespace ash {
21 21
22 class KeyEventWatcher;
22 enum class LoginStatus; 23 enum class LoginStatus;
23 class ScreenTrayItem; 24 class ScreenTrayItem;
24 class SystemBubbleWrapper; 25 class SystemBubbleWrapper;
25 class SystemTrayDelegate; 26 class SystemTrayDelegate;
26 class SystemTrayItem; 27 class SystemTrayItem;
27 class TrayAccessibility; 28 class TrayAccessibility;
28 class TrayAudio; 29 class TrayAudio;
29 class TrayCast; 30 class TrayCast;
30 class TrayDate; 31 class TrayDate;
31 class TrayUpdate; 32 class TrayUpdate;
(...skipping 10 matching lines...) Expand all
42 public views::TrayBubbleView::Delegate { 43 public views::TrayBubbleView::Delegate {
43 public: 44 public:
44 explicit SystemTray(WmShelf* wm_shelf); 45 explicit SystemTray(WmShelf* wm_shelf);
45 ~SystemTray() override; 46 ~SystemTray() override;
46 47
47 // Calls TrayBackgroundView::Initialize(), creates the tray items, and 48 // Calls TrayBackgroundView::Initialize(), creates the tray items, and
48 // adds them to SystemTrayNotifier. 49 // adds them to SystemTrayNotifier.
49 void InitializeTrayItems(SystemTrayDelegate* delegate, 50 void InitializeTrayItems(SystemTrayDelegate* delegate,
50 WebNotificationTray* web_notification_tray); 51 WebNotificationTray* web_notification_tray);
51 52
52 // Resets internal pointers. 53 // Resets internal pointers. This has to be called before deletion.
53 void Shutdown(); 54 void Shutdown();
54 55
55 // Adds a new item in the tray. Takes ownership. 56 // Adds a new item in the tray. Takes ownership.
56 void AddTrayItem(SystemTrayItem* item); 57 void AddTrayItem(SystemTrayItem* item);
57 58
58 // Returns all tray items that has been added to system tray. 59 // Returns all tray items that has been added to system tray.
59 const std::vector<SystemTrayItem*>& GetTrayItems() const; 60 const std::vector<SystemTrayItem*>& GetTrayItems() const;
60 61
61 // Shows the default view of all items. 62 // Shows the default view of all items.
62 void ShowDefaultView(BubbleCreationType creation_type); 63 void ShowDefaultView(BubbleCreationType creation_type);
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 return tray_accessibility_; 161 return tray_accessibility_;
161 } 162 }
162 163
163 // Get the tray item view (or NULL) for a given |tray_item| in a unit test. 164 // Get the tray item view (or NULL) for a given |tray_item| in a unit test.
164 views::View* GetTrayItemViewForTest(SystemTrayItem* tray_item); 165 views::View* GetTrayItemViewForTest(SystemTrayItem* tray_item);
165 166
166 TrayCast* GetTrayCastForTesting() const; 167 TrayCast* GetTrayCastForTesting() const;
167 TrayDate* GetTrayDateForTesting() const; 168 TrayDate* GetTrayDateForTesting() const;
168 TrayUpdate* GetTrayUpdateForTesting() const; 169 TrayUpdate* GetTrayUpdateForTesting() const;
169 170
171 // Activates the system tray bubble.
172 void ActivateBubble();
173
170 private: 174 private:
175 class ActivationObserver;
176
177 // Closes the bubble. Used to bind as a KeyEventWatcher::KeyEventCallback.
178 void CloseBubble(const ui::KeyEvent& key_event);
179
180 // Activates the bubble and starts key navigation with the |key_event|.
181 void ActivateAndStartNavigation(const ui::KeyEvent& key_event);
182
183 // Creates the key event watcher. See |ShowItems()| for why key events are
184 // observed.
185 void CreateKeyEventWatcher();
186
171 // Creates the default set of items for the sytem tray. 187 // Creates the default set of items for the sytem tray.
172 void CreateItems(SystemTrayDelegate* delegate); 188 void CreateItems(SystemTrayDelegate* delegate);
173 189
174 // Resets |system_bubble_| and clears any related state. 190 // Resets |system_bubble_| and clears any related state.
175 void DestroySystemBubble(); 191 void DestroySystemBubble();
176 192
177 // Resets |notification_bubble_| and clears any related state. 193 // Resets |notification_bubble_| and clears any related state.
178 void DestroyNotificationBubble(); 194 void DestroyNotificationBubble();
179 195
180 // Returns a string with the current time for accessibility on the status 196 // Returns a string with the current time for accessibility on the status
181 // tray bar. 197 // tray bar.
182 base::string16 GetAccessibleTimeString(const base::Time& now) const; 198 base::string16 GetAccessibleTimeString(const base::Time& now) const;
183 199
184 // Calculates the x-offset for the item in the tray. Returns -1 if its tray 200 // Calculates the x-offset for the item in the tray. Returns -1 if its tray
185 // item view is not visible. 201 // item view is not visible.
186 int GetTrayXOffset(SystemTrayItem* item) const; 202 int GetTrayXOffset(SystemTrayItem* item) const;
187 203
188 // Shows the default view and its arrow position is shifted by |x_offset|. 204 // Shows the default view and its arrow position is shifted by |x_offset|.
189 void ShowDefaultViewWithOffset(BubbleCreationType creation_type, 205 void ShowDefaultViewWithOffset(BubbleCreationType creation_type,
190 int x_offset, 206 int x_offset,
191 bool persistent); 207 bool persistent);
192 208
193 // Constructs or re-constructs |system_bubble_| and populates it with |items|. 209 // Constructs or re-constructs |system_bubble_| and populates it with |items|.
194 // Specify |change_tray_status| to true if want to change the tray background 210 // Specify |change_tray_status| to true if want to change the tray background
195 // status. 211 // status. The bubble will be opened in inactive state. If |can_activate| is
212 // true, the bubble will be activated by one of following means.
213 // * When alt/alt-tab acclerator is used to start navigation.
214 // * When the bubble is opened by accelerator.
215 // * When the tray item is set to be focused.
196 void ShowItems(const std::vector<SystemTrayItem*>& items, 216 void ShowItems(const std::vector<SystemTrayItem*>& items,
197 bool details, 217 bool details,
198 bool activate, 218 bool can_activate,
199 BubbleCreationType creation_type, 219 BubbleCreationType creation_type,
200 int x_offset, 220 int x_offset,
201 bool persistent); 221 bool persistent);
202 222
203 // Constructs or re-constructs |notification_bubble_| and populates it with 223 // Constructs or re-constructs |notification_bubble_| and populates it with
204 // |notification_items_|, or destroys it if there are no notification items. 224 // |notification_items_|, or destroys it if there are no notification items.
205 void UpdateNotificationBubble(); 225 void UpdateNotificationBubble();
206 226
207 // Checks the current status of the system tray and updates the web 227 // Checks the current status of the system tray and updates the web
208 // notification tray according to the current status. 228 // notification tray according to the current status.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 TrayAccessibility* tray_accessibility_; 276 TrayAccessibility* tray_accessibility_;
257 TrayAudio* tray_audio_; // May be null. 277 TrayAudio* tray_audio_; // May be null.
258 TrayCast* tray_cast_; 278 TrayCast* tray_cast_;
259 TrayDate* tray_date_; 279 TrayDate* tray_date_;
260 TrayUpdate* tray_update_; 280 TrayUpdate* tray_update_;
261 281
262 // A reference to the Screen share and capture item. 282 // A reference to the Screen share and capture item.
263 ScreenTrayItem* screen_capture_tray_item_; // not owned 283 ScreenTrayItem* screen_capture_tray_item_; // not owned
264 ScreenTrayItem* screen_share_tray_item_; // not owned 284 ScreenTrayItem* screen_share_tray_item_; // not owned
265 285
286 std::unique_ptr<KeyEventWatcher> key_event_watcher_;
287
288 std::unique_ptr<ActivationObserver> activation_observer_;
289
266 DISALLOW_COPY_AND_ASSIGN(SystemTray); 290 DISALLOW_COPY_AND_ASSIGN(SystemTray);
267 }; 291 };
268 292
269 } // namespace ash 293 } // namespace ash
270 294
271 #endif // ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_H_ 295 #endif // ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_H_
OLDNEW
« no previous file with comments | « ash/common/system/tray/hover_highlight_view.cc ('k') | ash/common/system/tray/system_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698