| 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 20 matching lines...) Expand all Loading... |
| 31 #include "base/strings/string_split.h" | 31 #include "base/strings/string_split.h" |
| 32 #include "base/strings/string_util.h" | 32 #include "base/strings/string_util.h" |
| 33 #include "base/time/time.h" | 33 #include "base/time/time.h" |
| 34 #include "base/values.h" | 34 #include "base/values.h" |
| 35 #include "chrome/browser/accessibility/accessibility_extension_api.h" | 35 #include "chrome/browser/accessibility/accessibility_extension_api.h" |
| 36 #include "chrome/browser/browser_process.h" | 36 #include "chrome/browser/browser_process.h" |
| 37 #include "chrome/browser/chrome_notification_types.h" | 37 #include "chrome/browser/chrome_notification_types.h" |
| 38 #include "chrome/browser/chromeos/accessibility/accessibility_extension_loader.h
" | 38 #include "chrome/browser/chromeos/accessibility/accessibility_extension_loader.h
" |
| 39 #include "chrome/browser/chromeos/accessibility/accessibility_highlight_manager.
h" | 39 #include "chrome/browser/chromeos/accessibility/accessibility_highlight_manager.
h" |
| 40 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" | 40 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
| 41 #include "chrome/browser/chromeos/accessibility/select_to_speak_event_handler.h" |
| 41 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 42 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 42 #include "chrome/browser/chromeos/ui/accessibility_focus_ring_controller.h" | 43 #include "chrome/browser/chromeos/ui/accessibility_focus_ring_controller.h" |
| 43 #include "chrome/browser/extensions/api/braille_display_private/stub_braille_con
troller.h" | 44 #include "chrome/browser/extensions/api/braille_display_private/stub_braille_con
troller.h" |
| 44 #include "chrome/browser/extensions/extension_service.h" | 45 #include "chrome/browser/extensions/extension_service.h" |
| 45 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 46 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 46 #include "chrome/browser/profiles/profile.h" | 47 #include "chrome/browser/profiles/profile.h" |
| 47 #include "chrome/browser/profiles/profile_manager.h" | 48 #include "chrome/browser/profiles/profile_manager.h" |
| 48 #include "chrome/browser/ui/ash/ash_util.h" | 49 #include "chrome/browser/ui/ash/ash_util.h" |
| 49 #include "chrome/common/chrome_paths.h" | 50 #include "chrome/common/chrome_paths.h" |
| 50 #include "chrome/common/extensions/api/accessibility_private.h" | 51 #include "chrome/common/extensions/api/accessibility_private.h" |
| (...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 const bool enabled = profile_->GetPrefs()->GetBoolean( | 844 const bool enabled = profile_->GetPrefs()->GetBoolean( |
| 844 prefs::kAccessibilitySelectToSpeakEnabled); | 845 prefs::kAccessibilitySelectToSpeakEnabled); |
| 845 | 846 |
| 846 if (select_to_speak_enabled_ == enabled) | 847 if (select_to_speak_enabled_ == enabled) |
| 847 return; | 848 return; |
| 848 select_to_speak_enabled_ = enabled; | 849 select_to_speak_enabled_ = enabled; |
| 849 | 850 |
| 850 if (enabled) { | 851 if (enabled) { |
| 851 select_to_speak_loader_->Load(profile_, "" /* init_script_str */, | 852 select_to_speak_loader_->Load(profile_, "" /* init_script_str */, |
| 852 base::Closure() /* done_cb */); | 853 base::Closure() /* done_cb */); |
| 854 select_to_speak_event_handler_.reset( |
| 855 new chromeos::SelectToSpeakEventHandler()); |
| 853 } else { | 856 } else { |
| 854 select_to_speak_loader_->Unload(); | 857 select_to_speak_loader_->Unload(); |
| 858 select_to_speak_event_handler_.reset(nullptr); |
| 855 } | 859 } |
| 856 } | 860 } |
| 857 | 861 |
| 858 void AccessibilityManager::SetSwitchAccessEnabled(bool enabled) { | 862 void AccessibilityManager::SetSwitchAccessEnabled(bool enabled) { |
| 859 if (!profile_) | 863 if (!profile_) |
| 860 return; | 864 return; |
| 861 | 865 |
| 862 PrefService* pref_service = profile_->GetPrefs(); | 866 PrefService* pref_service = profile_->GetPrefs(); |
| 863 pref_service->SetBoolean(prefs::kAccessibilitySwitchAccessEnabled, enabled); | 867 pref_service->SetBoolean(prefs::kAccessibilitySwitchAccessEnabled, enabled); |
| 864 pref_service->CommitPendingWrite(); | 868 pref_service->CommitPendingWrite(); |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1358 content::BrowserContext* context) { | 1362 content::BrowserContext* context) { |
| 1359 keyboard_listener_extension_id_ = id; | 1363 keyboard_listener_extension_id_ = id; |
| 1360 | 1364 |
| 1361 extensions::ExtensionRegistry* registry = | 1365 extensions::ExtensionRegistry* registry = |
| 1362 extensions::ExtensionRegistry::Get(context); | 1366 extensions::ExtensionRegistry::Get(context); |
| 1363 if (!extension_registry_observer_.IsObserving(registry) && !id.empty()) | 1367 if (!extension_registry_observer_.IsObserving(registry) && !id.empty()) |
| 1364 extension_registry_observer_.Add(registry); | 1368 extension_registry_observer_.Add(registry); |
| 1365 } | 1369 } |
| 1366 | 1370 |
| 1367 } // namespace chromeos | 1371 } // namespace chromeos |
| OLD | NEW |