OLD | NEW |
| (Empty) |
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_COMMON_SYSTEM_STATUS_AREA_WIDGET_H_ | |
6 #define ASH_COMMON_SYSTEM_STATUS_AREA_WIDGET_H_ | |
7 | |
8 #include "ash/ash_export.h" | |
9 #include "ash/common/login_status.h" | |
10 #include "ash/common/shelf/shelf_background_animator_observer.h" | |
11 #include "ash/public/cpp/shelf_types.h" | |
12 #include "base/macros.h" | |
13 #include "ui/views/widget/widget.h" | |
14 | |
15 namespace ash { | |
16 class ImeMenuTray; | |
17 class LogoutButtonTray; | |
18 class OverviewButtonTray; | |
19 class PaletteTray; | |
20 class StatusAreaWidgetDelegate; | |
21 class SystemTray; | |
22 class VirtualKeyboardTray; | |
23 class WebNotificationTray; | |
24 class WmShelf; | |
25 class WmWindow; | |
26 | |
27 class ASH_EXPORT StatusAreaWidget : public views::Widget, | |
28 public ShelfBackgroundAnimatorObserver { | |
29 public: | |
30 StatusAreaWidget(WmWindow* status_container, WmShelf* wm_shelf); | |
31 ~StatusAreaWidget() override; | |
32 | |
33 // Creates the SystemTray, WebNotificationTray and LogoutButtonTray. | |
34 void CreateTrayViews(); | |
35 | |
36 // Destroys the system tray and web notification tray. Called before | |
37 // tearing down the windows to avoid shutdown ordering issues. | |
38 void Shutdown(); | |
39 | |
40 // Update the alignment of the widget and tray views. | |
41 void SetShelfAlignment(ShelfAlignment alignment); | |
42 | |
43 // Called by the client when the login status changes. Caches login_status | |
44 // and calls UpdateAfterLoginStatusChange for the system tray and the web | |
45 // notification tray. | |
46 void UpdateAfterLoginStatusChange(LoginStatus login_status); | |
47 | |
48 StatusAreaWidgetDelegate* status_area_widget_delegate() { | |
49 return status_area_widget_delegate_; | |
50 } | |
51 SystemTray* system_tray() { return system_tray_; } | |
52 WebNotificationTray* web_notification_tray() { | |
53 return web_notification_tray_; | |
54 } | |
55 OverviewButtonTray* overview_button_tray() { return overview_button_tray_; } | |
56 | |
57 PaletteTray* palette_tray() { return palette_tray_; } | |
58 | |
59 ImeMenuTray* ime_menu_tray() { return ime_menu_tray_; } | |
60 | |
61 WmShelf* wm_shelf() { return wm_shelf_; } | |
62 | |
63 LoginStatus login_status() const { return login_status_; } | |
64 | |
65 // Returns true if the shelf should be visible. This is used when the | |
66 // shelf is configured to auto-hide and test if the shelf should force | |
67 // the shelf to remain visible. | |
68 bool ShouldShowShelf() const; | |
69 | |
70 // True if any message bubble is shown. | |
71 bool IsMessageBubbleShown() const; | |
72 | |
73 // Notifies child trays, and the |status_area_widget_delegate_| to schedule a | |
74 // paint. | |
75 void SchedulePaint(); | |
76 | |
77 // Overridden from views::Widget: | |
78 const ui::NativeTheme* GetNativeTheme() const override; | |
79 void OnNativeWidgetActivationChanged(bool active) override; | |
80 | |
81 // ShelfBackgroundAnimatorObserver: | |
82 void UpdateShelfItemBackground(SkColor color) override; | |
83 | |
84 private: | |
85 void AddSystemTray(); | |
86 void AddWebNotificationTray(); | |
87 void AddLogoutButtonTray(); | |
88 void AddPaletteTray(); | |
89 void AddVirtualKeyboardTray(); | |
90 void AddImeMenuTray(); | |
91 void AddOverviewButtonTray(); | |
92 | |
93 // Weak pointers to View classes that are parented to StatusAreaWidget: | |
94 StatusAreaWidgetDelegate* status_area_widget_delegate_; | |
95 OverviewButtonTray* overview_button_tray_; | |
96 SystemTray* system_tray_; | |
97 WebNotificationTray* web_notification_tray_; | |
98 LogoutButtonTray* logout_button_tray_; | |
99 PaletteTray* palette_tray_; | |
100 VirtualKeyboardTray* virtual_keyboard_tray_; | |
101 ImeMenuTray* ime_menu_tray_; | |
102 LoginStatus login_status_; | |
103 | |
104 WmShelf* wm_shelf_; | |
105 | |
106 DISALLOW_COPY_AND_ASSIGN(StatusAreaWidget); | |
107 }; | |
108 | |
109 } // namespace ash | |
110 | |
111 #endif // ASH_COMMON_SYSTEM_STATUS_AREA_WIDGET_H_ | |
OLD | NEW |