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.
5 #ifndef ASH_SYSTEM_STATUS_AREA_WIDGET_H_
6 #define ASH_SYSTEM_STATUS_AREA_WIDGET_H_
8 #include "ash/ash_export.h"
9 #include "ash/shelf/shelf_types.h"
10 #include "ash/system/user/login_status.h"
11 #include "ui/views/widget/widget.h"
14 class OverviewButtonTray
;
16 class StatusAreaWidgetDelegate
;
18 class WebNotificationTray
;
19 #if defined(OS_CHROMEOS)
20 class LogoutButtonTray
;
21 class VirtualKeyboardTray
;
24 class ASH_EXPORT StatusAreaWidget
: public views::Widget
{
26 static const char kNativeViewName
[];
28 explicit StatusAreaWidget(aura::Window
* status_container
);
29 ~StatusAreaWidget() override
;
31 // Creates the SystemTray, WebNotificationTray and LogoutButtonTray.
32 void CreateTrayViews();
34 // Destroys the system tray and web notification tray. Called before
35 // tearing down the windows to avoid shutdown ordering issues.
38 // Update the alignment of the widget and tray views.
39 void SetShelfAlignment(ShelfAlignment alignment
);
41 // Set the visibility of system notifications.
42 void SetHideSystemNotifications(bool hide
);
44 // Called by the client when the login status changes. Caches login_status
45 // and calls UpdateAfterLoginStatusChange for the system tray and the web
47 void UpdateAfterLoginStatusChange(user::LoginStatus login_status
);
49 StatusAreaWidgetDelegate
* status_area_widget_delegate() {
50 return status_area_widget_delegate_
;
52 SystemTray
* system_tray() { return system_tray_
; }
53 WebNotificationTray
* web_notification_tray() {
54 return web_notification_tray_
;
56 OverviewButtonTray
* overview_button_tray() {
57 return overview_button_tray_
;
60 user::LoginStatus
login_status() const { return login_status_
; }
62 // Returns true if the shelf should be visible. This is used when the
63 // shelf is configured to auto-hide and test if the shelf should force
64 // the shelf to remain visible.
65 bool ShouldShowShelf() const;
67 // True if any message bubble is shown.
68 bool IsMessageBubbleShown() const;
70 // Notifies child trays, and the |status_area_widget_delegate_| to schedule a
74 // Overridden from views::Widget:
75 void OnNativeWidgetActivationChanged(bool active
) override
;
79 void AddWebNotificationTray();
80 #if defined(OS_CHROMEOS)
81 void AddLogoutButtonTray();
82 void AddVirtualKeyboardTray();
84 void AddOverviewButtonTray();
86 // Weak pointers to View classes that are parented to StatusAreaWidget:
87 StatusAreaWidgetDelegate
* status_area_widget_delegate_
;
88 OverviewButtonTray
* overview_button_tray_
;
89 SystemTray
* system_tray_
;
90 WebNotificationTray
* web_notification_tray_
;
91 #if defined(OS_CHROMEOS)
92 LogoutButtonTray
* logout_button_tray_
;
93 VirtualKeyboardTray
* virtual_keyboard_tray_
;
95 user::LoginStatus login_status_
;
97 DISALLOW_COPY_AND_ASSIGN(StatusAreaWidget
);
102 #endif // ASH_SYSTEM_STATUS_AREA_WIDGET_H_