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/shell_window_ids.h" | 8 #include "ash/public/cpp/shell_window_ids.h" |
8 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
9 #include "ash/shelf/wm_shelf.h" | 10 #include "ash/shelf/wm_shelf.h" |
10 #include "ash/shell.h" | 11 #include "ash/shell.h" |
11 #include "ash/system/ime_menu/ime_menu_tray.h" | 12 #include "ash/system/ime_menu/ime_menu_tray.h" |
12 #include "ash/system/overview/overview_button_tray.h" | 13 #include "ash/system/overview/overview_button_tray.h" |
13 #include "ash/system/palette/palette_tray.h" | 14 #include "ash/system/palette/palette_tray.h" |
14 #include "ash/system/palette/palette_utils.h" | 15 #include "ash/system/palette/palette_utils.h" |
15 #include "ash/system/session/logout_button_tray.h" | 16 #include "ash/system/session/logout_button_tray.h" |
16 #include "ash/system/status_area_widget_delegate.h" | 17 #include "ash/system/status_area_widget_delegate.h" |
17 #include "ash/system/tray/system_tray.h" | 18 #include "ash/system/tray/system_tray.h" |
18 #include "ash/system/tray/system_tray_delegate.h" | 19 #include "ash/system/tray/system_tray_delegate.h" |
19 #include "ash/system/virtual_keyboard/virtual_keyboard_tray.h" | 20 #include "ash/system/virtual_keyboard/virtual_keyboard_tray.h" |
20 #include "ash/system/web_notification/web_notification_tray.h" | 21 #include "ash/system/web_notification/web_notification_tray.h" |
21 #include "ash/wm_window.h" | 22 #include "ash/wm_window.h" |
22 #include "base/i18n/time_formatting.h" | 23 #include "base/i18n/time_formatting.h" |
23 #include "ui/display/display.h" | 24 #include "ui/display/display.h" |
| 25 #include "ui/events/devices/input_device_manager.h" |
24 #include "ui/native_theme/native_theme_dark_aura.h" | 26 #include "ui/native_theme/native_theme_dark_aura.h" |
25 | 27 |
26 namespace ash { | 28 namespace ash { |
27 | 29 |
28 StatusAreaWidget::StatusAreaWidget(WmWindow* status_container, | 30 StatusAreaWidget::StatusAreaWidget(WmWindow* status_container, |
29 WmShelf* wm_shelf) | 31 WmShelf* wm_shelf) |
30 : status_area_widget_delegate_(new StatusAreaWidgetDelegate(wm_shelf)), | 32 : status_area_widget_delegate_(new StatusAreaWidgetDelegate(wm_shelf)), |
31 overview_button_tray_(nullptr), | 33 overview_button_tray_(nullptr), |
32 system_tray_(nullptr), | 34 system_tray_(nullptr), |
33 web_notification_tray_(nullptr), | 35 web_notification_tray_(nullptr), |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 wm_shelf_, WmWindow::Get(this->GetNativeWindow()), system_tray_); | 191 wm_shelf_, WmWindow::Get(this->GetNativeWindow()), system_tray_); |
190 status_area_widget_delegate_->AddTray(web_notification_tray_); | 192 status_area_widget_delegate_->AddTray(web_notification_tray_); |
191 } | 193 } |
192 | 194 |
193 void StatusAreaWidget::AddLogoutButtonTray() { | 195 void StatusAreaWidget::AddLogoutButtonTray() { |
194 logout_button_tray_ = new LogoutButtonTray(wm_shelf_); | 196 logout_button_tray_ = new LogoutButtonTray(wm_shelf_); |
195 status_area_widget_delegate_->AddTray(logout_button_tray_); | 197 status_area_widget_delegate_->AddTray(logout_button_tray_); |
196 } | 198 } |
197 | 199 |
198 void StatusAreaWidget::AddPaletteTray() { | 200 void StatusAreaWidget::AddPaletteTray() { |
199 const display::Display& display = | 201 palette_tray_ = new PaletteTray(wm_shelf_); |
200 WmWindow::Get(this->GetNativeWindow())->GetDisplayNearestWindow(); | 202 status_area_widget_delegate_->AddTray(palette_tray_); |
201 | |
202 // Create the palette only on the internal display, where the stylus is | |
203 // available. We also create a palette on every display if requested from the | |
204 // command line. | |
205 if (display.IsInternal() || palette_utils::IsPaletteEnabledOnEveryDisplay()) { | |
206 palette_tray_ = new PaletteTray(wm_shelf_); | |
207 status_area_widget_delegate_->AddTray(palette_tray_); | |
208 } | |
209 } | 203 } |
210 | 204 |
211 void StatusAreaWidget::AddVirtualKeyboardTray() { | 205 void StatusAreaWidget::AddVirtualKeyboardTray() { |
212 virtual_keyboard_tray_ = new VirtualKeyboardTray(wm_shelf_); | 206 virtual_keyboard_tray_ = new VirtualKeyboardTray(wm_shelf_); |
213 status_area_widget_delegate_->AddTray(virtual_keyboard_tray_); | 207 status_area_widget_delegate_->AddTray(virtual_keyboard_tray_); |
214 } | 208 } |
215 | 209 |
216 void StatusAreaWidget::AddImeMenuTray() { | 210 void StatusAreaWidget::AddImeMenuTray() { |
217 ime_menu_tray_ = new ImeMenuTray(wm_shelf_); | 211 ime_menu_tray_ = new ImeMenuTray(wm_shelf_); |
218 status_area_widget_delegate_->AddTray(ime_menu_tray_); | 212 status_area_widget_delegate_->AddTray(ime_menu_tray_); |
219 } | 213 } |
220 | 214 |
221 void StatusAreaWidget::AddOverviewButtonTray() { | 215 void StatusAreaWidget::AddOverviewButtonTray() { |
222 overview_button_tray_ = new OverviewButtonTray(wm_shelf_); | 216 overview_button_tray_ = new OverviewButtonTray(wm_shelf_); |
223 status_area_widget_delegate_->AddTray(overview_button_tray_); | 217 status_area_widget_delegate_->AddTray(overview_button_tray_); |
224 } | 218 } |
225 | 219 |
226 } // namespace ash | 220 } // namespace ash |
OLD | NEW |