OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ASH_COMMON_SYSTEM_STATUS_AREA_WIDGET_H_ | 5 #ifndef ASH_COMMON_SYSTEM_STATUS_AREA_WIDGET_H_ |
6 #define ASH_COMMON_SYSTEM_STATUS_AREA_WIDGET_H_ | 6 #define ASH_COMMON_SYSTEM_STATUS_AREA_WIDGET_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/common/login_status.h" | 9 #include "ash/common/login_status.h" |
10 #include "ash/common/shelf/shelf_background_animator_observer.h" | 10 #include "ash/common/shelf/shelf_background_animator_observer.h" |
11 #include "ash/public/cpp/shelf_types.h" | 11 #include "ash/public/cpp/shelf_types.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "ui/views/widget/widget.h" | 13 #include "ui/views/widget/widget.h" |
14 | 14 |
15 namespace ash { | 15 namespace ash { |
16 class OverviewButtonTray; | 16 class OverviewButtonTray; |
17 class StatusAreaWidgetDelegate; | 17 class StatusAreaWidgetDelegate; |
18 class SystemTray; | 18 class SystemTray; |
19 class TrayBackgroundView; | 19 class TrayBackgroundView; |
20 class WebNotificationTray; | 20 class WebNotificationTray; |
21 class WmShelf; | 21 class WmShelf; |
22 class WmWindow; | 22 class WmWindow; |
23 #if defined(OS_CHROMEOS) | 23 #if defined(OS_CHROMEOS) |
24 class ImeMenuTray; | 24 class ImeMenuTray; |
25 class LogoutButtonTray; | 25 class LogoutButtonTray; |
26 class PaletteTray; | 26 class PaletteTray; |
27 class VirtualKeyboardTray; | 27 class VirtualKeyboardTray; |
28 #endif | 28 #endif |
29 | 29 |
| 30 namespace test { |
| 31 class SystemTrayTest; |
| 32 } |
| 33 |
30 class ASH_EXPORT StatusAreaWidget : public views::Widget, | 34 class ASH_EXPORT StatusAreaWidget : public views::Widget, |
31 public ShelfBackgroundAnimatorObserver { | 35 public ShelfBackgroundAnimatorObserver { |
32 public: | 36 public: |
33 StatusAreaWidget(WmWindow* status_container, WmShelf* wm_shelf); | 37 StatusAreaWidget(WmWindow* status_container, WmShelf* wm_shelf); |
34 ~StatusAreaWidget() override; | 38 ~StatusAreaWidget() override; |
35 | 39 |
36 // Creates the SystemTray, WebNotificationTray and LogoutButtonTray. | 40 // Creates the SystemTray, WebNotificationTray and LogoutButtonTray. |
37 void CreateTrayViews(); | 41 void CreateTrayViews(); |
38 | 42 |
39 // Destroys the system tray and web notification tray. Called before | 43 // Destroys the system tray and web notification tray. Called before |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 void SchedulePaint(); | 90 void SchedulePaint(); |
87 | 91 |
88 // Overridden from views::Widget: | 92 // Overridden from views::Widget: |
89 const ui::NativeTheme* GetNativeTheme() const override; | 93 const ui::NativeTheme* GetNativeTheme() const override; |
90 void OnNativeWidgetActivationChanged(bool active) override; | 94 void OnNativeWidgetActivationChanged(bool active) override; |
91 | 95 |
92 // ShelfBackgroundAnimatorObserver: | 96 // ShelfBackgroundAnimatorObserver: |
93 void UpdateShelfItemBackground(int alpha) override; | 97 void UpdateShelfItemBackground(int alpha) override; |
94 | 98 |
95 private: | 99 private: |
| 100 friend class test::SystemTrayTest; |
| 101 |
96 void AddSystemTray(); | 102 void AddSystemTray(); |
97 void AddWebNotificationTray(); | 103 void AddWebNotificationTray(); |
98 #if defined(OS_CHROMEOS) | 104 #if defined(OS_CHROMEOS) |
99 void AddLogoutButtonTray(); | 105 void AddLogoutButtonTray(); |
100 void AddPaletteTray(); | 106 void AddPaletteTray(); |
101 void AddVirtualKeyboardTray(); | 107 void AddVirtualKeyboardTray(); |
102 void AddImeMenuTray(); | 108 void AddImeMenuTray(); |
103 | 109 |
104 // Checks if |tray| is the next visible tray to the left of | 110 // Checks if |tray| is the next visible tray to the left of |
105 // |logout_button_tray_|. Returns true if both are visible, false otherwise. | 111 // |logout_button_tray_|. Returns true if both are visible, false otherwise. |
106 bool IsNextVisibleTrayToLogout(TrayBackgroundView* tray) const; | 112 bool IsNextVisibleTrayToLogout(TrayBackgroundView* tray) const; |
107 #endif | 113 #endif |
108 void AddOverviewButtonTray(); | 114 void AddOverviewButtonTray(); |
109 | 115 |
110 // Weak pointers to View classes that are parented to StatusAreaWidget: | 116 // Weak pointers to View classes that are parented to StatusAreaWidget: |
111 StatusAreaWidgetDelegate* status_area_widget_delegate_; | 117 StatusAreaWidgetDelegate* status_area_widget_delegate_; |
112 OverviewButtonTray* overview_button_tray_; | 118 OverviewButtonTray* overview_button_tray_; |
113 SystemTray* system_tray_; | 119 SystemTray* system_tray_; |
114 WebNotificationTray* web_notification_tray_; | 120 WebNotificationTray* web_notification_tray_; |
115 #if defined(OS_CHROMEOS) | 121 #if defined(OS_CHROMEOS) |
116 LogoutButtonTray* logout_button_tray_; | 122 LogoutButtonTray* logout_button_tray_; |
117 PaletteTray* palette_tray_; | 123 PaletteTray* palette_tray_; |
118 VirtualKeyboardTray* virtual_keyboard_tray_; | 124 VirtualKeyboardTray* virtual_keyboard_tray_; |
119 ImeMenuTray* ime_menu_tray_; | 125 ImeMenuTray* ime_menu_tray_; |
120 #endif | 126 #endif |
121 LoginStatus login_status_; | 127 LoginStatus login_status_; |
122 | 128 |
123 WmShelf* wm_shelf_; | 129 WmShelf* wm_shelf_; |
124 | 130 |
| 131 // Indicates whether all tray items have been successfully initialized. |
| 132 bool is_initialized_; |
| 133 |
125 DISALLOW_COPY_AND_ASSIGN(StatusAreaWidget); | 134 DISALLOW_COPY_AND_ASSIGN(StatusAreaWidget); |
126 }; | 135 }; |
127 | 136 |
128 } // namespace ash | 137 } // namespace ash |
129 | 138 |
130 #endif // ASH_COMMON_SYSTEM_STATUS_AREA_WIDGET_H_ | 139 #endif // ASH_COMMON_SYSTEM_STATUS_AREA_WIDGET_H_ |
OLD | NEW |