| 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/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 "ash/system/cast/tray_cast.h" | 15 #include "ash/system/cast/tray_cast.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/scoped_vector.h" | 17 #include "base/memory/scoped_vector.h" |
| 18 #include "ui/views/bubble/tray_bubble_view.h" | 18 #include "ui/views/bubble/tray_bubble_view.h" |
| 19 #include "ui/views/view.h" | 19 #include "ui/views/view.h" |
| 20 | 20 |
| 21 namespace ash { | 21 namespace ash { |
| 22 | 22 |
| 23 enum class LoginStatus; | 23 enum class LoginStatus; |
| 24 class ScreenTrayItem; | 24 class ScreenTrayItem; |
| 25 class StatusAreaWidget; | |
| 26 class SystemBubbleWrapper; | 25 class SystemBubbleWrapper; |
| 27 class SystemTrayDelegate; | 26 class SystemTrayDelegate; |
| 28 class SystemTrayItem; | 27 class SystemTrayItem; |
| 29 class TrayAccessibility; | 28 class TrayAccessibility; |
| 30 class TrayDate; | 29 class TrayDate; |
| 31 class TrayUpdate; | 30 class TrayUpdate; |
| 32 class TrayUser; | 31 class TrayUser; |
| 32 class WebNotificationTray; |
| 33 | 33 |
| 34 // There are different methods for creating bubble views. | 34 // There are different methods for creating bubble views. |
| 35 enum BubbleCreationType { | 35 enum BubbleCreationType { |
| 36 BUBBLE_CREATE_NEW, // Closes any existing bubble and creates a new one. | 36 BUBBLE_CREATE_NEW, // Closes any existing bubble and creates a new one. |
| 37 BUBBLE_USE_EXISTING, // Uses any existing bubble, or creates a new one. | 37 BUBBLE_USE_EXISTING, // Uses any existing bubble, or creates a new one. |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 class ASH_EXPORT SystemTray : public TrayBackgroundView, | 40 class ASH_EXPORT SystemTray : public TrayBackgroundView, |
| 41 public views::TrayBubbleView::Delegate { | 41 public views::TrayBubbleView::Delegate { |
| 42 public: | 42 public: |
| 43 explicit SystemTray(StatusAreaWidget* status_area_widget); | 43 explicit SystemTray(WmShelf* wm_shelf); |
| 44 ~SystemTray() override; | 44 ~SystemTray() override; |
| 45 | 45 |
| 46 // Calls TrayBackgroundView::Initialize(), creates the tray items, and | 46 // Calls TrayBackgroundView::Initialize(), creates the tray items, and |
| 47 // adds them to SystemTrayNotifier. | 47 // adds them to SystemTrayNotifier. |
| 48 void InitializeTrayItems(SystemTrayDelegate* delegate); | 48 void InitializeTrayItems(SystemTrayDelegate* delegate, |
| 49 WebNotificationTray* web_notification_tray); |
| 50 |
| 51 // Resets internal pointers. |
| 52 void Shutdown(); |
| 49 | 53 |
| 50 // Adds a new item in the tray. | 54 // Adds a new item in the tray. |
| 51 void AddTrayItem(SystemTrayItem* item); | 55 void AddTrayItem(SystemTrayItem* item); |
| 52 | 56 |
| 53 // Removes an existing tray item. | 57 // Removes an existing tray item. |
| 54 void RemoveTrayItem(SystemTrayItem* item); | 58 void RemoveTrayItem(SystemTrayItem* item); |
| 55 | 59 |
| 56 // Returns all tray items that has been added to system tray. | 60 // Returns all tray items that has been added to system tray. |
| 57 const std::vector<SystemTrayItem*>& GetTrayItems() const; | 61 const std::vector<SystemTrayItem*>& GetTrayItems() const; |
| 58 | 62 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 | 211 |
| 208 // Records UMA metrics for the number of user-visible rows in the system menu | 212 // Records UMA metrics for the number of user-visible rows in the system menu |
| 209 // and the percentage of the work area height covered by the system menu. | 213 // and the percentage of the work area height covered by the system menu. |
| 210 void RecordSystemMenuMetrics(); | 214 void RecordSystemMenuMetrics(); |
| 211 | 215 |
| 212 const ScopedVector<SystemTrayItem>& items() const { return items_; } | 216 const ScopedVector<SystemTrayItem>& items() const { return items_; } |
| 213 | 217 |
| 214 // Overridden from ActionableView. | 218 // Overridden from ActionableView. |
| 215 bool PerformAction(const ui::Event& event) override; | 219 bool PerformAction(const ui::Event& event) override; |
| 216 | 220 |
| 217 // The widget containing this view. | 221 // The web notification tray view that appears adjacent to this view. |
| 218 StatusAreaWidget* status_area_widget_; | 222 WebNotificationTray* web_notification_tray_; |
| 219 | 223 |
| 220 // Owned items. | 224 // Owned items. |
| 221 ScopedVector<SystemTrayItem> items_; | 225 ScopedVector<SystemTrayItem> items_; |
| 222 | 226 |
| 223 // Pointers to members of |items_|. | 227 // Pointers to members of |items_|. |
| 224 SystemTrayItem* detailed_item_; | 228 SystemTrayItem* detailed_item_; |
| 225 std::vector<SystemTrayItem*> notification_items_; | 229 std::vector<SystemTrayItem*> notification_items_; |
| 226 | 230 |
| 227 // Mappings of system tray item and it's view in the tray. | 231 // Mappings of system tray item and it's view in the tray. |
| 228 std::map<SystemTrayItem*, views::View*> tray_item_map_; | 232 std::map<SystemTrayItem*, views::View*> tray_item_map_; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 254 // A reference to the Screen share and capture item. | 258 // A reference to the Screen share and capture item. |
| 255 ScreenTrayItem* screen_capture_tray_item_; // not owned | 259 ScreenTrayItem* screen_capture_tray_item_; // not owned |
| 256 ScreenTrayItem* screen_share_tray_item_; // not owned | 260 ScreenTrayItem* screen_share_tray_item_; // not owned |
| 257 | 261 |
| 258 DISALLOW_COPY_AND_ASSIGN(SystemTray); | 262 DISALLOW_COPY_AND_ASSIGN(SystemTray); |
| 259 }; | 263 }; |
| 260 | 264 |
| 261 } // namespace ash | 265 } // namespace ash |
| 262 | 266 |
| 263 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ | 267 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ |
| OLD | NEW |