| 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); | |
| 320 } | 317 } |
| 321 | 318 |
| 322 void SystemTrayDelegateChromeOS::Shutdown() { | 319 void SystemTrayDelegateChromeOS::Shutdown() { |
| 323 device_settings_observer_.reset(); | 320 device_settings_observer_.reset(); |
| 324 } | 321 } |
| 325 | 322 |
| 326 void SystemTrayDelegateChromeOS::InitializeOnAdapterReady( | 323 void SystemTrayDelegateChromeOS::InitializeOnAdapterReady( |
| 327 scoped_refptr<device::BluetoothAdapter> adapter) { | 324 scoped_refptr<device::BluetoothAdapter> adapter) { |
| 328 bluetooth_adapter_ = adapter; | 325 bluetooth_adapter_ = adapter; |
| 329 CHECK(bluetooth_adapter_.get()); | 326 CHECK(bluetooth_adapter_.get()); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 input_method::InputMethodManager::Get()->RemoveObserver(this); | 362 input_method::InputMethodManager::Get()->RemoveObserver(this); |
| 366 ash::ime::InputMethodMenuManager::GetInstance()->RemoveObserver(this); | 363 ash::ime::InputMethodMenuManager::GetInstance()->RemoveObserver(this); |
| 367 if (SystemKeyEventListener::GetInstance()) | 364 if (SystemKeyEventListener::GetInstance()) |
| 368 SystemKeyEventListener::GetInstance()->RemoveCapsLockObserver(this); | 365 SystemKeyEventListener::GetInstance()->RemoveCapsLockObserver(this); |
| 369 bluetooth_adapter_->RemoveObserver(this); | 366 bluetooth_adapter_->RemoveObserver(this); |
| 370 ash::Shell::GetInstance() | 367 ash::Shell::GetInstance() |
| 371 ->session_state_delegate() | 368 ->session_state_delegate() |
| 372 ->RemoveSessionStateObserver(this); | 369 ->RemoveSessionStateObserver(this); |
| 373 LoginState::Get()->RemoveObserver(this); | 370 LoginState::Get()->RemoveObserver(this); |
| 374 | 371 |
| 375 if (CrasAudioHandler::IsInitialized()) | 372 // Stop observing Drive operations. |
| 376 CrasAudioHandler::Get()->RemoveAudioObserver(this); | |
| 377 | |
| 378 // Stop observing Drive operations. | |
| 379 UnobserveDriveUpdates(); | 373 UnobserveDriveUpdates(); |
| 380 | 374 |
| 381 policy::BrowserPolicyConnectorChromeOS* connector = | 375 policy::BrowserPolicyConnectorChromeOS* connector = |
| 382 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 376 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
| 383 policy::DeviceCloudPolicyManagerChromeOS* policy_manager = | 377 policy::DeviceCloudPolicyManagerChromeOS* policy_manager = |
| 384 connector->GetDeviceCloudPolicyManager(); | 378 connector->GetDeviceCloudPolicyManager(); |
| 385 if (policy_manager) | 379 if (policy_manager) |
| 386 policy_manager->core()->store()->RemoveObserver(this); | 380 policy_manager->core()->store()->RemoveObserver(this); |
| 387 } | 381 } |
| 388 | 382 |
| (...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1209 } | 1203 } |
| 1210 GetSystemTrayNotifier()->NotifyRefreshIME(show_message); | 1204 GetSystemTrayNotifier()->NotifyRefreshIME(show_message); |
| 1211 } | 1205 } |
| 1212 | 1206 |
| 1213 // Overridden from InputMethodMenuManager::Observer. | 1207 // Overridden from InputMethodMenuManager::Observer. |
| 1214 void SystemTrayDelegateChromeOS::InputMethodMenuItemChanged( | 1208 void SystemTrayDelegateChromeOS::InputMethodMenuItemChanged( |
| 1215 ash::ime::InputMethodMenuManager* manager) { | 1209 ash::ime::InputMethodMenuManager* manager) { |
| 1216 GetSystemTrayNotifier()->NotifyRefreshIME(false); | 1210 GetSystemTrayNotifier()->NotifyRefreshIME(false); |
| 1217 } | 1211 } |
| 1218 | 1212 |
| 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 | |
| 1246 // drive::JobListObserver overrides. | 1213 // drive::JobListObserver overrides. |
| 1247 void SystemTrayDelegateChromeOS::OnJobAdded(const drive::JobInfo& job_info) { | 1214 void SystemTrayDelegateChromeOS::OnJobAdded(const drive::JobInfo& job_info) { |
| 1248 OnJobUpdated(job_info); | 1215 OnJobUpdated(job_info); |
| 1249 } | 1216 } |
| 1250 | 1217 |
| 1251 void SystemTrayDelegateChromeOS::OnJobDone(const drive::JobInfo& job_info, | 1218 void SystemTrayDelegateChromeOS::OnJobDone(const drive::JobInfo& job_info, |
| 1252 drive::FileError error) { | 1219 drive::FileError error) { |
| 1253 ash::DriveOperationStatus status; | 1220 ash::DriveOperationStatus status; |
| 1254 if (ConvertToFinishedDriveOperationStatus(job_info, error, &status)) | 1221 if (ConvertToFinishedDriveOperationStatus(job_info, error, &status)) |
| 1255 GetSystemTrayNotifier()->NotifyDriveJobUpdated(status); | 1222 GetSystemTrayNotifier()->NotifyDriveJobUpdated(status); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1338 void SystemTrayDelegateChromeOS::UserAddedToSession( | 1305 void SystemTrayDelegateChromeOS::UserAddedToSession( |
| 1339 const std::string& user_id) { | 1306 const std::string& user_id) { |
| 1340 GetSystemTrayNotifier()->NotifyUserAddedToSession(); | 1307 GetSystemTrayNotifier()->NotifyUserAddedToSession(); |
| 1341 } | 1308 } |
| 1342 | 1309 |
| 1343 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1310 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
| 1344 return new SystemTrayDelegateChromeOS(); | 1311 return new SystemTrayDelegateChromeOS(); |
| 1345 } | 1312 } |
| 1346 | 1313 |
| 1347 } // namespace chromeos | 1314 } // namespace chromeos |
| OLD | NEW |