| 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/tray/system_tray.h" | 5 #include "ash/common/system/tray/system_tray.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "ash/common/key_event_watcher.h" | 11 #include "ash/common/key_event_watcher.h" |
| 12 #include "ash/common/login_status.h" | 12 #include "ash/common/login_status.h" |
| 13 #include "ash/common/material_design/material_design_controller.h" | 13 #include "ash/common/material_design/material_design_controller.h" |
| 14 #include "ash/common/session/session_state_delegate.h" | 14 #include "ash/common/session/session_controller.h" |
| 15 #include "ash/common/shelf/wm_shelf.h" | 15 #include "ash/common/shelf/wm_shelf.h" |
| 16 #include "ash/common/shelf/wm_shelf_util.h" | 16 #include "ash/common/shelf/wm_shelf_util.h" |
| 17 #include "ash/common/system/chromeos/audio/tray_audio.h" | 17 #include "ash/common/system/chromeos/audio/tray_audio.h" |
| 18 #include "ash/common/system/chromeos/bluetooth/tray_bluetooth.h" | 18 #include "ash/common/system/chromeos/bluetooth/tray_bluetooth.h" |
| 19 #include "ash/common/system/chromeos/brightness/tray_brightness.h" | 19 #include "ash/common/system/chromeos/brightness/tray_brightness.h" |
| 20 #include "ash/common/system/chromeos/cast/tray_cast.h" | 20 #include "ash/common/system/chromeos/cast/tray_cast.h" |
| 21 #include "ash/common/system/chromeos/enterprise/tray_enterprise.h" | 21 #include "ash/common/system/chromeos/enterprise/tray_enterprise.h" |
| 22 #include "ash/common/system/chromeos/media_security/multi_profile_media_tray_ite
m.h" | 22 #include "ash/common/system/chromeos/media_security/multi_profile_media_tray_ite
m.h" |
| 23 #include "ash/common/system/chromeos/network/tray_network.h" | 23 #include "ash/common/system/chromeos/network/tray_network.h" |
| 24 #include "ash/common/system/chromeos/network/tray_vpn.h" | 24 #include "ash/common/system/chromeos/network/tray_vpn.h" |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 | 259 |
| 260 void SystemTray::Shutdown() { | 260 void SystemTray::Shutdown() { |
| 261 DCHECK(web_notification_tray_); | 261 DCHECK(web_notification_tray_); |
| 262 web_notification_tray_ = nullptr; | 262 web_notification_tray_ = nullptr; |
| 263 } | 263 } |
| 264 | 264 |
| 265 void SystemTray::CreateItems(SystemTrayDelegate* delegate) { | 265 void SystemTray::CreateItems(SystemTrayDelegate* delegate) { |
| 266 const bool use_md = MaterialDesignController::IsSystemTrayMenuMaterial(); | 266 const bool use_md = MaterialDesignController::IsSystemTrayMenuMaterial(); |
| 267 | 267 |
| 268 // Create user items for each possible user. | 268 // Create user items for each possible user. |
| 269 int maximum_user_profiles = WmShell::Get() | 269 const int maximum_user_profiles = |
| 270 ->GetSessionStateDelegate() | 270 WmShell::Get()->session_controller()->GetMaximumNumberOfLoggedInUsers(); |
| 271 ->GetMaximumNumberOfLoggedInUsers(); | |
| 272 for (int i = 0; i < maximum_user_profiles; i++) | 271 for (int i = 0; i < maximum_user_profiles; i++) |
| 273 AddTrayItem(base::MakeUnique<TrayUser>(this, i)); | 272 AddTrayItem(base::MakeUnique<TrayUser>(this, i)); |
| 274 | 273 |
| 275 // Crucially, this trailing padding has to be inside the user item(s). | 274 // Crucially, this trailing padding has to be inside the user item(s). |
| 276 // Otherwise it could be a main axis margin on the tray's box layout. | 275 // Otherwise it could be a main axis margin on the tray's box layout. |
| 277 AddTrayItem(base::MakeUnique<PaddingTrayItem>()); | 276 AddTrayItem(base::MakeUnique<PaddingTrayItem>()); |
| 278 | 277 |
| 279 tray_accessibility_ = new TrayAccessibility(this); | 278 tray_accessibility_ = new TrayAccessibility(this); |
| 280 if (!use_md) | 279 if (!use_md) |
| 281 tray_date_ = new TrayDate(this); | 280 tray_date_ = new TrayDate(this); |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 .work_area() | 780 .work_area() |
| 782 .height(); | 781 .height(); |
| 783 if (work_area_height > 0) { | 782 if (work_area_height > 0) { |
| 784 UMA_HISTOGRAM_CUSTOM_COUNTS( | 783 UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 785 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu", | 784 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu", |
| 786 100 * bubble_view->height() / work_area_height, 1, 300, 100); | 785 100 * bubble_view->height() / work_area_height, 1, 300, 100); |
| 787 } | 786 } |
| 788 } | 787 } |
| 789 | 788 |
| 790 } // namespace ash | 789 } // namespace ash |
| OLD | NEW |