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/shell.h" | 8 #include "ash/shell.h" |
8 #include "ash/shell/panel_window.h" | 9 #include "ash/shell/panel_window.h" |
9 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
10 #include "ash/system/audio/tray_volume.h" | 11 #include "ash/system/audio/tray_volume.h" |
11 #include "ash/system/bluetooth/tray_bluetooth.h" | 12 #include "ash/system/bluetooth/tray_bluetooth.h" |
12 #include "ash/system/brightness/tray_brightness.h" | 13 #include "ash/system/brightness/tray_brightness.h" |
13 #include "ash/system/chromeos/tray_display.h" | 14 #include "ash/system/chromeos/tray_display.h" |
14 #include "ash/system/date/tray_date.h" | 15 #include "ash/system/date/tray_date.h" |
15 #include "ash/system/drive/tray_drive.h" | 16 #include "ash/system/drive/tray_drive.h" |
16 #include "ash/system/ime/tray_ime.h" | 17 #include "ash/system/ime/tray_ime.h" |
17 #include "ash/system/locale/tray_locale.h" | 18 #include "ash/system/locale/tray_locale.h" |
| 19 #include "ash/system/monitor/tray_monitor.h" |
18 #include "ash/system/power/power_status_observer.h" | 20 #include "ash/system/power/power_status_observer.h" |
19 #include "ash/system/power/power_supply_status.h" | 21 #include "ash/system/power/power_supply_status.h" |
20 #include "ash/system/power/tray_power.h" | 22 #include "ash/system/power/tray_power.h" |
21 #include "ash/system/settings/tray_settings.h" | 23 #include "ash/system/settings/tray_settings.h" |
22 #include "ash/system/status_area_widget.h" | 24 #include "ash/system/status_area_widget.h" |
23 #include "ash/system/tray/system_tray_delegate.h" | 25 #include "ash/system/tray/system_tray_delegate.h" |
24 #include "ash/system/tray/system_tray_item.h" | 26 #include "ash/system/tray/system_tray_item.h" |
25 #include "ash/system/tray/tray_bubble_wrapper.h" | 27 #include "ash/system/tray/tray_bubble_wrapper.h" |
26 #include "ash/system/tray/tray_constants.h" | 28 #include "ash/system/tray/tray_constants.h" |
27 #include "ash/system/tray_accessibility.h" | 29 #include "ash/system/tray_accessibility.h" |
28 #include "ash/system/tray_caps_lock.h" | 30 #include "ash/system/tray_caps_lock.h" |
29 #include "ash/system/tray_update.h" | 31 #include "ash/system/tray_update.h" |
30 #include "ash/system/user/login_status.h" | 32 #include "ash/system/user/login_status.h" |
31 #include "ash/system/user/tray_user.h" | 33 #include "ash/system/user/tray_user.h" |
32 #include "ash/wm/shelf_layout_manager.h" | 34 #include "ash/wm/shelf_layout_manager.h" |
| 35 #include "base/command_line.h" |
33 #include "base/logging.h" | 36 #include "base/logging.h" |
34 #include "base/timer.h" | 37 #include "base/timer.h" |
35 #include "base/utf_string_conversions.h" | 38 #include "base/utf_string_conversions.h" |
36 #include "grit/ash_strings.h" | 39 #include "grit/ash_strings.h" |
37 #include "ui/aura/root_window.h" | 40 #include "ui/aura/root_window.h" |
38 #include "ui/base/events/event_constants.h" | 41 #include "ui/base/events/event_constants.h" |
39 #include "ui/base/l10n/l10n_util.h" | 42 #include "ui/base/l10n/l10n_util.h" |
40 #include "ui/compositor/layer.h" | 43 #include "ui/compositor/layer.h" |
41 #include "ui/gfx/canvas.h" | 44 #include "ui/gfx/canvas.h" |
42 #include "ui/gfx/screen.h" | 45 #include "ui/gfx/screen.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 #if defined(OS_CHROMEOS) | 192 #if defined(OS_CHROMEOS) |
190 AddTrayItem(tray_display); | 193 AddTrayItem(tray_display); |
191 #endif | 194 #endif |
192 AddTrayItem(tray_volume); | 195 AddTrayItem(tray_volume); |
193 AddTrayItem(tray_brightness); | 196 AddTrayItem(tray_brightness); |
194 AddTrayItem(tray_update); | 197 AddTrayItem(tray_update); |
195 AddTrayItem(tray_accessibility); | 198 AddTrayItem(tray_accessibility); |
196 AddTrayItem(tray_caps_lock); | 199 AddTrayItem(tray_caps_lock); |
197 AddTrayItem(tray_settings); | 200 AddTrayItem(tray_settings); |
198 AddTrayItem(tray_date); | 201 AddTrayItem(tray_date); |
| 202 |
| 203 #if defined(OS_LINUX) |
| 204 // Add memory monitor if enabled. |
| 205 CommandLine* cmd = CommandLine::ForCurrentProcess(); |
| 206 if (cmd->HasSwitch(ash::switches::kAshEnableMemoryMonitor)) |
| 207 AddTrayItem(new internal::TrayMonitor); |
| 208 #endif |
| 209 |
199 SetVisible(ash::Shell::GetInstance()->tray_delegate()-> | 210 SetVisible(ash::Shell::GetInstance()->tray_delegate()-> |
200 GetTrayVisibilityOnStartup()); | 211 GetTrayVisibilityOnStartup()); |
201 } | 212 } |
202 | 213 |
203 void SystemTray::AddTrayItem(SystemTrayItem* item) { | 214 void SystemTray::AddTrayItem(SystemTrayItem* item) { |
204 items_.push_back(item); | 215 items_.push_back(item); |
205 | 216 |
206 SystemTrayDelegate* delegate = Shell::GetInstance()->tray_delegate(); | 217 SystemTrayDelegate* delegate = Shell::GetInstance()->tray_delegate(); |
207 views::View* tray_item = item->CreateTrayView(delegate->GetUserLoginStatus()); | 218 views::View* tray_item = item->CreateTrayView(delegate->GetUserLoginStatus()); |
208 item->UpdateAfterShelfAlignmentChange(shelf_alignment()); | 219 item->UpdateAfterShelfAlignmentChange(shelf_alignment()); |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 ConvertPointToWidget(this, &point); | 593 ConvertPointToWidget(this, &point); |
583 arrow_offset = point.x(); | 594 arrow_offset = point.x(); |
584 } | 595 } |
585 } | 596 } |
586 ShowDefaultViewWithOffset(BUBBLE_CREATE_NEW, arrow_offset); | 597 ShowDefaultViewWithOffset(BUBBLE_CREATE_NEW, arrow_offset); |
587 } | 598 } |
588 return true; | 599 return true; |
589 } | 600 } |
590 | 601 |
591 } // namespace ash | 602 } // namespace ash |
OLD | NEW |