| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef ASH_SYSTEM_STATUS_AREA_WIDGET_H_ | |
| 6 #define ASH_SYSTEM_STATUS_AREA_WIDGET_H_ | |
| 7 | |
| 8 #include "ash/ash_export.h" | |
| 9 #include "ash/common/login_status.h" | |
| 10 #include "ash/common/shelf/shelf_types.h" | |
| 11 #include "base/macros.h" | |
| 12 #include "ui/views/widget/widget.h" | |
| 13 | |
| 14 namespace ash { | |
| 15 class OverviewButtonTray; | |
| 16 class ShellDelegate; | |
| 17 class StatusAreaWidgetDelegate; | |
| 18 class SystemTray; | |
| 19 class WebNotificationTray; | |
| 20 class WmShelf; | |
| 21 class WmWindow; | |
| 22 #if defined(OS_CHROMEOS) | |
| 23 class LogoutButtonTray; | |
| 24 class VirtualKeyboardTray; | |
| 25 #endif | |
| 26 | |
| 27 class ASH_EXPORT StatusAreaWidget : public views::Widget { | |
| 28 public: | |
| 29 StatusAreaWidget(WmWindow* status_container, WmShelf* wm_shelf); | |
| 30 ~StatusAreaWidget() override; | |
| 31 | |
| 32 // Creates the SystemTray, WebNotificationTray and LogoutButtonTray. | |
| 33 void CreateTrayViews(); | |
| 34 | |
| 35 // Destroys the system tray and web notification tray. Called before | |
| 36 // tearing down the windows to avoid shutdown ordering issues. | |
| 37 void Shutdown(); | |
| 38 | |
| 39 // Update the alignment of the widget and tray views. | |
| 40 void SetShelfAlignment(ShelfAlignment alignment); | |
| 41 | |
| 42 // Called by the client when the login status changes. Caches login_status | |
| 43 // and calls UpdateAfterLoginStatusChange for the system tray and the web | |
| 44 // notification tray. | |
| 45 void UpdateAfterLoginStatusChange(LoginStatus login_status); | |
| 46 | |
| 47 StatusAreaWidgetDelegate* status_area_widget_delegate() { | |
| 48 return status_area_widget_delegate_; | |
| 49 } | |
| 50 SystemTray* system_tray() { return system_tray_; } | |
| 51 WebNotificationTray* web_notification_tray() { | |
| 52 return web_notification_tray_; | |
| 53 } | |
| 54 OverviewButtonTray* overview_button_tray() { return overview_button_tray_; } | |
| 55 WmShelf* wm_shelf() { return wm_shelf_; } | |
| 56 | |
| 57 LoginStatus login_status() const { return login_status_; } | |
| 58 | |
| 59 // Returns true if the shelf should be visible. This is used when the | |
| 60 // shelf is configured to auto-hide and test if the shelf should force | |
| 61 // the shelf to remain visible. | |
| 62 bool ShouldShowShelf() const; | |
| 63 | |
| 64 // True if any message bubble is shown. | |
| 65 bool IsMessageBubbleShown() const; | |
| 66 | |
| 67 // Notifies child trays, and the |status_area_widget_delegate_| to schedule a | |
| 68 // paint. | |
| 69 void SchedulePaint(); | |
| 70 | |
| 71 // Overridden from views::Widget: | |
| 72 void OnNativeWidgetActivationChanged(bool active) override; | |
| 73 void OnMouseEvent(ui::MouseEvent* event) override; | |
| 74 void OnGestureEvent(ui::GestureEvent* event) override; | |
| 75 | |
| 76 private: | |
| 77 void AddSystemTray(); | |
| 78 void AddWebNotificationTray(); | |
| 79 #if defined(OS_CHROMEOS) | |
| 80 void AddLogoutButtonTray(); | |
| 81 void AddVirtualKeyboardTray(); | |
| 82 #endif | |
| 83 void AddOverviewButtonTray(); | |
| 84 | |
| 85 // Weak pointers to View classes that are parented to StatusAreaWidget: | |
| 86 StatusAreaWidgetDelegate* status_area_widget_delegate_; | |
| 87 OverviewButtonTray* overview_button_tray_; | |
| 88 SystemTray* system_tray_; | |
| 89 WebNotificationTray* web_notification_tray_; | |
| 90 #if defined(OS_CHROMEOS) | |
| 91 LogoutButtonTray* logout_button_tray_; | |
| 92 VirtualKeyboardTray* virtual_keyboard_tray_; | |
| 93 #endif | |
| 94 LoginStatus login_status_; | |
| 95 | |
| 96 WmShelf* wm_shelf_; | |
| 97 | |
| 98 DISALLOW_COPY_AND_ASSIGN(StatusAreaWidget); | |
| 99 }; | |
| 100 | |
| 101 } // namespace ash | |
| 102 | |
| 103 #endif // ASH_SYSTEM_STATUS_AREA_WIDGET_H_ | |
| OLD | NEW |