| 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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 NOTREACHED(); | 307 NOTREACHED(); |
| 308 chromevox_loader_ = base::WrapUnique(new AccessibilityExtensionLoader( | 308 chromevox_loader_ = base::WrapUnique(new AccessibilityExtensionLoader( |
| 309 extension_misc::kChromeVoxExtensionId, | 309 extension_misc::kChromeVoxExtensionId, |
| 310 resources_path.Append(extension_misc::kChromeVoxExtensionPath), | 310 resources_path.Append(extension_misc::kChromeVoxExtensionPath), |
| 311 base::Bind(&AccessibilityManager::PostUnloadChromeVox, | 311 base::Bind(&AccessibilityManager::PostUnloadChromeVox, |
| 312 weak_ptr_factory_.GetWeakPtr()))); | 312 weak_ptr_factory_.GetWeakPtr()))); |
| 313 select_to_speak_loader_ = base::WrapUnique(new AccessibilityExtensionLoader( | 313 select_to_speak_loader_ = base::WrapUnique(new AccessibilityExtensionLoader( |
| 314 extension_misc::kSelectToSpeakExtensionId, | 314 extension_misc::kSelectToSpeakExtensionId, |
| 315 resources_path.Append(extension_misc::kSelectToSpeakExtensionPath), | 315 resources_path.Append(extension_misc::kSelectToSpeakExtensionPath), |
| 316 base::Closure())); | 316 base::Closure())); |
| 317 switch_access_loader_ = base::WrapUnique(new AccessibilityExtensionLoader( |
| 318 extension_misc::kSwitchAccessExtensionId, |
| 319 resources_path.Append(extension_misc::kSwitchAccessExtensionPath), |
| 320 base::Closure())); |
| 317 } | 321 } |
| 318 | 322 |
| 319 AccessibilityManager::~AccessibilityManager() { | 323 AccessibilityManager::~AccessibilityManager() { |
| 320 CHECK(this == g_accessibility_manager); | 324 CHECK(this == g_accessibility_manager); |
| 321 AccessibilityStatusEventDetails details(ACCESSIBILITY_MANAGER_SHUTDOWN, false, | 325 AccessibilityStatusEventDetails details(ACCESSIBILITY_MANAGER_SHUTDOWN, false, |
| 322 ash::A11Y_NOTIFICATION_NONE); | 326 ash::A11Y_NOTIFICATION_NONE); |
| 323 NotifyAccessibilityStatusChanged(details); | 327 NotifyAccessibilityStatusChanged(details); |
| 324 input_method::InputMethodManager::Get()->RemoveObserver(this); | 328 input_method::InputMethodManager::Get()->RemoveObserver(this); |
| 325 | 329 |
| 326 if (chromevox_panel_) { | 330 if (chromevox_panel_) { |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 918 if (!profile_) | 922 if (!profile_) |
| 919 return; | 923 return; |
| 920 | 924 |
| 921 const bool enabled = profile_->GetPrefs()->GetBoolean( | 925 const bool enabled = profile_->GetPrefs()->GetBoolean( |
| 922 prefs::kAccessibilitySwitchAccessEnabled); | 926 prefs::kAccessibilitySwitchAccessEnabled); |
| 923 | 927 |
| 924 if (switch_access_enabled_ == enabled) | 928 if (switch_access_enabled_ == enabled) |
| 925 return; | 929 return; |
| 926 switch_access_enabled_ = enabled; | 930 switch_access_enabled_ = enabled; |
| 927 | 931 |
| 928 // TODO(dmazzoni): implement feature here. | 932 if (enabled) { |
| 933 switch_access_loader_->Load(profile_, base::Closure() /* done_cb */); |
| 934 } else { |
| 935 switch_access_loader_->Unload(); |
| 936 } |
| 929 } | 937 } |
| 930 | 938 |
| 931 void AccessibilityManager::UpdateAccessibilityHighlightingFromPrefs() { | 939 void AccessibilityManager::UpdateAccessibilityHighlightingFromPrefs() { |
| 932 if (!focus_highlight_enabled_ && !caret_highlight_enabled_ && | 940 if (!focus_highlight_enabled_ && !caret_highlight_enabled_ && |
| 933 !cursor_highlight_enabled_) { | 941 !cursor_highlight_enabled_) { |
| 934 if (accessibility_highlight_manager_) | 942 if (accessibility_highlight_manager_) |
| 935 accessibility_highlight_manager_.reset(); | 943 accessibility_highlight_manager_.reset(); |
| 936 return; | 944 return; |
| 937 } | 945 } |
| 938 | 946 |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1379 content::BrowserContext* context) { | 1387 content::BrowserContext* context) { |
| 1380 keyboard_listener_extension_id_ = id; | 1388 keyboard_listener_extension_id_ = id; |
| 1381 | 1389 |
| 1382 extensions::ExtensionRegistry* registry = | 1390 extensions::ExtensionRegistry* registry = |
| 1383 extensions::ExtensionRegistry::Get(context); | 1391 extensions::ExtensionRegistry::Get(context); |
| 1384 if (!extension_registry_observer_.IsObserving(registry) && !id.empty()) | 1392 if (!extension_registry_observer_.IsObserving(registry) && !id.empty()) |
| 1385 extension_registry_observer_.Add(registry); | 1393 extension_registry_observer_.Add(registry); |
| 1386 } | 1394 } |
| 1387 | 1395 |
| 1388 } // namespace chromeos | 1396 } // namespace chromeos |
| OLD | NEW |