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/wm_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 "ash/wm_window.h" | |
25 #include "base/i18n/time_formatting.h" | 24 #include "base/i18n/time_formatting.h" |
26 #include "ui/display/display.h" | 25 #include "ui/display/display.h" |
27 #include "ui/events/devices/input_device_manager.h" | 26 #include "ui/events/devices/input_device_manager.h" |
28 #include "ui/native_theme/native_theme_dark_aura.h" | 27 #include "ui/native_theme/native_theme_dark_aura.h" |
29 | 28 |
30 namespace ash { | 29 namespace ash { |
31 | 30 |
32 StatusAreaWidget::StatusAreaWidget(WmWindow* status_container, | 31 StatusAreaWidget::StatusAreaWidget(aura::Window* status_container, |
33 WmShelf* wm_shelf) | 32 WmShelf* wm_shelf) |
34 : status_area_widget_delegate_(new StatusAreaWidgetDelegate(wm_shelf)), | 33 : status_area_widget_delegate_(new StatusAreaWidgetDelegate(wm_shelf)), |
35 overview_button_tray_(nullptr), | 34 overview_button_tray_(nullptr), |
36 system_tray_(nullptr), | 35 system_tray_(nullptr), |
37 web_notification_tray_(nullptr), | 36 web_notification_tray_(nullptr), |
38 lock_screen_action_tray_(nullptr), | 37 lock_screen_action_tray_(nullptr), |
39 logout_button_tray_(nullptr), | 38 logout_button_tray_(nullptr), |
40 palette_tray_(nullptr), | 39 palette_tray_(nullptr), |
41 virtual_keyboard_tray_(nullptr), | 40 virtual_keyboard_tray_(nullptr), |
42 ime_menu_tray_(nullptr), | 41 ime_menu_tray_(nullptr), |
43 login_status_(LoginStatus::NOT_LOGGED_IN), | 42 login_status_(LoginStatus::NOT_LOGGED_IN), |
44 wm_shelf_(wm_shelf) { | 43 wm_shelf_(wm_shelf) { |
| 44 DCHECK(status_container); |
| 45 DCHECK(wm_shelf); |
45 views::Widget::InitParams params( | 46 views::Widget::InitParams params( |
46 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 47 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
47 params.delegate = status_area_widget_delegate_; | 48 params.delegate = status_area_widget_delegate_; |
48 params.name = "StatusAreaWidget"; | 49 params.name = "StatusAreaWidget"; |
49 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 50 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
50 status_container->GetRootWindowController() | 51 RootWindowController::ForWindow(status_container) |
51 ->ConfigureWidgetInitParamsForContainer( | 52 ->ConfigureWidgetInitParamsForContainer(this, status_container->id(), |
52 this, status_container->aura_window()->id(), ¶ms); | 53 ¶ms); |
53 Init(params); | 54 Init(params); |
54 set_focus_on_creation(false); | 55 set_focus_on_creation(false); |
55 SetContentsView(status_area_widget_delegate_); | 56 SetContentsView(status_area_widget_delegate_); |
56 } | 57 } |
57 | 58 |
58 StatusAreaWidget::~StatusAreaWidget() {} | 59 StatusAreaWidget::~StatusAreaWidget() {} |
59 | 60 |
60 void StatusAreaWidget::CreateTrayViews() { | 61 void StatusAreaWidget::CreateTrayViews() { |
61 AddOverviewButtonTray(); | 62 AddOverviewButtonTray(); |
62 AddSystemTray(); | 63 AddSystemTray(); |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 ime_menu_tray_ = new ImeMenuTray(wm_shelf_); | 232 ime_menu_tray_ = new ImeMenuTray(wm_shelf_); |
232 status_area_widget_delegate_->AddTray(ime_menu_tray_); | 233 status_area_widget_delegate_->AddTray(ime_menu_tray_); |
233 } | 234 } |
234 | 235 |
235 void StatusAreaWidget::AddOverviewButtonTray() { | 236 void StatusAreaWidget::AddOverviewButtonTray() { |
236 overview_button_tray_ = new OverviewButtonTray(wm_shelf_); | 237 overview_button_tray_ = new OverviewButtonTray(wm_shelf_); |
237 status_area_widget_delegate_->AddTray(overview_button_tray_); | 238 status_area_widget_delegate_->AddTray(overview_button_tray_); |
238 } | 239 } |
239 | 240 |
240 } // namespace ash | 241 } // namespace ash |
OLD | NEW |