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