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