| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 // In multi-profile user mode we can have multiple user tiles. | 149 // In multi-profile user mode we can have multiple user tiles. |
| 150 ash::Shell* shell = ash::Shell::GetInstance(); | 150 ash::Shell* shell = ash::Shell::GetInstance(); |
| 151 int maximum_user_profiles = | 151 int maximum_user_profiles = |
| 152 shell->delegate()->IsMultiProfilesEnabled() ? | 152 shell->delegate()->IsMultiProfilesEnabled() ? |
| 153 shell->session_state_delegate()->GetMaximumNumberOfLoggedInUsers() : | 153 shell->session_state_delegate()->GetMaximumNumberOfLoggedInUsers() : |
| 154 0; | 154 0; |
| 155 // Note: We purposely use one more item then logged in users to account for | 155 // Note: We purposely use one more item then logged in users to account for |
| 156 // the additional separator. | 156 // the additional separator. |
| 157 for (int i = 0; i <= maximum_user_profiles; i++) | 157 for (int i = 0; i <= maximum_user_profiles; i++) |
| 158 AddTrayItem(new internal::TrayUser(this, i)); | 158 AddTrayItem(new internal::TrayUser(this, i)); |
| 159 #endif |
| 159 | 160 |
| 160 #endif | 161 tray_accessibility_ = new internal::TrayAccessibility(this); |
| 162 |
| 161 #if defined(OS_CHROMEOS) | 163 #if defined(OS_CHROMEOS) |
| 162 AddTrayItem(new internal::TrayEnterprise(this)); | 164 AddTrayItem(new internal::TrayEnterprise(this)); |
| 163 AddTrayItem(new internal::TrayLocallyManagedUser(this)); | 165 AddTrayItem(new internal::TrayLocallyManagedUser(this)); |
| 164 #endif | |
| 165 AddTrayItem(new internal::TrayIME(this)); | 166 AddTrayItem(new internal::TrayIME(this)); |
| 166 tray_accessibility_ = new internal::TrayAccessibility(this); | |
| 167 AddTrayItem(tray_accessibility_); | 167 AddTrayItem(tray_accessibility_); |
| 168 #if defined(OS_CHROMEOS) | |
| 169 AddTrayItem(new internal::TrayTracing(this)); | 168 AddTrayItem(new internal::TrayTracing(this)); |
| 170 AddTrayItem( | 169 AddTrayItem( |
| 171 new internal::TrayPower(this, message_center::MessageCenter::Get())); | 170 new internal::TrayPower(this, message_center::MessageCenter::Get())); |
| 172 #endif | |
| 173 #if defined(OS_CHROMEOS) | |
| 174 AddTrayItem(new internal::TrayNetwork(this)); | 171 AddTrayItem(new internal::TrayNetwork(this)); |
| 175 AddTrayItem(new internal::TrayVPN(this)); | 172 AddTrayItem(new internal::TrayVPN(this)); |
| 176 AddTrayItem(new internal::TraySms(this)); | 173 AddTrayItem(new internal::TraySms(this)); |
| 177 #endif | |
| 178 #if !defined(OS_WIN) | |
| 179 AddTrayItem(new internal::TrayBluetooth(this)); | 174 AddTrayItem(new internal::TrayBluetooth(this)); |
| 180 #endif | |
| 181 AddTrayItem(new internal::TrayDrive(this)); | 175 AddTrayItem(new internal::TrayDrive(this)); |
| 182 #if defined(OS_CHROMEOS) | |
| 183 AddTrayItem(new internal::TrayDisplay(this)); | 176 AddTrayItem(new internal::TrayDisplay(this)); |
| 184 AddTrayItem(new internal::ScreenCaptureTrayItem(this)); | 177 AddTrayItem(new internal::ScreenCaptureTrayItem(this)); |
| 185 AddTrayItem(new internal::ScreenShareTrayItem(this)); | 178 AddTrayItem(new internal::ScreenShareTrayItem(this)); |
| 186 AddTrayItem(new internal::TrayAudio(this)); | 179 AddTrayItem(new internal::TrayAudio(this)); |
| 187 AddTrayItem(new internal::TrayBrightness(this)); | 180 AddTrayItem(new internal::TrayBrightness(this)); |
| 188 #endif | |
| 189 #if !defined(OS_WIN) | |
| 190 AddTrayItem(new internal::TrayCapsLock(this)); | 181 AddTrayItem(new internal::TrayCapsLock(this)); |
| 191 #endif | |
| 192 #if defined(OS_CHROMEOS) | |
| 193 AddTrayItem(new internal::TraySettings(this)); | 182 AddTrayItem(new internal::TraySettings(this)); |
| 194 #endif | |
| 195 AddTrayItem(new internal::TrayUpdate(this)); | 183 AddTrayItem(new internal::TrayUpdate(this)); |
| 196 AddTrayItem(new internal::TrayDate(this)); | 184 AddTrayItem(new internal::TrayDate(this)); |
| 185 #elif defined(OS_WIN) |
| 186 AddTrayItem(tray_accessibility_); |
| 187 AddTrayItem(new internal::TrayDate(this)); |
| 188 #elif defined(OS_LINUX) |
| 189 AddTrayItem(new internal::TrayIME(this)); |
| 190 AddTrayItem(tray_accessibility_); |
| 191 AddTrayItem(new internal::TrayBluetooth(this)); |
| 192 AddTrayItem(new internal::TrayDrive(this)); |
| 193 AddTrayItem(new internal::TrayCapsLock(this)); |
| 194 AddTrayItem(new internal::TrayUpdate(this)); |
| 195 AddTrayItem(new internal::TrayDate(this)); |
| 196 #endif |
| 197 | 197 |
| 198 #if defined(OS_LINUX) | 198 #if defined(OS_LINUX) |
| 199 // Add memory monitor if enabled. | |
| 200 CommandLine* cmd = CommandLine::ForCurrentProcess(); | 199 CommandLine* cmd = CommandLine::ForCurrentProcess(); |
| 201 if (cmd->HasSwitch(ash::switches::kAshEnableMemoryMonitor)) | 200 if (cmd->HasSwitch(ash::switches::kAshEnableMemoryMonitor)) |
| 202 AddTrayItem(new internal::TrayMonitor(this)); | 201 AddTrayItem(new internal::TrayMonitor(this)); |
| 203 #endif | 202 #endif |
| 204 | 203 |
| 205 SetVisible(ash::Shell::GetInstance()->system_tray_delegate()-> | 204 SetVisible(ash::Shell::GetInstance()->system_tray_delegate()-> |
| 206 GetTrayVisibilityOnStartup()); | 205 GetTrayVisibilityOnStartup()); |
| 207 } | 206 } |
| 208 | 207 |
| 209 void SystemTray::AddTrayItem(SystemTrayItem* item) { | 208 void SystemTray::AddTrayItem(SystemTrayItem* item) { |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 system_bubble_.reset(); | 660 system_bubble_.reset(); |
| 662 // When closing a system bubble with the alternate shelf layout, we need to | 661 // When closing a system bubble with the alternate shelf layout, we need to |
| 663 // turn off the active tinting of the shelf. | 662 // turn off the active tinting of the shelf. |
| 664 if (full_system_tray_menu_) { | 663 if (full_system_tray_menu_) { |
| 665 SetDrawBackgroundAsActive(false); | 664 SetDrawBackgroundAsActive(false); |
| 666 full_system_tray_menu_ = false; | 665 full_system_tray_menu_ = false; |
| 667 } | 666 } |
| 668 } | 667 } |
| 669 | 668 |
| 670 } // namespace ash | 669 } // namespace ash |
| OLD | NEW |