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/common/system/status_area_widget.h" | 5 #include "ash/common/system/status_area_widget.h" |
6 | 6 |
7 #include "ash/common/material_design/material_design_controller.h" | 7 #include "ash/common/material_design/material_design_controller.h" |
8 #include "ash/common/shelf/wm_shelf.h" | 8 #include "ash/common/shelf/wm_shelf.h" |
9 #include "ash/common/shell_window_ids.h" | 9 #include "ash/common/shell_window_ids.h" |
10 #include "ash/common/system/overview/overview_button_tray.h" | 10 #include "ash/common/system/overview/overview_button_tray.h" |
11 #include "ash/common/system/status_area_widget_delegate.h" | 11 #include "ash/common/system/status_area_widget_delegate.h" |
12 #include "ash/common/system/tray/system_tray.h" | 12 #include "ash/common/system/tray/system_tray.h" |
13 #include "ash/common/system/tray/system_tray_delegate.h" | 13 #include "ash/common/system/tray/system_tray_delegate.h" |
14 #include "ash/common/system/web_notification/web_notification_tray.h" | 14 #include "ash/common/system/web_notification/web_notification_tray.h" |
15 #include "ash/common/wm_lookup.h" | 15 #include "ash/common/wm_lookup.h" |
16 #include "ash/common/wm_root_window_controller.h" | 16 #include "ash/common/wm_root_window_controller.h" |
17 #include "ash/common/wm_shell.h" | 17 #include "ash/common/wm_shell.h" |
18 #include "ash/common/wm_window.h" | 18 #include "ash/common/wm_window.h" |
19 #include "base/i18n/time_formatting.h" | 19 #include "base/i18n/time_formatting.h" |
20 #include "ui/native_theme/native_theme_dark_aura.h" | 20 #include "ui/native_theme/native_theme_dark_aura.h" |
21 | 21 |
22 #if defined(OS_CHROMEOS) | 22 #if defined(OS_CHROMEOS) |
23 #include "ash/common/system/chromeos/ime_menu/ime_menu_tray.h" | 23 #include "ash/common/system/chromeos/ime_menu/ime_menu_tray.h" |
24 #include "ash/common/system/chromeos/palette/palette_tray.h" | 24 #include "ash/common/system/chromeos/palette/palette_tray.h" |
25 #include "ash/common/system/chromeos/palette/palette_utils.h" | 25 #include "ash/common/system/chromeos/palette/palette_utils.h" |
26 #include "ash/common/system/chromeos/session/logout_button_tray.h" | 26 #include "ash/common/system/chromeos/session/logout_button_tray.h" |
27 #include "ash/common/system/chromeos/virtual_keyboard/virtual_keyboard_tray.h" | 27 #include "ash/common/system/chromeos/virtual_keyboard/virtual_keyboard_tray.h" |
| 28 #include "ui/display/display.h" |
28 #endif | 29 #endif |
29 | 30 |
30 namespace ash { | 31 namespace ash { |
31 | 32 |
32 StatusAreaWidget::StatusAreaWidget(WmWindow* status_container, | 33 StatusAreaWidget::StatusAreaWidget(WmWindow* status_container, |
33 WmShelf* wm_shelf) | 34 WmShelf* wm_shelf) |
34 : status_area_widget_delegate_(new StatusAreaWidgetDelegate), | 35 : status_area_widget_delegate_(new StatusAreaWidgetDelegate), |
35 overview_button_tray_(nullptr), | 36 overview_button_tray_(nullptr), |
36 system_tray_(nullptr), | 37 system_tray_(nullptr), |
37 web_notification_tray_(nullptr), | 38 web_notification_tray_(nullptr), |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 status_area_widget_delegate_->AddTray(web_notification_tray_); | 245 status_area_widget_delegate_->AddTray(web_notification_tray_); |
245 } | 246 } |
246 | 247 |
247 #if defined(OS_CHROMEOS) | 248 #if defined(OS_CHROMEOS) |
248 void StatusAreaWidget::AddLogoutButtonTray() { | 249 void StatusAreaWidget::AddLogoutButtonTray() { |
249 logout_button_tray_ = new LogoutButtonTray(wm_shelf_); | 250 logout_button_tray_ = new LogoutButtonTray(wm_shelf_); |
250 status_area_widget_delegate_->AddTray(logout_button_tray_); | 251 status_area_widget_delegate_->AddTray(logout_button_tray_); |
251 } | 252 } |
252 | 253 |
253 void StatusAreaWidget::AddPaletteTray() { | 254 void StatusAreaWidget::AddPaletteTray() { |
254 if (IsPaletteFeatureEnabled()) { | 255 if (!IsPaletteFeatureEnabled()) |
| 256 return; |
| 257 |
| 258 const display::Display& display = |
| 259 WmLookup::Get()->GetWindowForWidget(this)->GetDisplayNearestWindow(); |
| 260 |
| 261 // Create the palette only on the internal display, where the stylus is |
| 262 // available. We also create a palette on every display if requested from the |
| 263 // command line. |
| 264 if (display.IsInternal() || IsPaletteEnabledOnEveryDisplay()) { |
255 palette_tray_ = new PaletteTray(wm_shelf_); | 265 palette_tray_ = new PaletteTray(wm_shelf_); |
256 status_area_widget_delegate_->AddTray(palette_tray_); | 266 status_area_widget_delegate_->AddTray(palette_tray_); |
257 } | 267 } |
258 } | 268 } |
259 | 269 |
260 void StatusAreaWidget::AddVirtualKeyboardTray() { | 270 void StatusAreaWidget::AddVirtualKeyboardTray() { |
261 virtual_keyboard_tray_ = new VirtualKeyboardTray(wm_shelf_); | 271 virtual_keyboard_tray_ = new VirtualKeyboardTray(wm_shelf_); |
262 status_area_widget_delegate_->AddTray(virtual_keyboard_tray_); | 272 status_area_widget_delegate_->AddTray(virtual_keyboard_tray_); |
263 } | 273 } |
264 | 274 |
(...skipping 19 matching lines...) Expand all Loading... |
284 return false; | 294 return false; |
285 } | 295 } |
286 #endif | 296 #endif |
287 | 297 |
288 void StatusAreaWidget::AddOverviewButtonTray() { | 298 void StatusAreaWidget::AddOverviewButtonTray() { |
289 overview_button_tray_ = new OverviewButtonTray(wm_shelf_); | 299 overview_button_tray_ = new OverviewButtonTray(wm_shelf_); |
290 status_area_widget_delegate_->AddTray(overview_button_tray_); | 300 status_area_widget_delegate_->AddTray(overview_button_tray_); |
291 } | 301 } |
292 | 302 |
293 } // namespace ash | 303 } // namespace ash |
OLD | NEW |