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/system/tray/system_tray.h" | 5 #include "ash/system/tray/system_tray.h" |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/shelf/shelf_layout_manager.h" | 8 #include "ash/shelf/shelf_layout_manager.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/shell/panel_window.h" | 10 #include "ash/shell/panel_window.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 131 |
132 void SystemTray::InitializeTrayItems(SystemTrayDelegate* delegate) { | 132 void SystemTray::InitializeTrayItems(SystemTrayDelegate* delegate) { |
133 internal::TrayBackgroundView::Initialize(); | 133 internal::TrayBackgroundView::Initialize(); |
134 CreateItems(delegate); | 134 CreateItems(delegate); |
135 } | 135 } |
136 | 136 |
137 void SystemTray::CreateItems(SystemTrayDelegate* delegate) { | 137 void SystemTray::CreateItems(SystemTrayDelegate* delegate) { |
138 #if !defined(OS_WIN) | 138 #if !defined(OS_WIN) |
139 AddTrayItem(new internal::TraySessionLengthLimit(this)); | 139 AddTrayItem(new internal::TraySessionLengthLimit(this)); |
140 AddTrayItem(new internal::TrayLogoutButton(this)); | 140 AddTrayItem(new internal::TrayLogoutButton(this)); |
141 AddTrayItem(new internal::TrayUser(this)); | 141 // In multi-profile user mode we can have multiple user tiles. |
| 142 ash::Shell* shell = ash::Shell::GetInstance(); |
| 143 int maximum_user_profiles = |
| 144 shell->delegate()->IsMultiProfilesEnabled() ? |
| 145 shell->session_state_delegate()->GetMaximumNumberOfLoggedInUsers() : |
| 146 0; |
| 147 // Note: We purposely use one more item then logged in users to account for |
| 148 // the additional separator. |
| 149 for (int i = 0; i <= maximum_user_profiles; i++) |
| 150 AddTrayItem(new internal::TrayUser(this, i)); |
| 151 |
142 #endif | 152 #endif |
143 #if defined(OS_CHROMEOS) | 153 #if defined(OS_CHROMEOS) |
144 AddTrayItem(new internal::TrayEnterprise(this)); | 154 AddTrayItem(new internal::TrayEnterprise(this)); |
145 AddTrayItem(new internal::TrayLocallyManagedUser(this)); | 155 AddTrayItem(new internal::TrayLocallyManagedUser(this)); |
146 #endif | 156 #endif |
147 AddTrayItem(new internal::TrayIME(this)); | 157 AddTrayItem(new internal::TrayIME(this)); |
148 tray_accessibility_ = new internal::TrayAccessibility(this); | 158 tray_accessibility_ = new internal::TrayAccessibility(this); |
149 AddTrayItem(tray_accessibility_); | 159 AddTrayItem(tray_accessibility_); |
150 #if defined(OS_CHROMEOS) | 160 #if defined(OS_CHROMEOS) |
151 AddTrayItem(new internal::TrayPower(this)); | 161 AddTrayItem(new internal::TrayPower(this)); |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 ConvertPointToWidget(this, &point); | 576 ConvertPointToWidget(this, &point); |
567 arrow_offset = point.x(); | 577 arrow_offset = point.x(); |
568 } | 578 } |
569 } | 579 } |
570 ShowDefaultViewWithOffset(BUBBLE_CREATE_NEW, arrow_offset); | 580 ShowDefaultViewWithOffset(BUBBLE_CREATE_NEW, arrow_offset); |
571 } | 581 } |
572 return true; | 582 return true; |
573 } | 583 } |
574 | 584 |
575 } // namespace ash | 585 } // namespace ash |
OLD | NEW |