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/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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 249 | 249 |
| 250 void SystemTray::Shutdown() { | 250 void SystemTray::Shutdown() { |
| 251 DCHECK(web_notification_tray_); | 251 DCHECK(web_notification_tray_); |
| 252 web_notification_tray_ = nullptr; | 252 web_notification_tray_ = nullptr; |
| 253 } | 253 } |
| 254 | 254 |
| 255 void SystemTray::CreateItems(SystemTrayDelegate* delegate) { | 255 void SystemTray::CreateItems(SystemTrayDelegate* delegate) { |
| 256 const bool use_md = MaterialDesignController::IsSystemTrayMenuMaterial(); | 256 const bool use_md = MaterialDesignController::IsSystemTrayMenuMaterial(); |
| 257 | 257 |
| 258 // Create user items for each possible user. | 258 // Create user items for each possible user. |
| 259 int maximum_user_profiles = WmShell::Get() | 259 int maximum_user_profiles = |
|
James Cook
2017/03/17 17:14:35
nit: const
xiyuan
2017/03/17 22:52:02
Done.
| |
| 260 ->GetSessionStateDelegate() | 260 WmShell::Get()->session_controller()->GetMaximumNumberOfLoggedInUsers(); |
| 261 ->GetMaximumNumberOfLoggedInUsers(); | |
| 262 for (int i = 0; i < maximum_user_profiles; i++) | 261 for (int i = 0; i < maximum_user_profiles; i++) |
| 263 AddTrayItem(base::MakeUnique<TrayUser>(this, i)); | 262 AddTrayItem(base::MakeUnique<TrayUser>(this, i)); |
| 264 | 263 |
| 265 // Crucially, this trailing padding has to be inside the user item(s). | 264 // Crucially, this trailing padding has to be inside the user item(s). |
| 266 // Otherwise it could be a main axis margin on the tray's box layout. | 265 // Otherwise it could be a main axis margin on the tray's box layout. |
| 267 AddTrayItem(base::MakeUnique<PaddingTrayItem>()); | 266 AddTrayItem(base::MakeUnique<PaddingTrayItem>()); |
| 268 | 267 |
| 269 tray_accessibility_ = new TrayAccessibility(this); | 268 tray_accessibility_ = new TrayAccessibility(this); |
| 270 if (!use_md) | 269 if (!use_md) |
| 271 tray_date_ = new TrayDate(this); | 270 tray_date_ = new TrayDate(this); |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 771 .work_area() | 770 .work_area() |
| 772 .height(); | 771 .height(); |
| 773 if (work_area_height > 0) { | 772 if (work_area_height > 0) { |
| 774 UMA_HISTOGRAM_CUSTOM_COUNTS( | 773 UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 775 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu", | 774 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu", |
| 776 100 * bubble_view->height() / work_area_height, 1, 300, 100); | 775 100 * bubble_view->height() / work_area_height, 1, 300, 100); |
| 777 } | 776 } |
| 778 } | 777 } |
| 779 | 778 |
| 780 } // namespace ash | 779 } // namespace ash |
| OLD | NEW |