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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 #include "ash/system/chromeos/power/tray_power.h" | 56 #include "ash/system/chromeos/power/tray_power.h" |
57 #include "ash/system/chromeos/screen_capture/tray_screen_capture.h" | 57 #include "ash/system/chromeos/screen_capture/tray_screen_capture.h" |
58 #include "ash/system/chromeos/settings/tray_settings.h" | 58 #include "ash/system/chromeos/settings/tray_settings.h" |
59 #include "ash/system/chromeos/tray_display.h" | 59 #include "ash/system/chromeos/tray_display.h" |
60 #endif | 60 #endif |
61 | 61 |
62 using views::TrayBubbleView; | 62 using views::TrayBubbleView; |
63 | 63 |
64 namespace ash { | 64 namespace ash { |
65 | 65 |
| 66 // The maximum number of simultaneous user profiles. |
| 67 const int kMaxSimultaneousUserProfiles = 3; |
| 68 |
66 // The minimum width of the system tray menu width. | 69 // The minimum width of the system tray menu width. |
67 const int kMinimumSystemTrayMenuWidth = 300; | 70 const int kMinimumSystemTrayMenuWidth = 300; |
68 | 71 |
69 namespace internal { | 72 namespace internal { |
70 | 73 |
71 // Class to initialize and manage the SystemTrayBubble and TrayBubbleWrapper | 74 // Class to initialize and manage the SystemTrayBubble and TrayBubbleWrapper |
72 // instances for a bubble. | 75 // instances for a bubble. |
73 | 76 |
74 class SystemBubbleWrapper { | 77 class SystemBubbleWrapper { |
75 public: | 78 public: |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 134 |
132 void SystemTray::InitializeTrayItems(SystemTrayDelegate* delegate) { | 135 void SystemTray::InitializeTrayItems(SystemTrayDelegate* delegate) { |
133 internal::TrayBackgroundView::Initialize(); | 136 internal::TrayBackgroundView::Initialize(); |
134 CreateItems(delegate); | 137 CreateItems(delegate); |
135 } | 138 } |
136 | 139 |
137 void SystemTray::CreateItems(SystemTrayDelegate* delegate) { | 140 void SystemTray::CreateItems(SystemTrayDelegate* delegate) { |
138 #if !defined(OS_WIN) | 141 #if !defined(OS_WIN) |
139 AddTrayItem(new internal::TraySessionLengthLimit(this)); | 142 AddTrayItem(new internal::TraySessionLengthLimit(this)); |
140 AddTrayItem(new internal::TrayLogoutButton(this)); | 143 AddTrayItem(new internal::TrayLogoutButton(this)); |
141 AddTrayItem(new internal::TrayUser(this)); | 144 // In multi-profile user mode we can have multiple user tiles. |
| 145 // The additional entry is used for a double separator. |
| 146 int maximum_user_profiles = |
| 147 ash::Shell::GetInstance()->delegate()->IsMultiProfilesEnabled() ? |
| 148 (kMaxSimultaneousUserProfiles + 1): 1; |
| 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 |