| OLD | NEW |
| 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 "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 PrefService* pref_service = profile_->GetPrefs(); | 735 PrefService* pref_service = profile_->GetPrefs(); |
| 736 pref_service->SetBoolean(prefs::kAccessibilityAutoclickEnabled, enabled); | 736 pref_service->SetBoolean(prefs::kAccessibilityAutoclickEnabled, enabled); |
| 737 pref_service->CommitPendingWrite(); | 737 pref_service->CommitPendingWrite(); |
| 738 } | 738 } |
| 739 | 739 |
| 740 bool AccessibilityManager::IsAutoclickEnabled() { | 740 bool AccessibilityManager::IsAutoclickEnabled() { |
| 741 return autoclick_enabled_; | 741 return autoclick_enabled_; |
| 742 } | 742 } |
| 743 | 743 |
| 744 void AccessibilityManager::UpdateAutoclickFromPref() { | 744 void AccessibilityManager::UpdateAutoclickFromPref() { |
| 745 if (!profile_) |
| 746 return; |
| 747 |
| 745 bool enabled = | 748 bool enabled = |
| 746 profile_->GetPrefs()->GetBoolean(prefs::kAccessibilityAutoclickEnabled); | 749 profile_->GetPrefs()->GetBoolean(prefs::kAccessibilityAutoclickEnabled); |
| 747 | 750 |
| 748 if (autoclick_enabled_ == enabled) | 751 if (autoclick_enabled_ == enabled) |
| 749 return; | 752 return; |
| 750 autoclick_enabled_ = enabled; | 753 autoclick_enabled_ = enabled; |
| 751 | 754 |
| 752 #if defined(USE_ASH) && !defined(USE_ATHENA) | 755 #if defined(USE_ASH) && !defined(USE_ATHENA) |
| 753 ash::Shell::GetInstance()->autoclick_controller()->SetEnabled(enabled); | 756 ash::Shell::GetInstance()->autoclick_controller()->SetEnabled(enabled); |
| 754 #endif | 757 #endif |
| 755 } | 758 } |
| 756 | 759 |
| 757 void AccessibilityManager::SetAutoclickDelay(int delay_ms) { | 760 void AccessibilityManager::SetAutoclickDelay(int delay_ms) { |
| 758 if (!profile_) | 761 if (!profile_) |
| 759 return; | 762 return; |
| 760 | 763 |
| 761 PrefService* pref_service = profile_->GetPrefs(); | 764 PrefService* pref_service = profile_->GetPrefs(); |
| 762 pref_service->SetInteger(prefs::kAccessibilityAutoclickDelayMs, delay_ms); | 765 pref_service->SetInteger(prefs::kAccessibilityAutoclickDelayMs, delay_ms); |
| 763 pref_service->CommitPendingWrite(); | 766 pref_service->CommitPendingWrite(); |
| 764 } | 767 } |
| 765 | 768 |
| 766 int AccessibilityManager::GetAutoclickDelay() const { | 769 int AccessibilityManager::GetAutoclickDelay() const { |
| 767 return autoclick_delay_ms_; | 770 return autoclick_delay_ms_; |
| 768 } | 771 } |
| 769 | 772 |
| 770 void AccessibilityManager::UpdateAutoclickDelayFromPref() { | 773 void AccessibilityManager::UpdateAutoclickDelayFromPref() { |
| 774 if (!profile_) |
| 775 return; |
| 776 |
| 771 int autoclick_delay_ms = | 777 int autoclick_delay_ms = |
| 772 profile_->GetPrefs()->GetInteger(prefs::kAccessibilityAutoclickDelayMs); | 778 profile_->GetPrefs()->GetInteger(prefs::kAccessibilityAutoclickDelayMs); |
| 773 | 779 |
| 774 if (autoclick_delay_ms == autoclick_delay_ms_) | 780 if (autoclick_delay_ms == autoclick_delay_ms_) |
| 775 return; | 781 return; |
| 776 autoclick_delay_ms_ = autoclick_delay_ms; | 782 autoclick_delay_ms_ = autoclick_delay_ms; |
| 777 | 783 |
| 778 #if defined(USE_ASH) && !defined(USE_ATHENA) | 784 #if defined(USE_ASH) && !defined(USE_ATHENA) |
| 779 ash::Shell::GetInstance()->autoclick_controller()->SetAutoclickDelay( | 785 ash::Shell::GetInstance()->autoclick_controller()->SetAutoclickDelay( |
| 780 autoclick_delay_ms_); | 786 autoclick_delay_ms_); |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1153 // Do any teardown work needed immediately after ChromeVox actually unloads. | 1159 // Do any teardown work needed immediately after ChromeVox actually unloads. |
| 1154 if (system_sounds_enabled_) | 1160 if (system_sounds_enabled_) |
| 1155 ash::PlaySystemSoundAlways(SOUND_SPOKEN_FEEDBACK_DISABLED); | 1161 ash::PlaySystemSoundAlways(SOUND_SPOKEN_FEEDBACK_DISABLED); |
| 1156 #endif | 1162 #endif |
| 1157 // Clear the accessibility focus ring. | 1163 // Clear the accessibility focus ring. |
| 1158 AccessibilityFocusRingController::GetInstance()->SetFocusRing( | 1164 AccessibilityFocusRingController::GetInstance()->SetFocusRing( |
| 1159 std::vector<gfx::Rect>()); | 1165 std::vector<gfx::Rect>()); |
| 1160 } | 1166 } |
| 1161 | 1167 |
| 1162 } // namespace chromeos | 1168 } // namespace chromeos |
| OLD | NEW |