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; | |
22 enum class LoginStatus; | 21 enum class LoginStatus; |
23 class ScreenTrayItem; | 22 class ScreenTrayItem; |
24 class SystemBubbleWrapper; | 23 class SystemBubbleWrapper; |
25 class SystemTrayDelegate; | 24 class SystemTrayDelegate; |
26 class SystemTrayItem; | 25 class SystemTrayItem; |
27 class TrayAccessibility; | 26 class TrayAccessibility; |
28 class TrayAudio; | 27 class TrayAudio; |
29 class TrayCast; | 28 class TrayCast; |
30 class TrayEnterprise; | 29 class TrayEnterprise; |
31 class TrayNetwork; | 30 class TrayNetwork; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 void AnchorUpdated() override; | 125 void AnchorUpdated() override; |
127 base::string16 GetAccessibleNameForTray() override; | 126 base::string16 GetAccessibleNameForTray() override; |
128 void BubbleResized(const views::TrayBubbleView* bubble_view) override; | 127 void BubbleResized(const views::TrayBubbleView* bubble_view) override; |
129 void HideBubbleWithView(const views::TrayBubbleView* bubble_view) override; | 128 void HideBubbleWithView(const views::TrayBubbleView* bubble_view) override; |
130 void ClickedOutsideBubble() override; | 129 void ClickedOutsideBubble() override; |
131 | 130 |
132 // views::TrayBubbleView::Delegate: | 131 // views::TrayBubbleView::Delegate: |
133 void BubbleViewDestroyed() override; | 132 void BubbleViewDestroyed() override; |
134 void OnMouseEnteredView() override; | 133 void OnMouseEnteredView() override; |
135 void OnMouseExitedView() override; | 134 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; |
136 base::string16 GetAccessibleNameForBubble() override; | 139 base::string16 GetAccessibleNameForBubble() override; |
| 140 bool ShouldEnableExtraKeyboardAccessibility() override; |
137 void HideBubble(const views::TrayBubbleView* bubble_view) override; | 141 void HideBubble(const views::TrayBubbleView* bubble_view) override; |
138 | 142 |
139 ScreenTrayItem* GetScreenShareItem() { return screen_share_tray_item_; } | 143 ScreenTrayItem* GetScreenShareItem() { return screen_share_tray_item_; } |
140 ScreenTrayItem* GetScreenCaptureItem() { return screen_capture_tray_item_; } | 144 ScreenTrayItem* GetScreenCaptureItem() { return screen_capture_tray_item_; } |
141 | 145 |
142 // Activates the system tray bubble. | 146 // Activates the system tray bubble. |
143 void ActivateBubble(); | 147 void ActivateBubble(); |
144 | 148 |
145 private: | 149 private: |
146 friend class SystemTrayTestApi; | 150 friend class SystemTrayTestApi; |
147 class ActivationObserver; | 151 class ActivationObserver; |
148 | 152 |
149 // Closes the bubble. Used to bind as a KeyEventWatcher::KeyEventCallback. | 153 // Closes the bubble. Used to bind as a KeyEventWatcher::KeyEventCallback. |
150 void CloseBubble(const ui::KeyEvent& key_event); | 154 void CloseBubble(const ui::KeyEvent& key_event); |
151 | 155 |
152 // Activates the bubble and starts key navigation with the |key_event|. | 156 // Activates the bubble and starts key navigation with the |key_event|. |
153 void ActivateAndStartNavigation(const ui::KeyEvent& key_event); | 157 void ActivateAndStartNavigation(const ui::KeyEvent& key_event); |
154 | 158 |
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 | |
237 std::unique_ptr<ActivationObserver> activation_observer_; | 235 std::unique_ptr<ActivationObserver> activation_observer_; |
238 | 236 |
239 DISALLOW_COPY_AND_ASSIGN(SystemTray); | 237 DISALLOW_COPY_AND_ASSIGN(SystemTray); |
240 }; | 238 }; |
241 | 239 |
242 } // namespace ash | 240 } // namespace ash |
243 | 241 |
244 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ | 242 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ |
OLD | NEW |