| Index: chrome/browser/ui/ash/system_tray_delegate_chromeos.cc
|
| diff --git a/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc b/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc
|
| index d28de2cdea5c14b194adb08ad9ce6b4d6c2ed509..0595d53e1a4650ac5a89a9a33a7a333d6323ef46 100644
|
| --- a/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc
|
| +++ b/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc
|
| @@ -275,22 +275,12 @@ SystemTrayDelegateChromeOS::SystemTrayDelegateChromeOS()
|
| registrar_->Add(this,
|
| chrome::NOTIFICATION_PROFILE_DESTROYED,
|
| content::NotificationService::AllSources());
|
| - registrar_->Add(
|
| - this,
|
| - chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_SCREEN_MAGNIFIER,
|
| - content::NotificationService::AllSources());
|
| - registrar_->Add(
|
| - this,
|
| - chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_SPOKEN_FEEDBACK,
|
| - content::NotificationService::AllSources());
|
| - registrar_->Add(
|
| - this,
|
| - chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_HIGH_CONTRAST_MODE,
|
| - content::NotificationService::AllSources());
|
| - registrar_->Add(
|
| - this,
|
| - chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_VIRTUAL_KEYBOARD,
|
| - content::NotificationService::AllSources());
|
| +
|
| + AccessibilityManager* accessibility_manager = AccessibilityManager::Get();
|
| + CHECK(accessibility_manager);
|
| + accessibility_subscription_ = accessibility_manager->RegisterCallback(
|
| + base::Bind(&SystemTrayDelegateChromeOS::OnAccessibilityStatusChanged,
|
| + base::Unretained(this)));
|
| }
|
|
|
| void SystemTrayDelegateChromeOS::Initialize() {
|
| @@ -355,6 +345,9 @@ SystemTrayDelegateChromeOS::~SystemTrayDelegateChromeOS() {
|
| // Unregister content notifications befure destroying any components.
|
| registrar_.reset();
|
|
|
| + // Unregister a11y status subscription.
|
| + accessibility_subscription_.reset();
|
| +
|
| DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this);
|
| input_method::InputMethodManager::Get()->RemoveObserver(this);
|
| if (SystemKeyEventListener::GetInstance())
|
| @@ -1155,15 +1148,6 @@ void SystemTrayDelegateChromeOS::Observe(
|
| SetProfile(ProfileManager::GetActiveUserProfile());
|
| break;
|
| }
|
| - case chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_SPOKEN_FEEDBACK:
|
| - case chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_HIGH_CONTRAST_MODE:
|
| - case chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_SCREEN_MAGNIFIER:
|
| - case chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_VIRTUAL_KEYBOARD: {
|
| - AccessibilityStatusEventDetails* accessibility_status =
|
| - content::Details<AccessibilityStatusEventDetails>(details).ptr();
|
| - OnAccessibilityModeChanged(accessibility_status->notify);
|
| - break;
|
| - }
|
| default:
|
| NOTREACHED();
|
| }
|
| @@ -1303,6 +1287,14 @@ void SystemTrayDelegateChromeOS::UserAddedToSession(
|
| GetSystemTrayNotifier()->NotifyUserAddedToSession();
|
| }
|
|
|
| +void SystemTrayDelegateChromeOS::OnAccessibilityStatusChanged(
|
| + const AccessibilityStatusEventDetails& details) {
|
| + if (details.notification_type == ACCESSIBILITY_MANAGER_SHUTDOWN)
|
| + accessibility_subscription_.reset();
|
| + else
|
| + OnAccessibilityModeChanged(details.notify);
|
| +}
|
| +
|
| ash::SystemTrayDelegate* CreateSystemTrayDelegate() {
|
| return new SystemTrayDelegateChromeOS();
|
| }
|
|
|