| 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/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/shell/panel_window.h" | 9 #include "ash/shell/panel_window.h" |
| 10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 (*it)->DestroyTrayView(); | 122 (*it)->DestroyTrayView(); |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 | 125 |
| 126 void SystemTray::InitializeTrayItems(SystemTrayDelegate* delegate) { | 126 void SystemTray::InitializeTrayItems(SystemTrayDelegate* delegate) { |
| 127 internal::TrayBackgroundView::Initialize(); | 127 internal::TrayBackgroundView::Initialize(); |
| 128 CreateItems(delegate); | 128 CreateItems(delegate); |
| 129 } | 129 } |
| 130 | 130 |
| 131 void SystemTray::CreateItems(SystemTrayDelegate* delegate) { | 131 void SystemTray::CreateItems(SystemTrayDelegate* delegate) { |
| 132 internal::TrayVolume* tray_volume = new internal::TrayVolume(); | 132 internal::TrayVolume* tray_volume = new internal::TrayVolume(this); |
| 133 internal::TrayBluetooth* tray_bluetooth = new internal::TrayBluetooth(); | 133 internal::TrayBluetooth* tray_bluetooth = new internal::TrayBluetooth(this); |
| 134 internal::TrayBrightness* tray_brightness = new internal::TrayBrightness(); | 134 internal::TrayBrightness* tray_brightness = |
| 135 internal::TrayDate* tray_date = new internal::TrayDate(); | 135 new internal::TrayBrightness(this); |
| 136 internal::TrayPower* tray_power = new internal::TrayPower(); | 136 internal::TrayDate* tray_date = new internal::TrayDate(this); |
| 137 internal::TrayIME* tray_ime = new internal::TrayIME(); | 137 internal::TrayPower* tray_power = new internal::TrayPower(this); |
| 138 internal::TrayUser* tray_user = new internal::TrayUser(); | 138 internal::TrayIME* tray_ime = new internal::TrayIME(this); |
| 139 internal::TrayUser* tray_user = new internal::TrayUser(this); |
| 139 internal::TrayAccessibility* tray_accessibility = | 140 internal::TrayAccessibility* tray_accessibility = |
| 140 new internal::TrayAccessibility(); | 141 new internal::TrayAccessibility(this); |
| 141 internal::TrayCapsLock* tray_caps_lock = new internal::TrayCapsLock(); | 142 internal::TrayCapsLock* tray_caps_lock = new internal::TrayCapsLock(this); |
| 142 internal::TrayDrive* tray_drive = new internal::TrayDrive(); | 143 internal::TrayDrive* tray_drive = new internal::TrayDrive(this); |
| 143 internal::TrayLocale* tray_locale = new internal::TrayLocale(); | 144 internal::TrayLocale* tray_locale = new internal::TrayLocale(this); |
| 144 internal::TrayLogoutButton* tray_logout_button = | 145 internal::TrayLogoutButton* tray_logout_button = |
| 145 new internal::TrayLogoutButton(); | 146 new internal::TrayLogoutButton(this); |
| 146 internal::TrayUpdate* tray_update = new internal::TrayUpdate(); | 147 internal::TrayUpdate* tray_update = new internal::TrayUpdate(this); |
| 147 internal::TraySettings* tray_settings = new internal::TraySettings(); | 148 internal::TraySettings* tray_settings = new internal::TraySettings(this); |
| 148 #if defined(OS_CHROMEOS) | 149 #if defined(OS_CHROMEOS) |
| 149 internal::TrayDisplay* tray_display = new internal::TrayDisplay(); | 150 internal::TrayDisplay* tray_display = new internal::TrayDisplay(this); |
| 150 internal::TrayNetwork* tray_network = new internal::TrayNetwork(); | 151 internal::TrayNetwork* tray_network = new internal::TrayNetwork(this); |
| 151 internal::TrayVPN* tray_vpn = new internal::TrayVPN(); | 152 internal::TrayVPN* tray_vpn = new internal::TrayVPN(this); |
| 152 internal::TraySms* tray_sms = new internal::TraySms(); | 153 internal::TraySms* tray_sms = new internal::TraySms(this); |
| 153 #endif | 154 #endif |
| 154 | 155 |
| 155 SystemTrayNotifier* notifier = Shell::GetInstance()->system_tray_notifier(); | 156 SystemTrayNotifier* notifier = Shell::GetInstance()->system_tray_notifier(); |
| 156 notifier->AddAccessibilityObserver(tray_accessibility); | 157 notifier->AddAccessibilityObserver(tray_accessibility); |
| 157 notifier->AddAudioObserver(tray_volume); | 158 notifier->AddAudioObserver(tray_volume); |
| 158 notifier->AddBluetoothObserver(tray_bluetooth); | 159 notifier->AddBluetoothObserver(tray_bluetooth); |
| 159 notifier->AddBrightnessObserver(tray_brightness); | 160 notifier->AddBrightnessObserver(tray_brightness); |
| 160 notifier->AddCapsLockObserver(tray_caps_lock); | 161 notifier->AddCapsLockObserver(tray_caps_lock); |
| 161 notifier->AddClockObserver(tray_date); | 162 notifier->AddClockObserver(tray_date); |
| 162 notifier->AddDriveObserver(tray_drive); | 163 notifier->AddDriveObserver(tray_drive); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 193 AddTrayItem(tray_update); | 194 AddTrayItem(tray_update); |
| 194 AddTrayItem(tray_accessibility); | 195 AddTrayItem(tray_accessibility); |
| 195 AddTrayItem(tray_caps_lock); | 196 AddTrayItem(tray_caps_lock); |
| 196 AddTrayItem(tray_settings); | 197 AddTrayItem(tray_settings); |
| 197 AddTrayItem(tray_date); | 198 AddTrayItem(tray_date); |
| 198 | 199 |
| 199 #if defined(OS_LINUX) | 200 #if defined(OS_LINUX) |
| 200 // Add memory monitor if enabled. | 201 // Add memory monitor if enabled. |
| 201 CommandLine* cmd = CommandLine::ForCurrentProcess(); | 202 CommandLine* cmd = CommandLine::ForCurrentProcess(); |
| 202 if (cmd->HasSwitch(ash::switches::kAshEnableMemoryMonitor)) | 203 if (cmd->HasSwitch(ash::switches::kAshEnableMemoryMonitor)) |
| 203 AddTrayItem(new internal::TrayMonitor); | 204 AddTrayItem(new internal::TrayMonitor(this)); |
| 204 #endif | 205 #endif |
| 205 | 206 |
| 206 SetVisible(ash::Shell::GetInstance()->tray_delegate()-> | 207 SetVisible(ash::Shell::GetInstance()->tray_delegate()-> |
| 207 GetTrayVisibilityOnStartup()); | 208 GetTrayVisibilityOnStartup()); |
| 208 } | 209 } |
| 209 | 210 |
| 210 void SystemTray::AddTrayItem(SystemTrayItem* item) { | 211 void SystemTray::AddTrayItem(SystemTrayItem* item) { |
| 211 items_.push_back(item); | 212 items_.push_back(item); |
| 212 | 213 |
| 213 SystemTrayDelegate* delegate = Shell::GetInstance()->tray_delegate(); | 214 SystemTrayDelegate* delegate = Shell::GetInstance()->tray_delegate(); |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 ConvertPointToWidget(this, &point); | 582 ConvertPointToWidget(this, &point); |
| 582 arrow_offset = point.x(); | 583 arrow_offset = point.x(); |
| 583 } | 584 } |
| 584 } | 585 } |
| 585 ShowDefaultViewWithOffset(BUBBLE_CREATE_NEW, arrow_offset); | 586 ShowDefaultViewWithOffset(BUBBLE_CREATE_NEW, arrow_offset); |
| 586 } | 587 } |
| 587 return true; | 588 return true; |
| 588 } | 589 } |
| 589 | 590 |
| 590 } // namespace ash | 591 } // namespace ash |
| OLD | NEW |