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_H_ | 5 #ifndef ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ |
6 #define ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ | 6 #define ASH_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/system/tray/system_tray_bubble.h" | 13 #include "ash/system/tray/system_tray_bubble.h" |
14 #include "ash/system/tray/tray_background_view.h" | 14 #include "ash/system/tray/tray_background_view.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "ui/views/bubble/tray_bubble_view.h" | 16 #include "ui/views/bubble/tray_bubble_view.h" |
17 #include "ui/views/view.h" | 17 #include "ui/views/view.h" |
18 | 18 |
19 namespace ash { | 19 namespace ash { |
20 | 20 |
| 21 class KeyEventWatcher; |
21 enum class LoginStatus; | 22 enum class LoginStatus; |
22 class ScreenTrayItem; | 23 class ScreenTrayItem; |
23 class SystemBubbleWrapper; | 24 class SystemBubbleWrapper; |
24 class SystemTrayDelegate; | 25 class SystemTrayDelegate; |
25 class SystemTrayItem; | 26 class SystemTrayItem; |
26 class TrayAccessibility; | 27 class TrayAccessibility; |
27 class TrayAudio; | 28 class TrayAudio; |
28 class TrayCast; | 29 class TrayCast; |
29 class TrayEnterprise; | 30 class TrayEnterprise; |
30 class TrayNetwork; | 31 class TrayNetwork; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 void AnchorUpdated() override; | 126 void AnchorUpdated() override; |
126 base::string16 GetAccessibleNameForTray() override; | 127 base::string16 GetAccessibleNameForTray() override; |
127 void BubbleResized(const views::TrayBubbleView* bubble_view) override; | 128 void BubbleResized(const views::TrayBubbleView* bubble_view) override; |
128 void HideBubbleWithView(const views::TrayBubbleView* bubble_view) override; | 129 void HideBubbleWithView(const views::TrayBubbleView* bubble_view) override; |
129 void ClickedOutsideBubble() override; | 130 void ClickedOutsideBubble() override; |
130 | 131 |
131 // views::TrayBubbleView::Delegate: | 132 // views::TrayBubbleView::Delegate: |
132 void BubbleViewDestroyed() override; | 133 void BubbleViewDestroyed() override; |
133 void OnMouseEnteredView() override; | 134 void OnMouseEnteredView() override; |
134 void OnMouseExitedView() override; | 135 void OnMouseExitedView() override; |
135 void RegisterAccelerators(const std::vector<ui::Accelerator>& accelerators, | |
136 views::TrayBubbleView* tray_bubble_view) override; | |
137 void UnregisterAllAccelerators( | |
138 views::TrayBubbleView* tray_bubble_view) override; | |
139 base::string16 GetAccessibleNameForBubble() override; | 136 base::string16 GetAccessibleNameForBubble() override; |
140 bool ShouldEnableExtraKeyboardAccessibility() override; | |
141 void HideBubble(const views::TrayBubbleView* bubble_view) override; | 137 void HideBubble(const views::TrayBubbleView* bubble_view) override; |
142 | 138 |
143 ScreenTrayItem* GetScreenShareItem() { return screen_share_tray_item_; } | 139 ScreenTrayItem* GetScreenShareItem() { return screen_share_tray_item_; } |
144 ScreenTrayItem* GetScreenCaptureItem() { return screen_capture_tray_item_; } | 140 ScreenTrayItem* GetScreenCaptureItem() { return screen_capture_tray_item_; } |
145 | 141 |
146 // Activates the system tray bubble. | 142 // Activates the system tray bubble. |
147 void ActivateBubble(); | 143 void ActivateBubble(); |
148 | 144 |
149 private: | 145 private: |
150 friend class SystemTrayTestApi; | 146 friend class SystemTrayTestApi; |
151 class ActivationObserver; | 147 class ActivationObserver; |
152 | 148 |
153 // Closes the bubble. Used to bind as a KeyEventWatcher::KeyEventCallback. | 149 // Closes the bubble. Used to bind as a KeyEventWatcher::KeyEventCallback. |
154 void CloseBubble(const ui::KeyEvent& key_event); | 150 void CloseBubble(const ui::KeyEvent& key_event); |
155 | 151 |
156 // Activates the bubble and starts key navigation with the |key_event|. | 152 // Activates the bubble and starts key navigation with the |key_event|. |
157 void ActivateAndStartNavigation(const ui::KeyEvent& key_event); | 153 void ActivateAndStartNavigation(const ui::KeyEvent& key_event); |
158 | 154 |
| 155 // Creates the key event watcher. See |ShowItems()| for why key events are |
| 156 // observed. |
| 157 void CreateKeyEventWatcher(); |
| 158 |
159 // Creates the default set of items for the sytem tray. | 159 // Creates the default set of items for the sytem tray. |
160 void CreateItems(SystemTrayDelegate* delegate); | 160 void CreateItems(SystemTrayDelegate* delegate); |
161 | 161 |
162 // Resets |system_bubble_| and clears any related state. | 162 // Resets |system_bubble_| and clears any related state. |
163 void DestroySystemBubble(); | 163 void DestroySystemBubble(); |
164 | 164 |
165 // Returns a string with the current time for accessibility on the status | 165 // Returns a string with the current time for accessibility on the status |
166 // tray bar. | 166 // tray bar. |
167 base::string16 GetAccessibleTimeString(const base::Time& now) const; | 167 base::string16 GetAccessibleTimeString(const base::Time& now) const; |
168 | 168 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 TraySessionLengthLimit* tray_session_length_limit_ = nullptr; | 225 TraySessionLengthLimit* tray_session_length_limit_ = nullptr; |
226 TraySupervisedUser* tray_supervised_user_ = nullptr; | 226 TraySupervisedUser* tray_supervised_user_ = nullptr; |
227 TraySystemInfo* tray_system_info_ = nullptr; | 227 TraySystemInfo* tray_system_info_ = nullptr; |
228 TrayUpdate* tray_update_ = nullptr; | 228 TrayUpdate* tray_update_ = nullptr; |
229 TrayNightLight* tray_night_light_ = nullptr; | 229 TrayNightLight* tray_night_light_ = nullptr; |
230 | 230 |
231 // A reference to the Screen share and capture item. | 231 // A reference to the Screen share and capture item. |
232 ScreenTrayItem* screen_capture_tray_item_ = nullptr; // not owned | 232 ScreenTrayItem* screen_capture_tray_item_ = nullptr; // not owned |
233 ScreenTrayItem* screen_share_tray_item_ = nullptr; // not owned | 233 ScreenTrayItem* screen_share_tray_item_ = nullptr; // not owned |
234 | 234 |
| 235 std::unique_ptr<KeyEventWatcher> key_event_watcher_; |
| 236 |
235 std::unique_ptr<ActivationObserver> activation_observer_; | 237 std::unique_ptr<ActivationObserver> activation_observer_; |
236 | 238 |
237 DISALLOW_COPY_AND_ASSIGN(SystemTray); | 239 DISALLOW_COPY_AND_ASSIGN(SystemTray); |
238 }; | 240 }; |
239 | 241 |
240 } // namespace ash | 242 } // namespace ash |
241 | 243 |
242 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ | 244 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ |
OLD | NEW |