OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/ui/ash/system_tray_delegate_chromeos.h" | 5 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 | 307 |
308 device::BluetoothAdapterFactory::GetAdapter( | 308 device::BluetoothAdapterFactory::GetAdapter( |
309 base::Bind(&SystemTrayDelegateChromeOS::InitializeOnAdapterReady, | 309 base::Bind(&SystemTrayDelegateChromeOS::InitializeOnAdapterReady, |
310 weak_ptr_factory_.GetWeakPtr())); | 310 weak_ptr_factory_.GetWeakPtr())); |
311 | 311 |
312 ash::Shell::GetInstance()->session_state_delegate()->AddSessionStateObserver( | 312 ash::Shell::GetInstance()->session_state_delegate()->AddSessionStateObserver( |
313 this); | 313 this); |
314 | 314 |
315 if (LoginState::IsInitialized()) | 315 if (LoginState::IsInitialized()) |
316 LoginState::Get()->AddObserver(this); | 316 LoginState::Get()->AddObserver(this); |
| 317 |
| 318 if (CrasAudioHandler::IsInitialized()) |
| 319 CrasAudioHandler::Get()->AddAudioObserver(this); |
317 } | 320 } |
318 | 321 |
319 void SystemTrayDelegateChromeOS::Shutdown() { | 322 void SystemTrayDelegateChromeOS::Shutdown() { |
320 device_settings_observer_.reset(); | 323 device_settings_observer_.reset(); |
321 } | 324 } |
322 | 325 |
323 void SystemTrayDelegateChromeOS::InitializeOnAdapterReady( | 326 void SystemTrayDelegateChromeOS::InitializeOnAdapterReady( |
324 scoped_refptr<device::BluetoothAdapter> adapter) { | 327 scoped_refptr<device::BluetoothAdapter> adapter) { |
325 bluetooth_adapter_ = adapter; | 328 bluetooth_adapter_ = adapter; |
326 CHECK(bluetooth_adapter_.get()); | 329 CHECK(bluetooth_adapter_.get()); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 input_method::InputMethodManager::Get()->RemoveObserver(this); | 365 input_method::InputMethodManager::Get()->RemoveObserver(this); |
363 ash::ime::InputMethodMenuManager::GetInstance()->RemoveObserver(this); | 366 ash::ime::InputMethodMenuManager::GetInstance()->RemoveObserver(this); |
364 if (SystemKeyEventListener::GetInstance()) | 367 if (SystemKeyEventListener::GetInstance()) |
365 SystemKeyEventListener::GetInstance()->RemoveCapsLockObserver(this); | 368 SystemKeyEventListener::GetInstance()->RemoveCapsLockObserver(this); |
366 bluetooth_adapter_->RemoveObserver(this); | 369 bluetooth_adapter_->RemoveObserver(this); |
367 ash::Shell::GetInstance() | 370 ash::Shell::GetInstance() |
368 ->session_state_delegate() | 371 ->session_state_delegate() |
369 ->RemoveSessionStateObserver(this); | 372 ->RemoveSessionStateObserver(this); |
370 LoginState::Get()->RemoveObserver(this); | 373 LoginState::Get()->RemoveObserver(this); |
371 | 374 |
372 // Stop observing Drive operations. | 375 if (CrasAudioHandler::IsInitialized()) |
| 376 CrasAudioHandler::Get()->RemoveAudioObserver(this); |
| 377 |
| 378 // Stop observing Drive operations. |
373 UnobserveDriveUpdates(); | 379 UnobserveDriveUpdates(); |
374 | 380 |
375 policy::BrowserPolicyConnectorChromeOS* connector = | 381 policy::BrowserPolicyConnectorChromeOS* connector = |
376 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 382 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
377 policy::DeviceCloudPolicyManagerChromeOS* policy_manager = | 383 policy::DeviceCloudPolicyManagerChromeOS* policy_manager = |
378 connector->GetDeviceCloudPolicyManager(); | 384 connector->GetDeviceCloudPolicyManager(); |
379 if (policy_manager) | 385 if (policy_manager) |
380 policy_manager->core()->store()->RemoveObserver(this); | 386 policy_manager->core()->store()->RemoveObserver(this); |
381 } | 387 } |
382 | 388 |
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1203 } | 1209 } |
1204 GetSystemTrayNotifier()->NotifyRefreshIME(show_message); | 1210 GetSystemTrayNotifier()->NotifyRefreshIME(show_message); |
1205 } | 1211 } |
1206 | 1212 |
1207 // Overridden from InputMethodMenuManager::Observer. | 1213 // Overridden from InputMethodMenuManager::Observer. |
1208 void SystemTrayDelegateChromeOS::InputMethodMenuItemChanged( | 1214 void SystemTrayDelegateChromeOS::InputMethodMenuItemChanged( |
1209 ash::ime::InputMethodMenuManager* manager) { | 1215 ash::ime::InputMethodMenuManager* manager) { |
1210 GetSystemTrayNotifier()->NotifyRefreshIME(false); | 1216 GetSystemTrayNotifier()->NotifyRefreshIME(false); |
1211 } | 1217 } |
1212 | 1218 |
| 1219 // Overridden from CrasAudioHandler::AudioObserver. |
| 1220 void SystemTrayDelegateChromeOS::OnOutputVolumeChanged() { |
| 1221 GetSystemTrayNotifier()->NotifyAudioOutputVolumeChanged(); |
| 1222 } |
| 1223 |
| 1224 void SystemTrayDelegateChromeOS::OnOutputMuteChanged() { |
| 1225 GetSystemTrayNotifier()->NotifyAudioOutputMuteChanged(); |
| 1226 } |
| 1227 |
| 1228 void SystemTrayDelegateChromeOS::OnInputGainChanged() { |
| 1229 } |
| 1230 |
| 1231 void SystemTrayDelegateChromeOS::OnInputMuteChanged() { |
| 1232 } |
| 1233 |
| 1234 void SystemTrayDelegateChromeOS::OnAudioNodesChanged() { |
| 1235 GetSystemTrayNotifier()->NotifyAudioNodesChanged(); |
| 1236 } |
| 1237 |
| 1238 void SystemTrayDelegateChromeOS::OnActiveOutputNodeChanged() { |
| 1239 GetSystemTrayNotifier()->NotifyAudioActiveOutputNodeChanged(); |
| 1240 } |
| 1241 |
| 1242 void SystemTrayDelegateChromeOS::OnActiveInputNodeChanged() { |
| 1243 GetSystemTrayNotifier()->NotifyAudioActiveInputNodeChanged(); |
| 1244 } |
| 1245 |
1213 // drive::JobListObserver overrides. | 1246 // drive::JobListObserver overrides. |
1214 void SystemTrayDelegateChromeOS::OnJobAdded(const drive::JobInfo& job_info) { | 1247 void SystemTrayDelegateChromeOS::OnJobAdded(const drive::JobInfo& job_info) { |
1215 OnJobUpdated(job_info); | 1248 OnJobUpdated(job_info); |
1216 } | 1249 } |
1217 | 1250 |
1218 void SystemTrayDelegateChromeOS::OnJobDone(const drive::JobInfo& job_info, | 1251 void SystemTrayDelegateChromeOS::OnJobDone(const drive::JobInfo& job_info, |
1219 drive::FileError error) { | 1252 drive::FileError error) { |
1220 ash::DriveOperationStatus status; | 1253 ash::DriveOperationStatus status; |
1221 if (ConvertToFinishedDriveOperationStatus(job_info, error, &status)) | 1254 if (ConvertToFinishedDriveOperationStatus(job_info, error, &status)) |
1222 GetSystemTrayNotifier()->NotifyDriveJobUpdated(status); | 1255 GetSystemTrayNotifier()->NotifyDriveJobUpdated(status); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1305 void SystemTrayDelegateChromeOS::UserAddedToSession( | 1338 void SystemTrayDelegateChromeOS::UserAddedToSession( |
1306 const std::string& user_id) { | 1339 const std::string& user_id) { |
1307 GetSystemTrayNotifier()->NotifyUserAddedToSession(); | 1340 GetSystemTrayNotifier()->NotifyUserAddedToSession(); |
1308 } | 1341 } |
1309 | 1342 |
1310 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1343 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
1311 return new SystemTrayDelegateChromeOS(); | 1344 return new SystemTrayDelegateChromeOS(); |
1312 } | 1345 } |
1313 | 1346 |
1314 } // namespace chromeos | 1347 } // namespace chromeos |
OLD | NEW |