15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef ASH_SYSTEM_STATUS_AREA_WIDGET_H_
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define ASH_SYSTEM_STATUS_AREA_WIDGET_H_
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ash/ash_export.h"
92a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "ash/shelf/shelf_types.h"
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ash/system/user/login_status.h"
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/views/widget/widget.h"
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace ash {
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ShellDelegate;
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class SystemTray;
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class WebNotificationTray;
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace internal {
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class StatusAreaWidgetDelegate;
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ASH_EXPORT StatusAreaWidget : public views::Widget {
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public:
25c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  static const char kNativeViewName[];
26c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  explicit StatusAreaWidget(aura::Window* status_container);
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual ~StatusAreaWidget();
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Creates the SystemTray and the WebNotificationTray.
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void CreateTrayViews();
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Destroys the system tray and web notification tray. Called before
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // tearing down the windows to avoid shutdown ordering issues.
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void Shutdown();
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Update the alignment of the widget and tray views.
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void SetShelfAlignment(ShelfAlignment alignment);
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Set the visibility of system notifications.
415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void SetHideSystemNotifications(bool hide);
425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns true if it is OK to show a non system notification.
445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool ShouldShowWebNotifications();
455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Called by the client when the login status changes. Caches login_status
475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // and calls UpdateAfterLoginStatusChange for the system tray and the web
485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // notification tray.
495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void UpdateAfterLoginStatusChange(user::LoginStatus login_status);
505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  internal::StatusAreaWidgetDelegate* status_area_widget_delegate() {
525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return status_area_widget_delegate_;
535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  SystemTray* system_tray() { return system_tray_; }
555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  WebNotificationTray* web_notification_tray() {
565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return web_notification_tray_;
575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  user::LoginStatus login_status() const { return login_status_; }
605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns true if the launcher should be visible. This is used when the
625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // launcher is configured to auto-hide and test if the shelf should force
635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // the launcher to remain visible.
645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool ShouldShowLauncher() const;
655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // True if any message bubble is shown.
675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool IsMessageBubbleShown() const;
685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
69c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // Overridden from views::Widget:
70c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  virtual void OnNativeWidgetActivationChanged(bool active) OVERRIDE;
71c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) private:
735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void AddSystemTray();
745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void AddWebNotificationTray();
755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Weak pointers to View classes that are parented to StatusAreaWidget:
775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  internal::StatusAreaWidgetDelegate* status_area_widget_delegate_;
785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  SystemTray* system_tray_;
795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  WebNotificationTray* web_notification_tray_;
805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  user::LoginStatus login_status_;
815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(StatusAreaWidget);
835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // namespace internal
865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // namespace ash
875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // ASH_SYSTEM_STATUS_AREA_WIDGET_H_
89