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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
82 #include "chrome/browser/ui/chrome_pages.h" | 82 #include "chrome/browser/ui/chrome_pages.h" |
83 #include "chrome/browser/ui/host_desktop.h" | 83 #include "chrome/browser/ui/host_desktop.h" |
84 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 84 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
85 #include "chrome/browser/ui/singleton_tabs.h" | 85 #include "chrome/browser/ui/singleton_tabs.h" |
86 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 86 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
87 #include "chrome/browser/ui/webui/chromeos/charger_replacement_handler.h" | 87 #include "chrome/browser/ui/webui/chromeos/charger_replacement_handler.h" |
88 #include "chrome/browser/ui/webui/chromeos/mobile_setup_dialog.h" | 88 #include "chrome/browser/ui/webui/chromeos/mobile_setup_dialog.h" |
89 #include "chrome/browser/upgrade_detector.h" | 89 #include "chrome/browser/upgrade_detector.h" |
90 #include "chrome/common/pref_names.h" | 90 #include "chrome/common/pref_names.h" |
91 #include "chrome/common/url_constants.h" | 91 #include "chrome/common/url_constants.h" |
92 #include "chromeos/audio/cras_audio_handler.h" | |
jennyz
2014/02/18 17:57:48
nit: cras_audio_handler.h is already included in t
| |
92 #include "chromeos/chromeos_switches.h" | 93 #include "chromeos/chromeos_switches.h" |
93 #include "chromeos/dbus/dbus_thread_manager.h" | 94 #include "chromeos/dbus/dbus_thread_manager.h" |
94 #include "chromeos/dbus/session_manager_client.h" | 95 #include "chromeos/dbus/session_manager_client.h" |
95 #include "chromeos/ime/extension_ime_util.h" | 96 #include "chromeos/ime/extension_ime_util.h" |
96 #include "chromeos/ime/input_method_manager.h" | 97 #include "chromeos/ime/input_method_manager.h" |
97 #include "chromeos/ime/xkeyboard.h" | 98 #include "chromeos/ime/xkeyboard.h" |
98 #include "chromeos/login/login_state.h" | 99 #include "chromeos/login/login_state.h" |
99 #include "components/policy/core/common/cloud/cloud_policy_store.h" | 100 #include "components/policy/core/common/cloud/cloud_policy_store.h" |
100 #include "content/public/browser/browser_thread.h" | 101 #include "content/public/browser/browser_thread.h" |
101 #include "content/public/browser/notification_observer.h" | 102 #include "content/public/browser/notification_observer.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
305 | 306 |
306 device::BluetoothAdapterFactory::GetAdapter( | 307 device::BluetoothAdapterFactory::GetAdapter( |
307 base::Bind(&SystemTrayDelegateChromeOS::InitializeOnAdapterReady, | 308 base::Bind(&SystemTrayDelegateChromeOS::InitializeOnAdapterReady, |
308 weak_ptr_factory_.GetWeakPtr())); | 309 weak_ptr_factory_.GetWeakPtr())); |
309 | 310 |
310 ash::Shell::GetInstance()->session_state_delegate()->AddSessionStateObserver( | 311 ash::Shell::GetInstance()->session_state_delegate()->AddSessionStateObserver( |
311 this); | 312 this); |
312 | 313 |
313 if (LoginState::IsInitialized()) | 314 if (LoginState::IsInitialized()) |
314 LoginState::Get()->AddObserver(this); | 315 LoginState::Get()->AddObserver(this); |
316 | |
317 if (CrasAudioHandler::IsInitialized()) | |
318 CrasAudioHandler::Get()->AddAudioObserver(this); | |
315 } | 319 } |
316 | 320 |
317 void SystemTrayDelegateChromeOS::Shutdown() { | 321 void SystemTrayDelegateChromeOS::Shutdown() { |
318 device_settings_observer_.reset(); | 322 device_settings_observer_.reset(); |
319 } | 323 } |
320 | 324 |
321 void SystemTrayDelegateChromeOS::InitializeOnAdapterReady( | 325 void SystemTrayDelegateChromeOS::InitializeOnAdapterReady( |
322 scoped_refptr<device::BluetoothAdapter> adapter) { | 326 scoped_refptr<device::BluetoothAdapter> adapter) { |
323 bluetooth_adapter_ = adapter; | 327 bluetooth_adapter_ = adapter; |
324 CHECK(bluetooth_adapter_.get()); | 328 CHECK(bluetooth_adapter_.get()); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
359 DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this); | 363 DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this); |
360 input_method::InputMethodManager::Get()->RemoveObserver(this); | 364 input_method::InputMethodManager::Get()->RemoveObserver(this); |
361 if (SystemKeyEventListener::GetInstance()) | 365 if (SystemKeyEventListener::GetInstance()) |
362 SystemKeyEventListener::GetInstance()->RemoveCapsLockObserver(this); | 366 SystemKeyEventListener::GetInstance()->RemoveCapsLockObserver(this); |
363 bluetooth_adapter_->RemoveObserver(this); | 367 bluetooth_adapter_->RemoveObserver(this); |
364 ash::Shell::GetInstance() | 368 ash::Shell::GetInstance() |
365 ->session_state_delegate() | 369 ->session_state_delegate() |
366 ->RemoveSessionStateObserver(this); | 370 ->RemoveSessionStateObserver(this); |
367 LoginState::Get()->RemoveObserver(this); | 371 LoginState::Get()->RemoveObserver(this); |
368 | 372 |
369 // Stop observing Drive operations. | 373 if (CrasAudioHandler::IsInitialized()) |
374 CrasAudioHandler::Get()->RemoveAudioObserver(this); | |
375 | |
376 // Stop observing Drive operations. | |
370 UnobserveDriveUpdates(); | 377 UnobserveDriveUpdates(); |
371 | 378 |
372 policy::BrowserPolicyConnectorChromeOS* connector = | 379 policy::BrowserPolicyConnectorChromeOS* connector = |
373 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 380 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
374 policy::DeviceCloudPolicyManagerChromeOS* policy_manager = | 381 policy::DeviceCloudPolicyManagerChromeOS* policy_manager = |
375 connector->GetDeviceCloudPolicyManager(); | 382 connector->GetDeviceCloudPolicyManager(); |
376 if (policy_manager) | 383 if (policy_manager) |
377 policy_manager->core()->store()->RemoveObserver(this); | 384 policy_manager->core()->store()->RemoveObserver(this); |
378 } | 385 } |
379 | 386 |
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1200 show_message = false; | 1207 show_message = false; |
1201 } | 1208 } |
1202 GetSystemTrayNotifier()->NotifyRefreshIME(show_message); | 1209 GetSystemTrayNotifier()->NotifyRefreshIME(show_message); |
1203 } | 1210 } |
1204 | 1211 |
1205 void SystemTrayDelegateChromeOS::InputMethodPropertyChanged( | 1212 void SystemTrayDelegateChromeOS::InputMethodPropertyChanged( |
1206 input_method::InputMethodManager* manager) { | 1213 input_method::InputMethodManager* manager) { |
1207 GetSystemTrayNotifier()->NotifyRefreshIME(false); | 1214 GetSystemTrayNotifier()->NotifyRefreshIME(false); |
1208 } | 1215 } |
1209 | 1216 |
1217 // Overridden from CrasAudioHandler::AudioObserver. | |
1218 void SystemTrayDelegateChromeOS::OnOutputVolumeChanged() { | |
1219 GetSystemTrayNotifier()->NotifyAudioOutputVolumeChanged(); | |
1220 } | |
1221 | |
1222 void SystemTrayDelegateChromeOS::OnOutputMuteChanged() { | |
1223 GetSystemTrayNotifier()->NotifyAudioOutputMuteChanged(); | |
1224 } | |
1225 | |
1226 void SystemTrayDelegateChromeOS::OnInputGainChanged() { | |
1227 } | |
1228 | |
1229 void SystemTrayDelegateChromeOS::OnInputMuteChanged() { | |
1230 } | |
1231 | |
1232 void SystemTrayDelegateChromeOS::OnAudioNodesChanged() { | |
1233 GetSystemTrayNotifier()->NotifyAudioNodesChanged(); | |
1234 } | |
1235 | |
1236 void SystemTrayDelegateChromeOS::OnActiveOutputNodeChanged() { | |
1237 GetSystemTrayNotifier()->NotifyAudioActiveOutputNodeChanged(); | |
1238 } | |
1239 | |
1240 void SystemTrayDelegateChromeOS::OnActiveInputNodeChanged() { | |
1241 GetSystemTrayNotifier()->NotifyAudioActiveInputNodeChanged(); | |
1242 } | |
1243 | |
1210 // drive::JobListObserver overrides. | 1244 // drive::JobListObserver overrides. |
1211 void SystemTrayDelegateChromeOS::OnJobAdded(const drive::JobInfo& job_info) { | 1245 void SystemTrayDelegateChromeOS::OnJobAdded(const drive::JobInfo& job_info) { |
1212 OnJobUpdated(job_info); | 1246 OnJobUpdated(job_info); |
1213 } | 1247 } |
1214 | 1248 |
1215 void SystemTrayDelegateChromeOS::OnJobDone(const drive::JobInfo& job_info, | 1249 void SystemTrayDelegateChromeOS::OnJobDone(const drive::JobInfo& job_info, |
1216 drive::FileError error) { | 1250 drive::FileError error) { |
1217 ash::DriveOperationStatus status; | 1251 ash::DriveOperationStatus status; |
1218 if (ConvertToFinishedDriveOperationStatus(job_info, error, &status)) | 1252 if (ConvertToFinishedDriveOperationStatus(job_info, error, &status)) |
1219 GetSystemTrayNotifier()->NotifyDriveJobUpdated(status); | 1253 GetSystemTrayNotifier()->NotifyDriveJobUpdated(status); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1302 void SystemTrayDelegateChromeOS::UserAddedToSession( | 1336 void SystemTrayDelegateChromeOS::UserAddedToSession( |
1303 const std::string& user_id) { | 1337 const std::string& user_id) { |
1304 GetSystemTrayNotifier()->NotifyUserAddedToSession(); | 1338 GetSystemTrayNotifier()->NotifyUserAddedToSession(); |
1305 } | 1339 } |
1306 | 1340 |
1307 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1341 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
1308 return new SystemTrayDelegateChromeOS(); | 1342 return new SystemTrayDelegateChromeOS(); |
1309 } | 1343 } |
1310 | 1344 |
1311 } // namespace chromeos | 1345 } // namespace chromeos |
OLD | NEW |