| 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/system/chromeos/ime_menu/ime_menu_tray.h" | 9 #include "ash/common/system/chromeos/ime_menu/ime_menu_tray.h" |
| 10 #include "ash/common/system/chromeos/palette/palette_tray.h" | 10 #include "ash/common/system/chromeos/palette/palette_tray.h" |
| 11 #include "ash/common/system/chromeos/palette/palette_utils.h" | 11 #include "ash/common/system/chromeos/palette/palette_utils.h" |
| 12 #include "ash/common/system/chromeos/session/logout_button_tray.h" | 12 #include "ash/common/system/chromeos/session/logout_button_tray.h" |
| 13 #include "ash/common/system/chromeos/virtual_keyboard/virtual_keyboard_tray.h" | 13 #include "ash/common/system/chromeos/virtual_keyboard/virtual_keyboard_tray.h" |
| 14 #include "ash/common/system/overview/overview_button_tray.h" | 14 #include "ash/common/system/overview/overview_button_tray.h" |
| 15 #include "ash/common/system/status_area_widget_delegate.h" | 15 #include "ash/common/system/status_area_widget_delegate.h" |
| 16 #include "ash/common/system/tray/system_tray.h" | 16 #include "ash/common/system/tray/system_tray.h" |
| 17 #include "ash/common/system/tray/system_tray_delegate.h" | 17 #include "ash/common/system/tray/system_tray_delegate.h" |
| 18 #include "ash/common/system/web_notification/web_notification_tray.h" | 18 #include "ash/common/system/web_notification/web_notification_tray.h" |
| 19 #include "ash/common/wm_lookup.h" | |
| 20 #include "ash/common/wm_shell.h" | 19 #include "ash/common/wm_shell.h" |
| 21 #include "ash/common/wm_window.h" | 20 #include "ash/common/wm_window.h" |
| 22 #include "ash/public/cpp/shell_window_ids.h" | 21 #include "ash/public/cpp/shell_window_ids.h" |
| 23 #include "ash/root_window_controller.h" | 22 #include "ash/root_window_controller.h" |
| 24 #include "base/i18n/time_formatting.h" | 23 #include "base/i18n/time_formatting.h" |
| 25 #include "ui/display/display.h" | 24 #include "ui/display/display.h" |
| 26 #include "ui/native_theme/native_theme_dark_aura.h" | 25 #include "ui/native_theme/native_theme_dark_aura.h" |
| 27 | 26 |
| 28 namespace ash { | 27 namespace ash { |
| 29 | 28 |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 } | 192 } |
| 194 | 193 |
| 195 void StatusAreaWidget::AddSystemTray() { | 194 void StatusAreaWidget::AddSystemTray() { |
| 196 system_tray_ = new SystemTray(wm_shelf_); | 195 system_tray_ = new SystemTray(wm_shelf_); |
| 197 status_area_widget_delegate_->AddTray(system_tray_); | 196 status_area_widget_delegate_->AddTray(system_tray_); |
| 198 } | 197 } |
| 199 | 198 |
| 200 void StatusAreaWidget::AddWebNotificationTray() { | 199 void StatusAreaWidget::AddWebNotificationTray() { |
| 201 DCHECK(system_tray_); | 200 DCHECK(system_tray_); |
| 202 web_notification_tray_ = new WebNotificationTray( | 201 web_notification_tray_ = new WebNotificationTray( |
| 203 wm_shelf_, WmLookup::Get()->GetWindowForWidget(this), system_tray_); | 202 wm_shelf_, WmWindow::Get(this->GetNativeWindow()), system_tray_); |
| 204 status_area_widget_delegate_->AddTray(web_notification_tray_); | 203 status_area_widget_delegate_->AddTray(web_notification_tray_); |
| 205 } | 204 } |
| 206 | 205 |
| 207 void StatusAreaWidget::AddLogoutButtonTray() { | 206 void StatusAreaWidget::AddLogoutButtonTray() { |
| 208 logout_button_tray_ = new LogoutButtonTray(wm_shelf_); | 207 logout_button_tray_ = new LogoutButtonTray(wm_shelf_); |
| 209 status_area_widget_delegate_->AddTray(logout_button_tray_); | 208 status_area_widget_delegate_->AddTray(logout_button_tray_); |
| 210 } | 209 } |
| 211 | 210 |
| 212 void StatusAreaWidget::AddPaletteTray() { | 211 void StatusAreaWidget::AddPaletteTray() { |
| 213 const display::Display& display = | 212 const display::Display& display = |
| 214 WmLookup::Get()->GetWindowForWidget(this)->GetDisplayNearestWindow(); | 213 WmWindow::Get(this->GetNativeWindow())->GetDisplayNearestWindow(); |
| 215 | 214 |
| 216 // Create the palette only on the internal display, where the stylus is | 215 // Create the palette only on the internal display, where the stylus is |
| 217 // available. We also create a palette on every display if requested from the | 216 // available. We also create a palette on every display if requested from the |
| 218 // command line. | 217 // command line. |
| 219 if (display.IsInternal() || palette_utils::IsPaletteEnabledOnEveryDisplay()) { | 218 if (display.IsInternal() || palette_utils::IsPaletteEnabledOnEveryDisplay()) { |
| 220 palette_tray_ = new PaletteTray(wm_shelf_); | 219 palette_tray_ = new PaletteTray(wm_shelf_); |
| 221 status_area_widget_delegate_->AddTray(palette_tray_); | 220 status_area_widget_delegate_->AddTray(palette_tray_); |
| 222 } | 221 } |
| 223 } | 222 } |
| 224 | 223 |
| 225 void StatusAreaWidget::AddVirtualKeyboardTray() { | 224 void StatusAreaWidget::AddVirtualKeyboardTray() { |
| 226 virtual_keyboard_tray_ = new VirtualKeyboardTray(wm_shelf_); | 225 virtual_keyboard_tray_ = new VirtualKeyboardTray(wm_shelf_); |
| 227 status_area_widget_delegate_->AddTray(virtual_keyboard_tray_); | 226 status_area_widget_delegate_->AddTray(virtual_keyboard_tray_); |
| 228 } | 227 } |
| 229 | 228 |
| 230 void StatusAreaWidget::AddImeMenuTray() { | 229 void StatusAreaWidget::AddImeMenuTray() { |
| 231 ime_menu_tray_ = new ImeMenuTray(wm_shelf_); | 230 ime_menu_tray_ = new ImeMenuTray(wm_shelf_); |
| 232 status_area_widget_delegate_->AddTray(ime_menu_tray_); | 231 status_area_widget_delegate_->AddTray(ime_menu_tray_); |
| 233 } | 232 } |
| 234 | 233 |
| 235 void StatusAreaWidget::AddOverviewButtonTray() { | 234 void StatusAreaWidget::AddOverviewButtonTray() { |
| 236 overview_button_tray_ = new OverviewButtonTray(wm_shelf_); | 235 overview_button_tray_ = new OverviewButtonTray(wm_shelf_); |
| 237 status_area_widget_delegate_->AddTray(overview_button_tray_); | 236 status_area_widget_delegate_->AddTray(overview_button_tray_); |
| 238 } | 237 } |
| 239 | 238 |
| 240 } // namespace ash | 239 } // namespace ash |
| OLD | NEW |