status_area_widget.h revision a1401311d1ab56c4ed0a474bd38c108f75cb0cd9
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/shelf/shelf_types.h" 10#include "ash/system/user/login_status.h" 11#include "ui/views/widget/widget.h" 12 13namespace ash { 14 15class OverviewButtonTray; 16class ShellDelegate; 17class SystemTray; 18class WebNotificationTray; 19 20namespace internal { 21 22class StatusAreaWidgetDelegate; 23#if defined(OS_CHROMEOS) 24class LogoutButtonTray; 25class VirtualKeyboardTray; 26#endif 27 28class ASH_EXPORT StatusAreaWidget : public views::Widget { 29 public: 30 static const char kNativeViewName[]; 31 32 explicit StatusAreaWidget(aura::Window* status_container); 33 virtual ~StatusAreaWidget(); 34 35 // Creates the SystemTray, WebNotificationTray and LogoutButtonTray. 36 void CreateTrayViews(); 37 38 // Destroys the system tray and web notification tray. Called before 39 // tearing down the windows to avoid shutdown ordering issues. 40 void Shutdown(); 41 42 // Update the alignment of the widget and tray views. 43 void SetShelfAlignment(ShelfAlignment alignment); 44 45 // Set the visibility of system notifications. 46 void SetHideSystemNotifications(bool hide); 47 48 // Called by the client when the login status changes. Caches login_status 49 // and calls UpdateAfterLoginStatusChange for the system tray and the web 50 // notification tray. 51 void UpdateAfterLoginStatusChange(user::LoginStatus login_status); 52 53 internal::StatusAreaWidgetDelegate* status_area_widget_delegate() { 54 return status_area_widget_delegate_; 55 } 56 SystemTray* system_tray() { return system_tray_; } 57 WebNotificationTray* web_notification_tray() { 58 return web_notification_tray_; 59 } 60 OverviewButtonTray* overview_button_tray() { 61 return overview_button_tray_; 62 } 63 64 user::LoginStatus login_status() const { return login_status_; } 65 66 // Returns true if the shelf should be visible. This is used when the 67 // shelf is configured to auto-hide and test if the shelf should force 68 // the shelf to remain visible. 69 bool ShouldShowShelf() const; 70 71 // True if any message bubble is shown. 72 bool IsMessageBubbleShown() const; 73 74 // Overridden from views::Widget: 75 virtual void OnNativeWidgetActivationChanged(bool active) OVERRIDE; 76 77 private: 78 void AddSystemTray(); 79 void AddWebNotificationTray(); 80#if defined(OS_CHROMEOS) 81 void AddLogoutButtonTray(); 82 void AddVirtualKeyboardTray(); 83#endif 84 void AddOverviewButtonTray(); 85 86 // Weak pointers to View classes that are parented to StatusAreaWidget: 87 internal::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_; 94#endif 95 user::LoginStatus login_status_; 96 97 DISALLOW_COPY_AND_ASSIGN(StatusAreaWidget); 98}; 99 100} // namespace internal 101} // namespace ash 102 103#endif // ASH_SYSTEM_STATUS_AREA_WIDGET_H_ 104