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 #include "ash/system/status_area_widget.h" | 5 #include "ash/system/status_area_widget.h" |
6 | 6 |
7 #include "ash/public/cpp/config.h" | 7 #include "ash/public/cpp/config.h" |
8 #include "ash/public/cpp/shell_window_ids.h" | 8 #include "ash/public/cpp/shell_window_ids.h" |
9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
10 #include "ash/session/session_controller.h" | 10 #include "ash/session/session_controller.h" |
11 #include "ash/shelf/wm_shelf.h" | 11 #include "ash/shelf/shelf.h" |
12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
13 #include "ash/system/ime_menu/ime_menu_tray.h" | 13 #include "ash/system/ime_menu/ime_menu_tray.h" |
14 #include "ash/system/lock_screen_action/lock_screen_action_tray.h" | 14 #include "ash/system/lock_screen_action/lock_screen_action_tray.h" |
15 #include "ash/system/overview/overview_button_tray.h" | 15 #include "ash/system/overview/overview_button_tray.h" |
16 #include "ash/system/palette/palette_tray.h" | 16 #include "ash/system/palette/palette_tray.h" |
17 #include "ash/system/palette/palette_utils.h" | 17 #include "ash/system/palette/palette_utils.h" |
18 #include "ash/system/session/logout_button_tray.h" | 18 #include "ash/system/session/logout_button_tray.h" |
19 #include "ash/system/status_area_widget_delegate.h" | 19 #include "ash/system/status_area_widget_delegate.h" |
20 #include "ash/system/tray/system_tray.h" | 20 #include "ash/system/tray/system_tray.h" |
21 #include "ash/system/tray/system_tray_delegate.h" | 21 #include "ash/system/tray/system_tray_delegate.h" |
22 #include "ash/system/virtual_keyboard/virtual_keyboard_tray.h" | 22 #include "ash/system/virtual_keyboard/virtual_keyboard_tray.h" |
23 #include "ash/system/web_notification/web_notification_tray.h" | 23 #include "ash/system/web_notification/web_notification_tray.h" |
24 #include "base/i18n/time_formatting.h" | 24 #include "base/i18n/time_formatting.h" |
25 #include "ui/display/display.h" | 25 #include "ui/display/display.h" |
26 #include "ui/events/devices/input_device_manager.h" | 26 #include "ui/events/devices/input_device_manager.h" |
27 #include "ui/native_theme/native_theme_dark_aura.h" | 27 #include "ui/native_theme/native_theme_dark_aura.h" |
28 | 28 |
29 namespace ash { | 29 namespace ash { |
30 | 30 |
31 StatusAreaWidget::StatusAreaWidget(aura::Window* status_container, | 31 StatusAreaWidget::StatusAreaWidget(aura::Window* status_container, Shelf* shelf) |
32 WmShelf* wm_shelf) | 32 : status_area_widget_delegate_(new StatusAreaWidgetDelegate(shelf)), |
33 : status_area_widget_delegate_(new StatusAreaWidgetDelegate(wm_shelf)), | |
34 overview_button_tray_(nullptr), | 33 overview_button_tray_(nullptr), |
35 system_tray_(nullptr), | 34 system_tray_(nullptr), |
36 web_notification_tray_(nullptr), | 35 web_notification_tray_(nullptr), |
37 lock_screen_action_tray_(nullptr), | 36 lock_screen_action_tray_(nullptr), |
38 logout_button_tray_(nullptr), | 37 logout_button_tray_(nullptr), |
39 palette_tray_(nullptr), | 38 palette_tray_(nullptr), |
40 virtual_keyboard_tray_(nullptr), | 39 virtual_keyboard_tray_(nullptr), |
41 ime_menu_tray_(nullptr), | 40 ime_menu_tray_(nullptr), |
42 login_status_(LoginStatus::NOT_LOGGED_IN), | 41 login_status_(LoginStatus::NOT_LOGGED_IN), |
43 wm_shelf_(wm_shelf) { | 42 shelf_(shelf) { |
44 DCHECK(status_container); | 43 DCHECK(status_container); |
45 DCHECK(wm_shelf); | 44 DCHECK(shelf); |
46 views::Widget::InitParams params( | 45 views::Widget::InitParams params( |
47 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 46 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
48 params.delegate = status_area_widget_delegate_; | 47 params.delegate = status_area_widget_delegate_; |
49 params.name = "StatusAreaWidget"; | 48 params.name = "StatusAreaWidget"; |
50 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 49 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
51 RootWindowController::ForWindow(status_container) | 50 RootWindowController::ForWindow(status_container) |
52 ->ConfigureWidgetInitParamsForContainer(this, status_container->id(), | 51 ->ConfigureWidgetInitParamsForContainer(this, status_container->id(), |
53 ¶ms); | 52 ¶ms); |
54 Init(params); | 53 Init(params); |
55 set_focus_on_creation(false); | 54 set_focus_on_creation(false); |
(...skipping 133 matching lines...) Loading... |
189 lock_screen_action_tray_->UpdateShelfItemBackground(color); | 188 lock_screen_action_tray_->UpdateShelfItemBackground(color); |
190 system_tray_->UpdateShelfItemBackground(color); | 189 system_tray_->UpdateShelfItemBackground(color); |
191 virtual_keyboard_tray_->UpdateShelfItemBackground(color); | 190 virtual_keyboard_tray_->UpdateShelfItemBackground(color); |
192 ime_menu_tray_->UpdateShelfItemBackground(color); | 191 ime_menu_tray_->UpdateShelfItemBackground(color); |
193 if (palette_tray_) | 192 if (palette_tray_) |
194 palette_tray_->UpdateShelfItemBackground(color); | 193 palette_tray_->UpdateShelfItemBackground(color); |
195 overview_button_tray_->UpdateShelfItemBackground(color); | 194 overview_button_tray_->UpdateShelfItemBackground(color); |
196 } | 195 } |
197 | 196 |
198 void StatusAreaWidget::AddSystemTray() { | 197 void StatusAreaWidget::AddSystemTray() { |
199 system_tray_ = new SystemTray(wm_shelf_); | 198 system_tray_ = new SystemTray(shelf_); |
200 status_area_widget_delegate_->AddTray(system_tray_); | 199 status_area_widget_delegate_->AddTray(system_tray_); |
201 } | 200 } |
202 | 201 |
203 void StatusAreaWidget::AddWebNotificationTray() { | 202 void StatusAreaWidget::AddWebNotificationTray() { |
204 DCHECK(system_tray_); | 203 DCHECK(system_tray_); |
205 web_notification_tray_ = | 204 web_notification_tray_ = |
206 new WebNotificationTray(wm_shelf_, GetNativeWindow(), system_tray_); | 205 new WebNotificationTray(shelf_, GetNativeWindow(), system_tray_); |
207 status_area_widget_delegate_->AddTray(web_notification_tray_); | 206 status_area_widget_delegate_->AddTray(web_notification_tray_); |
208 } | 207 } |
209 | 208 |
210 void StatusAreaWidget::AddLockScreenActionTray() { | 209 void StatusAreaWidget::AddLockScreenActionTray() { |
211 DCHECK(system_tray_); | 210 DCHECK(system_tray_); |
212 lock_screen_action_tray_ = new LockScreenActionTray(wm_shelf_); | 211 lock_screen_action_tray_ = new LockScreenActionTray(shelf_); |
213 status_area_widget_delegate_->AddTray(lock_screen_action_tray_); | 212 status_area_widget_delegate_->AddTray(lock_screen_action_tray_); |
214 } | 213 } |
215 | 214 |
216 void StatusAreaWidget::AddLogoutButtonTray() { | 215 void StatusAreaWidget::AddLogoutButtonTray() { |
217 logout_button_tray_ = new LogoutButtonTray(wm_shelf_); | 216 logout_button_tray_ = new LogoutButtonTray(shelf_); |
218 status_area_widget_delegate_->AddTray(logout_button_tray_); | 217 status_area_widget_delegate_->AddTray(logout_button_tray_); |
219 } | 218 } |
220 | 219 |
221 void StatusAreaWidget::AddPaletteTray() { | 220 void StatusAreaWidget::AddPaletteTray() { |
222 palette_tray_ = new PaletteTray(wm_shelf_); | 221 palette_tray_ = new PaletteTray(shelf_); |
223 status_area_widget_delegate_->AddTray(palette_tray_); | 222 status_area_widget_delegate_->AddTray(palette_tray_); |
224 } | 223 } |
225 | 224 |
226 void StatusAreaWidget::AddVirtualKeyboardTray() { | 225 void StatusAreaWidget::AddVirtualKeyboardTray() { |
227 virtual_keyboard_tray_ = new VirtualKeyboardTray(wm_shelf_); | 226 virtual_keyboard_tray_ = new VirtualKeyboardTray(shelf_); |
228 status_area_widget_delegate_->AddTray(virtual_keyboard_tray_); | 227 status_area_widget_delegate_->AddTray(virtual_keyboard_tray_); |
229 } | 228 } |
230 | 229 |
231 void StatusAreaWidget::AddImeMenuTray() { | 230 void StatusAreaWidget::AddImeMenuTray() { |
232 ime_menu_tray_ = new ImeMenuTray(wm_shelf_); | 231 ime_menu_tray_ = new ImeMenuTray(shelf_); |
233 status_area_widget_delegate_->AddTray(ime_menu_tray_); | 232 status_area_widget_delegate_->AddTray(ime_menu_tray_); |
234 } | 233 } |
235 | 234 |
236 void StatusAreaWidget::AddOverviewButtonTray() { | 235 void StatusAreaWidget::AddOverviewButtonTray() { |
237 overview_button_tray_ = new OverviewButtonTray(wm_shelf_); | 236 overview_button_tray_ = new OverviewButtonTray(shelf_); |
238 status_area_widget_delegate_->AddTray(overview_button_tray_); | 237 status_area_widget_delegate_->AddTray(overview_button_tray_); |
239 } | 238 } |
240 | 239 |
241 } // namespace ash | 240 } // namespace ash |
OLD | NEW |