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/launcher/background_animator.h"
10 #include "ash/shelf_types.h"
11 #include "ash/system/user/login_status.h"
12 #include "ui/views/widget/widget.h"
18 class WebNotificationTray
;
22 class StatusAreaWidgetDelegate
;
24 class ASH_EXPORT StatusAreaWidget
: public views::Widget
{
26 explicit StatusAreaWidget(aura::Window
* status_container
);
27 virtual ~StatusAreaWidget();
29 // Creates the SystemTray and the WebNotificationTray.
30 void CreateTrayViews();
32 // Destroys the system tray and web notification tray. Called before
33 // tearing down the windows to avoid shutdown ordering issues.
36 // Update the alignment of the widget and tray views.
37 void SetShelfAlignment(ShelfAlignment alignment
);
39 // Update whether to paint a background for each tray view.
40 void SetPaintsBackground(
42 internal::BackgroundAnimator::ChangeType change_type
);
44 // Set the visibility state of web notifications.
45 void SetHideWebNotifications(bool hide
);
47 // Set the visibility of system notifications.
48 void SetHideSystemNotifications(bool hide
);
50 // Returns true if it is OK to show a non system notification.
51 bool ShouldShowWebNotifications();
53 // Called by the client when the login status changes. Caches login_status
54 // and calls UpdateAfterLoginStatusChange for the system tray and the web
56 void UpdateAfterLoginStatusChange(user::LoginStatus login_status
);
58 internal::StatusAreaWidgetDelegate
* status_area_widget_delegate() {
59 return status_area_widget_delegate_
;
61 SystemTray
* system_tray() { return system_tray_
; }
62 WebNotificationTray
* web_notification_tray() {
63 return web_notification_tray_
;
66 user::LoginStatus
login_status() const { return login_status_
; }
68 // Returns true if the launcher should be visible. This is used when the
69 // launcher is configured to auto-hide and test if the shelf should force
70 // the launcher to remain visible.
71 bool ShouldShowLauncher() const;
73 // True if any message bubble is shown.
74 bool IsMessageBubbleShown() const;
78 void AddWebNotificationTray();
80 // Weak pointers to View classes that are parented to StatusAreaWidget:
81 internal::StatusAreaWidgetDelegate
* status_area_widget_delegate_
;
82 SystemTray
* system_tray_
;
83 WebNotificationTray
* web_notification_tray_
;
84 user::LoginStatus login_status_
;
86 DISALLOW_COPY_AND_ASSIGN(StatusAreaWidget
);
89 } // namespace internal
92 #endif // ASH_SYSTEM_STATUS_AREA_WIDGET_H_