| 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> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 class KeyEventWatcher; | 21 class KeyEventWatcher; |
| 22 enum class LoginStatus; | 22 enum class LoginStatus; |
| 23 class ScreenTrayItem; | 23 class ScreenTrayItem; |
| 24 class SystemBubbleWrapper; | 24 class SystemBubbleWrapper; |
| 25 class SystemTrayDelegate; | 25 class SystemTrayDelegate; |
| 26 class SystemTrayItem; | 26 class SystemTrayItem; |
| 27 class TrayAccessibility; | 27 class TrayAccessibility; |
| 28 class TrayAudio; | 28 class TrayAudio; |
| 29 class TrayCast; | 29 class TrayCast; |
| 30 class TrayNetwork; | 30 class TrayNetwork; |
| 31 class TraySupervisedUser; |
| 31 class TraySystemInfo; | 32 class TraySystemInfo; |
| 32 class TrayTiles; | 33 class TrayTiles; |
| 33 class TrayUpdate; | 34 class TrayUpdate; |
| 34 class WebNotificationTray; | 35 class WebNotificationTray; |
| 35 | 36 |
| 36 // There are different methods for creating bubble views. | 37 // There are different methods for creating bubble views. |
| 37 enum BubbleCreationType { | 38 enum BubbleCreationType { |
| 38 BUBBLE_CREATE_NEW, // Closes any existing bubble and creates a new one. | 39 BUBBLE_CREATE_NEW, // Closes any existing bubble and creates a new one. |
| 39 BUBBLE_USE_EXISTING, // Uses any existing bubble, or creates a new one. | 40 BUBBLE_USE_EXISTING, // Uses any existing bubble, or creates a new one. |
| 40 }; | 41 }; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 views::Widget::InitParams* params) const override; | 134 views::Widget::InitParams* params) const override; |
| 134 void HideBubble(const views::TrayBubbleView* bubble_view) override; | 135 void HideBubble(const views::TrayBubbleView* bubble_view) override; |
| 135 | 136 |
| 136 ScreenTrayItem* GetScreenShareItem() { return screen_share_tray_item_; } | 137 ScreenTrayItem* GetScreenShareItem() { return screen_share_tray_item_; } |
| 137 ScreenTrayItem* GetScreenCaptureItem() { return screen_capture_tray_item_; } | 138 ScreenTrayItem* GetScreenCaptureItem() { return screen_capture_tray_item_; } |
| 138 | 139 |
| 139 TrayAccessibility* GetTrayAccessibilityForTest() { | 140 TrayAccessibility* GetTrayAccessibilityForTest() { |
| 140 return tray_accessibility_; | 141 return tray_accessibility_; |
| 141 } | 142 } |
| 142 | 143 |
| 143 // Get the tray item view (or NULL) for a given |tray_item| in a unit test. | |
| 144 views::View* GetTrayItemViewForTest(SystemTrayItem* tray_item); | |
| 145 | |
| 146 TrayCast* GetTrayCastForTesting() const; | 144 TrayCast* GetTrayCastForTesting() const; |
| 147 TrayNetwork* GetTrayNetworkForTesting() const; | 145 TrayNetwork* GetTrayNetworkForTesting() const; |
| 146 TraySupervisedUser* GetTraySupervisedUserForTesting() const; |
| 148 TraySystemInfo* GetTraySystemInfoForTesting() const; | 147 TraySystemInfo* GetTraySystemInfoForTesting() const; |
| 149 TrayTiles* GetTrayTilesForTesting() const; | 148 TrayTiles* GetTrayTilesForTesting() const; |
| 150 | 149 |
| 151 // Activates the system tray bubble. | 150 // Activates the system tray bubble. |
| 152 void ActivateBubble(); | 151 void ActivateBubble(); |
| 153 | 152 |
| 154 private: | 153 private: |
| 155 class ActivationObserver; | 154 class ActivationObserver; |
| 156 | 155 |
| 157 // Closes the bubble. Used to bind as a KeyEventWatcher::KeyEventCallback. | 156 // Closes the bubble. Used to bind as a KeyEventWatcher::KeyEventCallback. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 | 202 |
| 204 // The web notification tray view that appears adjacent to this view. | 203 // The web notification tray view that appears adjacent to this view. |
| 205 WebNotificationTray* web_notification_tray_ = nullptr; | 204 WebNotificationTray* web_notification_tray_ = nullptr; |
| 206 | 205 |
| 207 // Items. | 206 // Items. |
| 208 std::vector<std::unique_ptr<SystemTrayItem>> items_; | 207 std::vector<std::unique_ptr<SystemTrayItem>> items_; |
| 209 | 208 |
| 210 // Pointers to members of |items_|. | 209 // Pointers to members of |items_|. |
| 211 SystemTrayItem* detailed_item_ = nullptr; | 210 SystemTrayItem* detailed_item_ = nullptr; |
| 212 | 211 |
| 213 // Mappings of system tray item and it's view in the tray. | |
| 214 std::map<SystemTrayItem*, views::View*> tray_item_map_; | |
| 215 | |
| 216 // Bubble for default and detailed views. | 212 // Bubble for default and detailed views. |
| 217 std::unique_ptr<SystemBubbleWrapper> system_bubble_; | 213 std::unique_ptr<SystemBubbleWrapper> system_bubble_; |
| 218 | 214 |
| 219 // Keep track of the default view height so that when we create detailed | 215 // Keep track of the default view height so that when we create detailed |
| 220 // views directly (e.g. from a notification) we know what height to use. | 216 // views directly (e.g. from a notification) we know what height to use. |
| 221 int default_bubble_height_ = 0; | 217 int default_bubble_height_ = 0; |
| 222 | 218 |
| 223 // This is true when the displayed system tray menu is a full tray menu, | 219 // This is true when the displayed system tray menu is a full tray menu, |
| 224 // otherwise a single line item menu like the volume slider is shown. | 220 // otherwise a single line item menu like the volume slider is shown. |
| 225 // Note that the value is only valid when |system_bubble_| is true. | 221 // Note that the value is only valid when |system_bubble_| is true. |
| 226 bool full_system_tray_menu_ = false; | 222 bool full_system_tray_menu_ = false; |
| 227 | 223 |
| 228 // These objects are not owned by this class. | 224 // These objects are not owned by this class. |
| 229 TrayAccessibility* tray_accessibility_ = nullptr; | 225 TrayAccessibility* tray_accessibility_ = nullptr; |
| 230 TrayAudio* tray_audio_ = nullptr; // May be null. | 226 TrayAudio* tray_audio_ = nullptr; // May be null. |
| 231 TrayCast* tray_cast_ = nullptr; | 227 TrayCast* tray_cast_ = nullptr; |
| 232 TrayNetwork* tray_network_ = nullptr; | 228 TrayNetwork* tray_network_ = nullptr; |
| 233 TrayTiles* tray_tiles_ = nullptr; | 229 TrayTiles* tray_tiles_ = nullptr; |
| 230 TraySupervisedUser* tray_supervised_user_ = nullptr; |
| 234 TraySystemInfo* tray_system_info_ = nullptr; | 231 TraySystemInfo* tray_system_info_ = nullptr; |
| 235 TrayUpdate* tray_update_ = nullptr; | 232 TrayUpdate* tray_update_ = nullptr; |
| 236 | 233 |
| 237 // A reference to the Screen share and capture item. | 234 // A reference to the Screen share and capture item. |
| 238 ScreenTrayItem* screen_capture_tray_item_ = nullptr; // not owned | 235 ScreenTrayItem* screen_capture_tray_item_ = nullptr; // not owned |
| 239 ScreenTrayItem* screen_share_tray_item_ = nullptr; // not owned | 236 ScreenTrayItem* screen_share_tray_item_ = nullptr; // not owned |
| 240 | 237 |
| 241 std::unique_ptr<KeyEventWatcher> key_event_watcher_; | 238 std::unique_ptr<KeyEventWatcher> key_event_watcher_; |
| 242 | 239 |
| 243 std::unique_ptr<ActivationObserver> activation_observer_; | 240 std::unique_ptr<ActivationObserver> activation_observer_; |
| 244 | 241 |
| 245 DISALLOW_COPY_AND_ASSIGN(SystemTray); | 242 DISALLOW_COPY_AND_ASSIGN(SystemTray); |
| 246 }; | 243 }; |
| 247 | 244 |
| 248 } // namespace ash | 245 } // namespace ash |
| 249 | 246 |
| 250 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ | 247 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ |
| OLD | NEW |