Chromium Code Reviews| 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" | |
| 29 #include "ui/display/screen.h" | |
| 28 #endif | 30 #endif |
| 29 | 31 |
| 30 namespace ash { | 32 namespace ash { |
| 31 | 33 |
| 32 StatusAreaWidget::StatusAreaWidget(WmWindow* status_container, | 34 StatusAreaWidget::StatusAreaWidget(WmWindow* status_container, |
| 33 WmShelf* wm_shelf) | 35 WmShelf* wm_shelf) |
| 34 : status_area_widget_delegate_(new StatusAreaWidgetDelegate), | 36 : status_area_widget_delegate_(new StatusAreaWidgetDelegate), |
| 35 overview_button_tray_(nullptr), | 37 overview_button_tray_(nullptr), |
| 36 system_tray_(nullptr), | 38 system_tray_(nullptr), |
| 37 web_notification_tray_(nullptr), | 39 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_); | 246 status_area_widget_delegate_->AddTray(web_notification_tray_); |
| 245 } | 247 } |
| 246 | 248 |
| 247 #if defined(OS_CHROMEOS) | 249 #if defined(OS_CHROMEOS) |
| 248 void StatusAreaWidget::AddLogoutButtonTray() { | 250 void StatusAreaWidget::AddLogoutButtonTray() { |
| 249 logout_button_tray_ = new LogoutButtonTray(wm_shelf_); | 251 logout_button_tray_ = new LogoutButtonTray(wm_shelf_); |
| 250 status_area_widget_delegate_->AddTray(logout_button_tray_); | 252 status_area_widget_delegate_->AddTray(logout_button_tray_); |
| 251 } | 253 } |
| 252 | 254 |
| 253 void StatusAreaWidget::AddPaletteTray() { | 255 void StatusAreaWidget::AddPaletteTray() { |
| 254 if (IsPaletteFeatureEnabled()) { | 256 if (!IsPaletteFeatureEnabled()) |
| 257 return; | |
| 258 | |
| 259 const display::Display& display = | |
| 260 display::Screen::GetScreen()->GetDisplayNearestWindow(GetNativeWindow()); | |
|
James Cook
2016/09/01 17:00:55
Use WmLookup::Get()->GetWindowForWidget(this)->Get
jdufault
2016/09/02 20:12:37
Done.
| |
| 261 | |
| 262 // Create the palette only on the internal display, where the stylus is | |
| 263 // available. We also create a palette on every display if requested from the | |
| 264 // command line. | |
| 265 if (display.IsInternal() || IsPaletteEnabledOnEveryDisplay()) { | |
| 255 palette_tray_ = new PaletteTray(wm_shelf_); | 266 palette_tray_ = new PaletteTray(wm_shelf_); |
| 256 status_area_widget_delegate_->AddTray(palette_tray_); | 267 status_area_widget_delegate_->AddTray(palette_tray_); |
| 257 } | 268 } |
| 258 } | 269 } |
| 259 | 270 |
| 260 void StatusAreaWidget::AddVirtualKeyboardTray() { | 271 void StatusAreaWidget::AddVirtualKeyboardTray() { |
| 261 virtual_keyboard_tray_ = new VirtualKeyboardTray(wm_shelf_); | 272 virtual_keyboard_tray_ = new VirtualKeyboardTray(wm_shelf_); |
| 262 status_area_widget_delegate_->AddTray(virtual_keyboard_tray_); | 273 status_area_widget_delegate_->AddTray(virtual_keyboard_tray_); |
| 263 } | 274 } |
| 264 | 275 |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 284 return false; | 295 return false; |
| 285 } | 296 } |
| 286 #endif | 297 #endif |
| 287 | 298 |
| 288 void StatusAreaWidget::AddOverviewButtonTray() { | 299 void StatusAreaWidget::AddOverviewButtonTray() { |
| 289 overview_button_tray_ = new OverviewButtonTray(wm_shelf_); | 300 overview_button_tray_ = new OverviewButtonTray(wm_shelf_); |
| 290 status_area_widget_delegate_->AddTray(overview_button_tray_); | 301 status_area_widget_delegate_->AddTray(overview_button_tray_); |
| 291 } | 302 } |
| 292 | 303 |
| 293 } // namespace ash | 304 } // namespace ash |
| OLD | NEW |