| 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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 registrar_->Add(this, | 268 registrar_->Add(this, |
| 269 chrome::NOTIFICATION_SESSION_STARTED, | 269 chrome::NOTIFICATION_SESSION_STARTED, |
| 270 content::NotificationService::AllSources()); | 270 content::NotificationService::AllSources()); |
| 271 } | 271 } |
| 272 registrar_->Add(this, | 272 registrar_->Add(this, |
| 273 chrome::NOTIFICATION_PROFILE_CREATED, | 273 chrome::NOTIFICATION_PROFILE_CREATED, |
| 274 content::NotificationService::AllSources()); | 274 content::NotificationService::AllSources()); |
| 275 registrar_->Add(this, | 275 registrar_->Add(this, |
| 276 chrome::NOTIFICATION_PROFILE_DESTROYED, | 276 chrome::NOTIFICATION_PROFILE_DESTROYED, |
| 277 content::NotificationService::AllSources()); | 277 content::NotificationService::AllSources()); |
| 278 registrar_->Add( | 278 |
| 279 this, | 279 AccessibilityManager* accessibility_manager = AccessibilityManager::Get(); |
| 280 chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_SCREEN_MAGNIFIER, | 280 CHECK(accessibility_manager); |
| 281 content::NotificationService::AllSources()); | 281 accessibility_subscription_ = accessibility_manager->RegisterCallback( |
| 282 registrar_->Add( | 282 base::Bind(&SystemTrayDelegateChromeOS::OnAccessibilityStatusChanged, |
| 283 this, | 283 base::Unretained(this))); |
| 284 chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_SPOKEN_FEEDBACK, | |
| 285 content::NotificationService::AllSources()); | |
| 286 registrar_->Add( | |
| 287 this, | |
| 288 chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_HIGH_CONTRAST_MODE, | |
| 289 content::NotificationService::AllSources()); | |
| 290 registrar_->Add( | |
| 291 this, | |
| 292 chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_VIRTUAL_KEYBOARD, | |
| 293 content::NotificationService::AllSources()); | |
| 294 } | 284 } |
| 295 | 285 |
| 296 void SystemTrayDelegateChromeOS::Initialize() { | 286 void SystemTrayDelegateChromeOS::Initialize() { |
| 297 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this); | 287 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this); |
| 298 | 288 |
| 299 input_method::InputMethodManager::Get()->AddObserver(this); | 289 input_method::InputMethodManager::Get()->AddObserver(this); |
| 300 UpdateClockType(); | 290 UpdateClockType(); |
| 301 | 291 |
| 302 if (SystemKeyEventListener::GetInstance()) | 292 if (SystemKeyEventListener::GetInstance()) |
| 303 SystemKeyEventListener::GetInstance()->AddCapsLockObserver(this); | 293 SystemKeyEventListener::GetInstance()->AddCapsLockObserver(this); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 } | 338 } |
| 349 | 339 |
| 350 SystemTrayDelegateChromeOS::~SystemTrayDelegateChromeOS() { | 340 SystemTrayDelegateChromeOS::~SystemTrayDelegateChromeOS() { |
| 351 // Unregister PrefChangeRegistrars. | 341 // Unregister PrefChangeRegistrars. |
| 352 local_state_registrar_.reset(); | 342 local_state_registrar_.reset(); |
| 353 user_pref_registrar_.reset(); | 343 user_pref_registrar_.reset(); |
| 354 | 344 |
| 355 // Unregister content notifications befure destroying any components. | 345 // Unregister content notifications befure destroying any components. |
| 356 registrar_.reset(); | 346 registrar_.reset(); |
| 357 | 347 |
| 348 // Unregister a11y status subscription. |
| 349 accessibility_subscription_.reset(); |
| 350 |
| 358 DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this); | 351 DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this); |
| 359 input_method::InputMethodManager::Get()->RemoveObserver(this); | 352 input_method::InputMethodManager::Get()->RemoveObserver(this); |
| 360 if (SystemKeyEventListener::GetInstance()) | 353 if (SystemKeyEventListener::GetInstance()) |
| 361 SystemKeyEventListener::GetInstance()->RemoveCapsLockObserver(this); | 354 SystemKeyEventListener::GetInstance()->RemoveCapsLockObserver(this); |
| 362 bluetooth_adapter_->RemoveObserver(this); | 355 bluetooth_adapter_->RemoveObserver(this); |
| 363 ash::Shell::GetInstance() | 356 ash::Shell::GetInstance() |
| 364 ->session_state_delegate() | 357 ->session_state_delegate() |
| 365 ->RemoveSessionStateObserver(this); | 358 ->RemoveSessionStateObserver(this); |
| 366 LoginState::Get()->RemoveObserver(this); | 359 LoginState::Get()->RemoveObserver(this); |
| 367 | 360 |
| (...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1148 content::NotificationService::AllSources()); | 1141 content::NotificationService::AllSources()); |
| 1149 } | 1142 } |
| 1150 break; | 1143 break; |
| 1151 } | 1144 } |
| 1152 case chrome::NOTIFICATION_SESSION_STARTED: { | 1145 case chrome::NOTIFICATION_SESSION_STARTED: { |
| 1153 ash::Shell::GetInstance()->UpdateAfterLoginStatusChange( | 1146 ash::Shell::GetInstance()->UpdateAfterLoginStatusChange( |
| 1154 GetUserLoginStatus()); | 1147 GetUserLoginStatus()); |
| 1155 SetProfile(ProfileManager::GetActiveUserProfile()); | 1148 SetProfile(ProfileManager::GetActiveUserProfile()); |
| 1156 break; | 1149 break; |
| 1157 } | 1150 } |
| 1158 case chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_SPOKEN_FEEDBACK: | |
| 1159 case chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_HIGH_CONTRAST_MODE: | |
| 1160 case chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_SCREEN_MAGNIFIER: | |
| 1161 case chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_VIRTUAL_KEYBOARD: { | |
| 1162 AccessibilityStatusEventDetails* accessibility_status = | |
| 1163 content::Details<AccessibilityStatusEventDetails>(details).ptr(); | |
| 1164 OnAccessibilityModeChanged(accessibility_status->notify); | |
| 1165 break; | |
| 1166 } | |
| 1167 default: | 1151 default: |
| 1168 NOTREACHED(); | 1152 NOTREACHED(); |
| 1169 } | 1153 } |
| 1170 } | 1154 } |
| 1171 | 1155 |
| 1172 void SystemTrayDelegateChromeOS::OnLanguageRemapSearchKeyToChanged() { | 1156 void SystemTrayDelegateChromeOS::OnLanguageRemapSearchKeyToChanged() { |
| 1173 search_key_mapped_to_ = user_pref_registrar_->prefs()->GetInteger( | 1157 search_key_mapped_to_ = user_pref_registrar_->prefs()->GetInteger( |
| 1174 prefs::kLanguageRemapSearchKeyTo); | 1158 prefs::kLanguageRemapSearchKeyTo); |
| 1175 } | 1159 } |
| 1176 | 1160 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1296 void SystemTrayDelegateChromeOS::OnStoreError(policy::CloudPolicyStore* store) { | 1280 void SystemTrayDelegateChromeOS::OnStoreError(policy::CloudPolicyStore* store) { |
| 1297 UpdateEnterpriseDomain(); | 1281 UpdateEnterpriseDomain(); |
| 1298 } | 1282 } |
| 1299 | 1283 |
| 1300 // Overridden from ash::SessionStateObserver | 1284 // Overridden from ash::SessionStateObserver |
| 1301 void SystemTrayDelegateChromeOS::UserAddedToSession( | 1285 void SystemTrayDelegateChromeOS::UserAddedToSession( |
| 1302 const std::string& user_id) { | 1286 const std::string& user_id) { |
| 1303 GetSystemTrayNotifier()->NotifyUserAddedToSession(); | 1287 GetSystemTrayNotifier()->NotifyUserAddedToSession(); |
| 1304 } | 1288 } |
| 1305 | 1289 |
| 1290 void SystemTrayDelegateChromeOS::OnAccessibilityStatusChanged( |
| 1291 const AccessibilityStatusEventDetails& details) { |
| 1292 if (details.notification_type == ACCESSIBILITY_MANAGER_SHUTDOWN) |
| 1293 accessibility_subscription_.reset(); |
| 1294 else |
| 1295 OnAccessibilityModeChanged(details.notify); |
| 1296 } |
| 1297 |
| 1306 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1298 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
| 1307 return new SystemTrayDelegateChromeOS(); | 1299 return new SystemTrayDelegateChromeOS(); |
| 1308 } | 1300 } |
| 1309 | 1301 |
| 1310 } // namespace chromeos | 1302 } // namespace chromeos |
| OLD | NEW |