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 {
14a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)class OverviewButtonTray;
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ShellDelegate;
16c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdochclass StatusAreaWidgetDelegate;
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class SystemTray;
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class WebNotificationTray;
19a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#if defined(OS_CHROMEOS)
20a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)class LogoutButtonTray;
21a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)class VirtualKeyboardTray;
22a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#endif
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ASH_EXPORT StatusAreaWidget : public views::Widget {
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public:
26c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  static const char kNativeViewName[];
27c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  explicit StatusAreaWidget(aura::Window* status_container);
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual ~StatusAreaWidget();
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
313551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Creates the SystemTray, WebNotificationTray and LogoutButtonTray.
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void CreateTrayViews();
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Destroys the system tray and web notification tray. Called before
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // tearing down the windows to avoid shutdown ordering issues.
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void Shutdown();
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Update the alignment of the widget and tray views.
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void SetShelfAlignment(ShelfAlignment alignment);
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Set the visibility of system notifications.
425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void SetHideSystemNotifications(bool hide);
435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Called by the client when the login status changes. Caches login_status
455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // and calls UpdateAfterLoginStatusChange for the system tray and the web
465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // notification tray.
475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void UpdateAfterLoginStatusChange(user::LoginStatus login_status);
485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
49c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  StatusAreaWidgetDelegate* status_area_widget_delegate() {
505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return status_area_widget_delegate_;
515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  SystemTray* system_tray() { return system_tray_; }
535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  WebNotificationTray* web_notification_tray() {
545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return web_notification_tray_;
555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
56a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  OverviewButtonTray* overview_button_tray() {
57a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    return overview_button_tray_;
58a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  }
595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  user::LoginStatus login_status() const { return login_status_; }
615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
625d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Returns true if the shelf should be visible. This is used when the
635d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // shelf is configured to auto-hide and test if the shelf should force
645d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // the shelf to remain visible.
655d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  bool ShouldShowShelf() const;
665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // True if any message bubble is shown.
685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool IsMessageBubbleShown() const;
695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
7046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // Notifies child trays, and the |status_area_widget_delegate_| to schedule a
7146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // paint.
7246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  void SchedulePaint();
7346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
74c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // Overridden from views::Widget:
75c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  virtual void OnNativeWidgetActivationChanged(bool active) OVERRIDE;
76c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) private:
785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void AddSystemTray();
795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void AddWebNotificationTray();
80a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#if defined(OS_CHROMEOS)
813551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void AddLogoutButtonTray();
82a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  void AddVirtualKeyboardTray();
83a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#endif
84a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  void AddOverviewButtonTray();
855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Weak pointers to View classes that are parented to StatusAreaWidget:
87c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  StatusAreaWidgetDelegate* status_area_widget_delegate_;
88a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  OverviewButtonTray* overview_button_tray_;
895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  SystemTray* system_tray_;
905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  WebNotificationTray* web_notification_tray_;
91a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#if defined(OS_CHROMEOS)
923551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  LogoutButtonTray* logout_button_tray_;
93a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  VirtualKeyboardTray* virtual_keyboard_tray_;
94a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#endif
955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  user::LoginStatus login_status_;
965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(StatusAreaWidget);
985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // namespace ash
1015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // ASH_SYSTEM_STATUS_AREA_WIDGET_H_
103