| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 bundle.GetRawDataResource(IDR_SOUND_ENTER_SCREEN_WAV)); | 297 bundle.GetRawDataResource(IDR_SOUND_ENTER_SCREEN_WAV)); |
| 298 | 298 |
| 299 base::FilePath resources_path; | 299 base::FilePath resources_path; |
| 300 if (!PathService::Get(chrome::DIR_RESOURCES, &resources_path)) | 300 if (!PathService::Get(chrome::DIR_RESOURCES, &resources_path)) |
| 301 NOTREACHED(); | 301 NOTREACHED(); |
| 302 chromevox_loader_ = base::WrapUnique(new AccessibilityExtensionLoader( | 302 chromevox_loader_ = base::WrapUnique(new AccessibilityExtensionLoader( |
| 303 extension_misc::kChromeVoxExtensionId, | 303 extension_misc::kChromeVoxExtensionId, |
| 304 resources_path.Append(extension_misc::kChromeVoxExtensionPath), | 304 resources_path.Append(extension_misc::kChromeVoxExtensionPath), |
| 305 base::Bind(&AccessibilityManager::PostUnloadChromeVox, | 305 base::Bind(&AccessibilityManager::PostUnloadChromeVox, |
| 306 weak_ptr_factory_.GetWeakPtr()))); | 306 weak_ptr_factory_.GetWeakPtr()))); |
| 307 select_to_speak_loader_ = base::WrapUnique(new AccessibilityExtensionLoader( |
| 308 extension_misc::kSelectToSpeakExtensionId, |
| 309 resources_path.Append(extension_misc::kSelectToSpeakExtensionPath), |
| 310 base::Closure())); |
| 307 } | 311 } |
| 308 | 312 |
| 309 AccessibilityManager::~AccessibilityManager() { | 313 AccessibilityManager::~AccessibilityManager() { |
| 310 CHECK(this == g_accessibility_manager); | 314 CHECK(this == g_accessibility_manager); |
| 311 AccessibilityStatusEventDetails details(ACCESSIBILITY_MANAGER_SHUTDOWN, false, | 315 AccessibilityStatusEventDetails details(ACCESSIBILITY_MANAGER_SHUTDOWN, false, |
| 312 ash::A11Y_NOTIFICATION_NONE); | 316 ash::A11Y_NOTIFICATION_NONE); |
| 313 NotifyAccessibilityStatusChanged(details); | 317 NotifyAccessibilityStatusChanged(details); |
| 314 input_method::InputMethodManager::Get()->RemoveObserver(this); | 318 input_method::InputMethodManager::Get()->RemoveObserver(this); |
| 315 | 319 |
| 316 if (chromevox_panel_) { | 320 if (chromevox_panel_) { |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 if (!profile_) | 836 if (!profile_) |
| 833 return; | 837 return; |
| 834 | 838 |
| 835 const bool enabled = profile_->GetPrefs()->GetBoolean( | 839 const bool enabled = profile_->GetPrefs()->GetBoolean( |
| 836 prefs::kAccessibilitySelectToSpeakEnabled); | 840 prefs::kAccessibilitySelectToSpeakEnabled); |
| 837 | 841 |
| 838 if (select_to_speak_enabled_ == enabled) | 842 if (select_to_speak_enabled_ == enabled) |
| 839 return; | 843 return; |
| 840 select_to_speak_enabled_ = enabled; | 844 select_to_speak_enabled_ = enabled; |
| 841 | 845 |
| 842 // TODO(dmazzoni): implement feature here. | 846 if (enabled) { |
| 847 select_to_speak_loader_->Load(profile_, "" /* init_script_str */, |
| 848 base::Closure() /* done_cb */); |
| 849 } else { |
| 850 select_to_speak_loader_->Unload(); |
| 851 } |
| 843 } | 852 } |
| 844 | 853 |
| 845 void AccessibilityManager::SetSwitchAccessEnabled(bool enabled) { | 854 void AccessibilityManager::SetSwitchAccessEnabled(bool enabled) { |
| 846 if (!profile_) | 855 if (!profile_) |
| 847 return; | 856 return; |
| 848 | 857 |
| 849 PrefService* pref_service = profile_->GetPrefs(); | 858 PrefService* pref_service = profile_->GetPrefs(); |
| 850 pref_service->SetBoolean(prefs::kAccessibilitySwitchAccessEnabled, enabled); | 859 pref_service->SetBoolean(prefs::kAccessibilitySwitchAccessEnabled, enabled); |
| 851 pref_service->CommitPendingWrite(); | 860 pref_service->CommitPendingWrite(); |
| 852 } | 861 } |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1333 content::BrowserContext* context) { | 1342 content::BrowserContext* context) { |
| 1334 keyboard_listener_extension_id_ = id; | 1343 keyboard_listener_extension_id_ = id; |
| 1335 | 1344 |
| 1336 extensions::ExtensionRegistry* registry = | 1345 extensions::ExtensionRegistry* registry = |
| 1337 extensions::ExtensionRegistry::Get(context); | 1346 extensions::ExtensionRegistry::Get(context); |
| 1338 if (!extension_registry_observer_.IsObserving(registry) && !id.empty()) | 1347 if (!extension_registry_observer_.IsObserving(registry) && !id.empty()) |
| 1339 extension_registry_observer_.Add(registry); | 1348 extension_registry_observer_.Add(registry); |
| 1340 } | 1349 } |
| 1341 | 1350 |
| 1342 } // namespace chromeos | 1351 } // namespace chromeos |
| OLD | NEW |