Chromium Code Reviews| Index: chrome/browser/chromeos/accessibility/accessibility_manager.cc |
| diff --git a/chrome/browser/chromeos/accessibility/accessibility_manager.cc b/chrome/browser/chromeos/accessibility/accessibility_manager.cc |
| index 2b67f9bcf31959fbc79ffb03ecb0e266afcc717b..9840b0a0982acddb23a412764b636d257026441b 100644 |
| --- a/chrome/browser/chromeos/accessibility/accessibility_manager.cc |
| +++ b/chrome/browser/chromeos/accessibility/accessibility_manager.cc |
| @@ -343,8 +343,10 @@ AccessibilityManager::~AccessibilityManager() { |
| // Component extensions don't always notify us when they're unloaded. Ensure |
| // we clean up ChromeVox observers here. |
| - if (profile_) { |
| - extensions::ExtensionSystem::Get(profile_)-> |
| + for (std::set<Profile*>::iterator it = chromevox_profiles_.begin(); |
| + it != chromevox_profiles_.end(); |
| + it++) { |
| + extensions::ExtensionSystem::Get(*it)-> |
| event_router()->UnregisterObserver(this); |
| } |
| } |
| @@ -745,6 +747,9 @@ void AccessibilityManager::SetProfile(Profile* profile) { |
| if (!profile && profile_) { |
| extensions::ExtensionSystem::Get(profile_)-> |
| event_router()->UnregisterObserver(this); |
| + std::set<Profile*>::iterator item = chromevox_profiles_.find(profile_); |
| + if (item != chromevox_profiles_.end()) |
| + chromevox_profiles_.erase(item); |
|
James Cook
2014/01/06 20:38:19
I think you can just do chromevox_profiles_.erase(
|
| } |
| if (profile && spoken_feedback_enabled_) |
| @@ -944,6 +949,7 @@ void AccessibilityManager::SetUpPreLoadChromeVox(Profile* profile) { |
| event_router()->RegisterObserver(this, |
| extensions::api::experimental_accessibility:: |
| OnChromeVoxLoadStateChanged::kEventName); |
| + chromevox_profiles_.insert(profile); |
| } |
| } |
| @@ -952,12 +958,14 @@ void AccessibilityManager::TearDownPostUnloadChromeVox(Profile* profile) { |
| if (profile) { |
| extensions::ExtensionSystem::Get(profile)-> |
| event_router()->UnregisterObserver(this); |
| + std::set<Profile*>::iterator item = chromevox_profiles_.find(profile_); |
| + if (item != chromevox_profiles_.end()) |
|
James Cook
2014/01/06 20:38:19
same thing, I don't think you need to check if it
|
| + chromevox_profiles_.erase(item); |
| } |
| } |
| void AccessibilityManager::PlaySound(int sound_key) const { |
| - if (system_sounds_enabled_) |
| - media::SoundsManager::Get()->Play(sound_key); |
| + media::SoundsManager::Get()->Play(sound_key); |
| } |
| } // namespace chromeos |