Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(368)

Side by Side Diff: chrome/browser/chromeos/accessibility/accessibility_manager.cc

Issue 123443002: Track all profiles ChromeVox loads to. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address reviewer comments. Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/accessibility/accessibility_manager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/chromeos/accessibility/accessibility_manager.h" 5 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
6 6
7 #include "ash/autoclick/autoclick_controller.h" 7 #include "ash/autoclick/autoclick_controller.h"
8 #include "ash/high_contrast/high_contrast_controller.h" 8 #include "ash/high_contrast/high_contrast_controller.h"
9 #include "ash/metrics/user_metrics_recorder.h" 9 #include "ash/metrics/user_metrics_recorder.h"
10 #include "ash/session_state_delegate.h" 10 #include "ash/session_state_delegate.h"
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 manager->Initialize( 336 manager->Initialize(
337 SOUND_SPOKEN_FEEDBACK_DISABLED, 337 SOUND_SPOKEN_FEEDBACK_DISABLED,
338 bundle.GetRawDataResource(IDR_SOUND_SPOKEN_FEEDBACK_DISABLED_WAV)); 338 bundle.GetRawDataResource(IDR_SOUND_SPOKEN_FEEDBACK_DISABLED_WAV));
339 } 339 }
340 340
341 AccessibilityManager::~AccessibilityManager() { 341 AccessibilityManager::~AccessibilityManager() {
342 CHECK(this == g_accessibility_manager); 342 CHECK(this == g_accessibility_manager);
343 343
344 // Component extensions don't always notify us when they're unloaded. Ensure 344 // Component extensions don't always notify us when they're unloaded. Ensure
345 // we clean up ChromeVox observers here. 345 // we clean up ChromeVox observers here.
346 if (profile_) { 346 for (std::set<Profile*>::iterator it = chromevox_profiles_.begin();
347 extensions::ExtensionSystem::Get(profile_)-> 347 it != chromevox_profiles_.end();
348 it++) {
349 extensions::ExtensionSystem::Get(*it)->
348 event_router()->UnregisterObserver(this); 350 event_router()->UnregisterObserver(this);
349 } 351 }
350 } 352 }
351 353
352 bool AccessibilityManager::ShouldShowAccessibilityMenu() { 354 bool AccessibilityManager::ShouldShowAccessibilityMenu() {
353 // If any of the loaded profiles has an accessibility feature turned on - or 355 // If any of the loaded profiles has an accessibility feature turned on - or
354 // enforced to always show the menu - we return true to show the menu. 356 // enforced to always show the menu - we return true to show the menu.
355 std::vector<Profile*> profiles = 357 std::vector<Profile*> profiles =
356 g_browser_process->profile_manager()->GetLoadedProfiles(); 358 g_browser_process->profile_manager()->GetLoadedProfiles();
357 for (std::vector<Profile*>::iterator it = profiles.begin(); 359 for (std::vector<Profile*>::iterator it = profiles.begin();
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 &AccessibilityManager::UpdateChromeOSAccessibilityHistograms, 737 &AccessibilityManager::UpdateChromeOSAccessibilityHistograms,
736 base::Unretained(this))); 738 base::Unretained(this)));
737 } 739 }
738 740
739 large_cursor_pref_handler_.HandleProfileChanged(profile_, profile); 741 large_cursor_pref_handler_.HandleProfileChanged(profile_, profile);
740 spoken_feedback_pref_handler_.HandleProfileChanged(profile_, profile); 742 spoken_feedback_pref_handler_.HandleProfileChanged(profile_, profile);
741 high_contrast_pref_handler_.HandleProfileChanged(profile_, profile); 743 high_contrast_pref_handler_.HandleProfileChanged(profile_, profile);
742 autoclick_pref_handler_.HandleProfileChanged(profile_, profile); 744 autoclick_pref_handler_.HandleProfileChanged(profile_, profile);
743 autoclick_delay_pref_handler_.HandleProfileChanged(profile_, profile); 745 autoclick_delay_pref_handler_.HandleProfileChanged(profile_, profile);
744 746
745 if (!profile && profile_) {
746 extensions::ExtensionSystem::Get(profile_)->
747 event_router()->UnregisterObserver(this);
748 }
749
750 if (profile && spoken_feedback_enabled_) 747 if (profile && spoken_feedback_enabled_)
751 SetUpPreLoadChromeVox(profile); 748 SetUpPreLoadChromeVox(profile);
752 749
753 if (!profile_ && profile) 750 if (!profile_ && profile)
754 CheckBrailleState(); 751 CheckBrailleState();
755 752
756 profile_ = profile; 753 profile_ = profile;
757 UpdateLargeCursorFromPref(); 754 UpdateLargeCursorFromPref();
758 UpdateStickyKeysFromPref(); 755 UpdateStickyKeysFromPref();
759 UpdateSpokenFeedbackFromPref(); 756 UpdateSpokenFeedbackFromPref();
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 // Add a session state observer to be able to monitor session changes. 846 // Add a session state observer to be able to monitor session changes.
850 if (!session_state_observer_.get() && ash::Shell::HasInstance()) 847 if (!session_state_observer_.get() && ash::Shell::HasInstance())
851 session_state_observer_.reset( 848 session_state_observer_.reset(
852 new ash::ScopedSessionStateObserver(this)); 849 new ash::ScopedSessionStateObserver(this));
853 break; 850 break;
854 case chrome::NOTIFICATION_PROFILE_DESTROYED: { 851 case chrome::NOTIFICATION_PROFILE_DESTROYED: {
855 // Update |profile_| when exiting a session or shutting down. 852 // Update |profile_| when exiting a session or shutting down.
856 Profile* profile = content::Source<Profile>(source).ptr(); 853 Profile* profile = content::Source<Profile>(source).ptr();
857 if (profile_ == profile) 854 if (profile_ == profile)
858 SetProfile(NULL); 855 SetProfile(NULL);
856
857 if (IsSpokenFeedbackEnabled())
858 TearDownPostUnloadChromeVox(profile);
859 break; 859 break;
860 } 860 }
861 case chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED: { 861 case chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED: {
862 bool is_screen_locked = *content::Details<bool>(details).ptr(); 862 bool is_screen_locked = *content::Details<bool>(details).ptr();
863 if (spoken_feedback_enabled_) { 863 if (spoken_feedback_enabled_) {
864 if (is_screen_locked) { 864 if (is_screen_locked) {
865 LoadChromeVoxToLockScreen(); 865 LoadChromeVoxToLockScreen();
866 866
867 // Status tray gets verbalized by user screen ChromeVox, so we need 867 // Status tray gets verbalized by user screen ChromeVox, so we need
868 // this as well. 868 // this as well.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 937
938 void AccessibilityManager::SetUpPreLoadChromeVox(Profile* profile) { 938 void AccessibilityManager::SetUpPreLoadChromeVox(Profile* profile) {
939 // Do any setup work needed immediately before ChromeVox actually loads. 939 // Do any setup work needed immediately before ChromeVox actually loads.
940 PlaySound(SOUND_SPOKEN_FEEDBACK_ENABLED); 940 PlaySound(SOUND_SPOKEN_FEEDBACK_ENABLED);
941 941
942 if (profile) { 942 if (profile) {
943 extensions::ExtensionSystem::Get(profile)-> 943 extensions::ExtensionSystem::Get(profile)->
944 event_router()->RegisterObserver(this, 944 event_router()->RegisterObserver(this,
945 extensions::api::experimental_accessibility:: 945 extensions::api::experimental_accessibility::
946 OnChromeVoxLoadStateChanged::kEventName); 946 OnChromeVoxLoadStateChanged::kEventName);
947 chromevox_profiles_.insert(profile);
947 } 948 }
948 } 949 }
949 950
950 void AccessibilityManager::TearDownPostUnloadChromeVox(Profile* profile) { 951 void AccessibilityManager::TearDownPostUnloadChromeVox(Profile* profile) {
951 // Do any teardown work needed immediately after ChromeVox actually unloads. 952 // Do any teardown work needed immediately after ChromeVox actually unloads.
952 if (profile) { 953 if (profile) {
953 extensions::ExtensionSystem::Get(profile)-> 954 extensions::ExtensionSystem::Get(profile)->
954 event_router()->UnregisterObserver(this); 955 event_router()->UnregisterObserver(this);
956 chromevox_profiles_.erase(profile);
955 } 957 }
956 } 958 }
957 959
958 void AccessibilityManager::PlaySound(int sound_key) const { 960 void AccessibilityManager::PlaySound(int sound_key) const {
959 if (system_sounds_enabled_) 961 media::SoundsManager::Get()->Play(sound_key);
960 media::SoundsManager::Get()->Play(sound_key);
961 } 962 }
962 963
963 } // namespace chromeos 964 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/accessibility/accessibility_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698