| 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" |
| 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_SPOKEN_FEEDBACK, | 286 chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_SPOKEN_FEEDBACK, |
| 286 content::NotificationService::AllSources()); | 287 content::NotificationService::AllSources()); |
| 287 registrar_->Add( | 288 registrar_->Add( |
| 288 this, | 289 this, |
| 289 chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_HIGH_CONTRAST_MODE, | 290 chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_HIGH_CONTRAST_MODE, |
| 290 content::NotificationService::AllSources()); | 291 content::NotificationService::AllSources()); |
| 291 registrar_->Add( | 292 registrar_->Add( |
| 292 this, | 293 this, |
| 293 chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_VIRTUAL_KEYBOARD, | 294 chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_VIRTUAL_KEYBOARD, |
| 294 content::NotificationService::AllSources()); | 295 content::NotificationService::AllSources()); |
| 296 |
| 297 CrasAudioHandler::Get()->AddAudioObserver(this); |
| 295 } | 298 } |
| 296 | 299 |
| 297 void SystemTrayDelegateChromeOS::Initialize() { | 300 void SystemTrayDelegateChromeOS::Initialize() { |
| 298 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this); | 301 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this); |
| 299 | 302 |
| 300 input_method::InputMethodManager::Get()->AddObserver(this); | 303 input_method::InputMethodManager::Get()->AddObserver(this); |
| 301 UpdateClockType(); | 304 UpdateClockType(); |
| 302 | 305 |
| 303 if (SystemKeyEventListener::GetInstance()) | 306 if (SystemKeyEventListener::GetInstance()) |
| 304 SystemKeyEventListener::GetInstance()->AddCapsLockObserver(this); | 307 SystemKeyEventListener::GetInstance()->AddCapsLockObserver(this); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 SystemKeyEventListener::GetInstance()->RemoveCapsLockObserver(this); | 365 SystemKeyEventListener::GetInstance()->RemoveCapsLockObserver(this); |
| 363 bluetooth_adapter_->RemoveObserver(this); | 366 bluetooth_adapter_->RemoveObserver(this); |
| 364 ash::Shell::GetInstance() | 367 ash::Shell::GetInstance() |
| 365 ->session_state_delegate() | 368 ->session_state_delegate() |
| 366 ->RemoveSessionStateObserver(this); | 369 ->RemoveSessionStateObserver(this); |
| 367 LoginState::Get()->RemoveObserver(this); | 370 LoginState::Get()->RemoveObserver(this); |
| 368 | 371 |
| 369 // Stop observing Drive operations. | 372 // Stop observing Drive operations. |
| 370 UnobserveDriveUpdates(); | 373 UnobserveDriveUpdates(); |
| 371 | 374 |
| 375 CrasAudioHandler::Get()->RemoveAudioObserver(this); |
| 376 |
| 372 policy::BrowserPolicyConnectorChromeOS* connector = | 377 policy::BrowserPolicyConnectorChromeOS* connector = |
| 373 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 378 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
| 374 policy::DeviceCloudPolicyManagerChromeOS* policy_manager = | 379 policy::DeviceCloudPolicyManagerChromeOS* policy_manager = |
| 375 connector->GetDeviceCloudPolicyManager(); | 380 connector->GetDeviceCloudPolicyManager(); |
| 376 if (policy_manager) | 381 if (policy_manager) |
| 377 policy_manager->core()->store()->RemoveObserver(this); | 382 policy_manager->core()->store()->RemoveObserver(this); |
| 378 } | 383 } |
| 379 | 384 |
| 380 // Overridden from ash::SystemTrayDelegate: | 385 // Overridden from ash::SystemTrayDelegate: |
| 381 bool SystemTrayDelegateChromeOS::GetTrayVisibilityOnStartup() { | 386 bool SystemTrayDelegateChromeOS::GetTrayVisibilityOnStartup() { |
| (...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1195 show_message = false; | 1200 show_message = false; |
| 1196 } | 1201 } |
| 1197 GetSystemTrayNotifier()->NotifyRefreshIME(show_message); | 1202 GetSystemTrayNotifier()->NotifyRefreshIME(show_message); |
| 1198 } | 1203 } |
| 1199 | 1204 |
| 1200 void SystemTrayDelegateChromeOS::InputMethodPropertyChanged( | 1205 void SystemTrayDelegateChromeOS::InputMethodPropertyChanged( |
| 1201 input_method::InputMethodManager* manager) { | 1206 input_method::InputMethodManager* manager) { |
| 1202 GetSystemTrayNotifier()->NotifyRefreshIME(false); | 1207 GetSystemTrayNotifier()->NotifyRefreshIME(false); |
| 1203 } | 1208 } |
| 1204 | 1209 |
| 1210 // Overridden from CrasAudioHandler::AudioObserver. |
| 1211 void SystemTrayDelegateChromeOS::OnOutputVolumeChanged() { |
| 1212 GetSystemTrayNotifier()->NotifyAudioOutputVolumeChanged(); |
| 1213 } |
| 1214 |
| 1215 void SystemTrayDelegateChromeOS::OnOutputMuteChanged() { |
| 1216 GetSystemTrayNotifier()->NotifyAudioOutputMuteChanged(); |
| 1217 } |
| 1218 |
| 1219 void SystemTrayDelegateChromeOS::OnInputGainChanged() { |
| 1220 } |
| 1221 |
| 1222 void SystemTrayDelegateChromeOS::OnInputMuteChanged() { |
| 1223 } |
| 1224 |
| 1225 void SystemTrayDelegateChromeOS::OnAudioNodesChanged() { |
| 1226 GetSystemTrayNotifier()->NotifyAudioNodesChanged(); |
| 1227 } |
| 1228 |
| 1229 void SystemTrayDelegateChromeOS::OnActiveOutputNodeChanged() { |
| 1230 GetSystemTrayNotifier()->NotifyAudioActiveOutputNodeChanged(); |
| 1231 } |
| 1232 |
| 1233 void SystemTrayDelegateChromeOS::OnActiveInputNodeChanged() { |
| 1234 GetSystemTrayNotifier()->NotifyAudioActiveInputNodeChanged(); |
| 1235 } |
| 1236 |
| 1205 // drive::JobListObserver overrides. | 1237 // drive::JobListObserver overrides. |
| 1206 void SystemTrayDelegateChromeOS::OnJobAdded(const drive::JobInfo& job_info) { | 1238 void SystemTrayDelegateChromeOS::OnJobAdded(const drive::JobInfo& job_info) { |
| 1207 OnJobUpdated(job_info); | 1239 OnJobUpdated(job_info); |
| 1208 } | 1240 } |
| 1209 | 1241 |
| 1210 void SystemTrayDelegateChromeOS::OnJobDone(const drive::JobInfo& job_info, | 1242 void SystemTrayDelegateChromeOS::OnJobDone(const drive::JobInfo& job_info, |
| 1211 drive::FileError error) { | 1243 drive::FileError error) { |
| 1212 ash::DriveOperationStatus status; | 1244 ash::DriveOperationStatus status; |
| 1213 if (ConvertToFinishedDriveOperationStatus(job_info, error, &status)) | 1245 if (ConvertToFinishedDriveOperationStatus(job_info, error, &status)) |
| 1214 GetSystemTrayNotifier()->NotifyDriveJobUpdated(status); | 1246 GetSystemTrayNotifier()->NotifyDriveJobUpdated(status); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1297 void SystemTrayDelegateChromeOS::UserAddedToSession( | 1329 void SystemTrayDelegateChromeOS::UserAddedToSession( |
| 1298 const std::string& user_id) { | 1330 const std::string& user_id) { |
| 1299 GetSystemTrayNotifier()->NotifyUserAddedToSession(); | 1331 GetSystemTrayNotifier()->NotifyUserAddedToSession(); |
| 1300 } | 1332 } |
| 1301 | 1333 |
| 1302 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1334 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
| 1303 return new SystemTrayDelegateChromeOS(); | 1335 return new SystemTrayDelegateChromeOS(); |
| 1304 } | 1336 } |
| 1305 | 1337 |
| 1306 } // namespace chromeos | 1338 } // namespace chromeos |
| OLD | NEW |