| 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 } | 187 } |
| 189 | 188 |
| 190 void StatusAreaWidget::AddSystemTray() { | 189 void StatusAreaWidget::AddSystemTray() { |
| 191 system_tray_ = new SystemTray(wm_shelf_); | 190 system_tray_ = new SystemTray(wm_shelf_); |
| 192 status_area_widget_delegate_->AddTray(system_tray_); | 191 status_area_widget_delegate_->AddTray(system_tray_); |
| 193 } | 192 } |
| 194 | 193 |
| 195 void StatusAreaWidget::AddWebNotificationTray() { | 194 void StatusAreaWidget::AddWebNotificationTray() { |
| 196 DCHECK(system_tray_); | 195 DCHECK(system_tray_); |
| 197 web_notification_tray_ = new WebNotificationTray( | 196 web_notification_tray_ = new WebNotificationTray( |
| 198 wm_shelf_, WmLookup::Get()->GetWindowForWidget(this), system_tray_); | 197 wm_shelf_, WmWindow::Get(this->GetNativeWindow()), system_tray_); |
| 199 status_area_widget_delegate_->AddTray(web_notification_tray_); | 198 status_area_widget_delegate_->AddTray(web_notification_tray_); |
| 200 } | 199 } |
| 201 | 200 |
| 202 void StatusAreaWidget::AddLogoutButtonTray() { | 201 void StatusAreaWidget::AddLogoutButtonTray() { |
| 203 logout_button_tray_ = new LogoutButtonTray(wm_shelf_); | 202 logout_button_tray_ = new LogoutButtonTray(wm_shelf_); |
| 204 status_area_widget_delegate_->AddTray(logout_button_tray_); | 203 status_area_widget_delegate_->AddTray(logout_button_tray_); |
| 205 } | 204 } |
| 206 | 205 |
| 207 void StatusAreaWidget::AddPaletteTray() { | 206 void StatusAreaWidget::AddPaletteTray() { |
| 208 const display::Display& display = | 207 const display::Display& display = |
| 209 WmLookup::Get()->GetWindowForWidget(this)->GetDisplayNearestWindow(); | 208 WmWindow::Get(this->GetNativeWindow())->GetDisplayNearestWindow(); |
| 210 | 209 |
| 211 // Create the palette only on the internal display, where the stylus is | 210 // Create the palette only on the internal display, where the stylus is |
| 212 // available. We also create a palette on every display if requested from the | 211 // available. We also create a palette on every display if requested from the |
| 213 // command line. | 212 // command line. |
| 214 if (display.IsInternal() || palette_utils::IsPaletteEnabledOnEveryDisplay()) { | 213 if (display.IsInternal() || palette_utils::IsPaletteEnabledOnEveryDisplay()) { |
| 215 palette_tray_ = new PaletteTray(wm_shelf_); | 214 palette_tray_ = new PaletteTray(wm_shelf_); |
| 216 status_area_widget_delegate_->AddTray(palette_tray_); | 215 status_area_widget_delegate_->AddTray(palette_tray_); |
| 217 } | 216 } |
| 218 } | 217 } |
| 219 | 218 |
| 220 void StatusAreaWidget::AddVirtualKeyboardTray() { | 219 void StatusAreaWidget::AddVirtualKeyboardTray() { |
| 221 virtual_keyboard_tray_ = new VirtualKeyboardTray(wm_shelf_); | 220 virtual_keyboard_tray_ = new VirtualKeyboardTray(wm_shelf_); |
| 222 status_area_widget_delegate_->AddTray(virtual_keyboard_tray_); | 221 status_area_widget_delegate_->AddTray(virtual_keyboard_tray_); |
| 223 } | 222 } |
| 224 | 223 |
| 225 void StatusAreaWidget::AddImeMenuTray() { | 224 void StatusAreaWidget::AddImeMenuTray() { |
| 226 ime_menu_tray_ = new ImeMenuTray(wm_shelf_); | 225 ime_menu_tray_ = new ImeMenuTray(wm_shelf_); |
| 227 status_area_widget_delegate_->AddTray(ime_menu_tray_); | 226 status_area_widget_delegate_->AddTray(ime_menu_tray_); |
| 228 } | 227 } |
| 229 | 228 |
| 230 void StatusAreaWidget::AddOverviewButtonTray() { | 229 void StatusAreaWidget::AddOverviewButtonTray() { |
| 231 overview_button_tray_ = new OverviewButtonTray(wm_shelf_); | 230 overview_button_tray_ = new OverviewButtonTray(wm_shelf_); |
| 232 status_area_widget_delegate_->AddTray(overview_button_tray_); | 231 status_area_widget_delegate_->AddTray(overview_button_tray_); |
| 233 } | 232 } |
| 234 | 233 |
| 235 } // namespace ash | 234 } // namespace ash |
| OLD | NEW |