| 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 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 if (!profile_) | 655 if (!profile_) |
| 656 return; | 656 return; |
| 657 | 657 |
| 658 bool enabled = | 658 bool enabled = |
| 659 profile_->GetPrefs()->GetBoolean(prefs::kAccessibilityAutoclickEnabled); | 659 profile_->GetPrefs()->GetBoolean(prefs::kAccessibilityAutoclickEnabled); |
| 660 | 660 |
| 661 if (autoclick_enabled_ == enabled) | 661 if (autoclick_enabled_ == enabled) |
| 662 return; | 662 return; |
| 663 autoclick_enabled_ = enabled; | 663 autoclick_enabled_ = enabled; |
| 664 | 664 |
| 665 if (ash_util::IsRunningInMash()) { | 665 if (IsRunningInMash()) { |
| 666 service_manager::Connector* connector = | 666 service_manager::Connector* connector = |
| 667 content::ServiceManagerConnection::GetForProcess()->GetConnector(); | 667 content::ServiceManagerConnection::GetForProcess()->GetConnector(); |
| 668 mash::mojom::LaunchablePtr launchable; | 668 mash::mojom::LaunchablePtr launchable; |
| 669 connector->BindInterface("accessibility_autoclick", &launchable); | 669 connector->BindInterface("accessibility_autoclick", &launchable); |
| 670 launchable->Launch(mash::mojom::kWindow, mash::mojom::LaunchMode::DEFAULT); | 670 launchable->Launch(mash::mojom::kWindow, mash::mojom::LaunchMode::DEFAULT); |
| 671 return; | 671 return; |
| 672 } | 672 } |
| 673 | 673 |
| 674 ash::Shell::GetInstance()->autoclick_controller()->SetEnabled(enabled); | 674 ash::Shell::GetInstance()->autoclick_controller()->SetEnabled(enabled); |
| 675 } | 675 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 692 return; | 692 return; |
| 693 | 693 |
| 694 base::TimeDelta autoclick_delay_ms = base::TimeDelta::FromMilliseconds( | 694 base::TimeDelta autoclick_delay_ms = base::TimeDelta::FromMilliseconds( |
| 695 int64_t{profile_->GetPrefs()->GetInteger( | 695 int64_t{profile_->GetPrefs()->GetInteger( |
| 696 prefs::kAccessibilityAutoclickDelayMs)}); | 696 prefs::kAccessibilityAutoclickDelayMs)}); |
| 697 | 697 |
| 698 if (autoclick_delay_ms == autoclick_delay_ms_) | 698 if (autoclick_delay_ms == autoclick_delay_ms_) |
| 699 return; | 699 return; |
| 700 autoclick_delay_ms_ = autoclick_delay_ms; | 700 autoclick_delay_ms_ = autoclick_delay_ms; |
| 701 | 701 |
| 702 if (ash_util::IsRunningInMash()) { | 702 if (IsRunningInMash()) { |
| 703 service_manager::Connector* connector = | 703 service_manager::Connector* connector = |
| 704 content::ServiceManagerConnection::GetForProcess()->GetConnector(); | 704 content::ServiceManagerConnection::GetForProcess()->GetConnector(); |
| 705 ash::autoclick::mojom::AutoclickControllerPtr autoclick_controller; | 705 ash::autoclick::mojom::AutoclickControllerPtr autoclick_controller; |
| 706 connector->BindInterface("accessibility_autoclick", &autoclick_controller); | 706 connector->BindInterface("accessibility_autoclick", &autoclick_controller); |
| 707 autoclick_controller->SetAutoclickDelay( | 707 autoclick_controller->SetAutoclickDelay( |
| 708 autoclick_delay_ms_.InMilliseconds()); | 708 autoclick_delay_ms_.InMilliseconds()); |
| 709 return; | 709 return; |
| 710 } | 710 } |
| 711 | 711 |
| 712 ash::Shell::GetInstance()->autoclick_controller()->SetAutoclickDelay( | 712 ash::Shell::GetInstance()->autoclick_controller()->SetAutoclickDelay( |
| (...skipping 19 matching lines...) Expand all Loading... |
| 732 return; | 732 return; |
| 733 | 733 |
| 734 const bool enabled = profile_->GetPrefs()->GetBoolean( | 734 const bool enabled = profile_->GetPrefs()->GetBoolean( |
| 735 prefs::kAccessibilityVirtualKeyboardEnabled); | 735 prefs::kAccessibilityVirtualKeyboardEnabled); |
| 736 | 736 |
| 737 if (virtual_keyboard_enabled_ == enabled) | 737 if (virtual_keyboard_enabled_ == enabled) |
| 738 return; | 738 return; |
| 739 virtual_keyboard_enabled_ = enabled; | 739 virtual_keyboard_enabled_ = enabled; |
| 740 | 740 |
| 741 keyboard::SetAccessibilityKeyboardEnabled(enabled); | 741 keyboard::SetAccessibilityKeyboardEnabled(enabled); |
| 742 if (!ash_util::IsRunningInMash()) { | 742 if (!IsRunningInMash()) { |
| 743 // Note that there are two versions of the on-screen keyboard. A full layout | 743 // Note that there are two versions of the on-screen keyboard. A full layout |
| 744 // is provided for accessibility, which includes sticky modifier keys to | 744 // is provided for accessibility, which includes sticky modifier keys to |
| 745 // enable typing of hotkeys. A compact version is used in touchview mode | 745 // enable typing of hotkeys. A compact version is used in touchview mode |
| 746 // to provide a layout with larger keys to facilitate touch typing. In the | 746 // to provide a layout with larger keys to facilitate touch typing. In the |
| 747 // event that the a11y keyboard is being disabled, an on-screen keyboard | 747 // event that the a11y keyboard is being disabled, an on-screen keyboard |
| 748 // might still be enabled and a forced reset is required to pick up the | 748 // might still be enabled and a forced reset is required to pick up the |
| 749 // layout change. | 749 // layout change. |
| 750 if (keyboard::IsKeyboardEnabled()) | 750 if (keyboard::IsKeyboardEnabled()) |
| 751 ash::Shell::GetInstance()->CreateKeyboard(); | 751 ash::Shell::GetInstance()->CreateKeyboard(); |
| 752 else | 752 else |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1015 braille_ime_current_ = false; | 1015 braille_ime_current_ = false; |
| 1016 } | 1016 } |
| 1017 | 1017 |
| 1018 // Overridden from InputMethodManager::Observer. | 1018 // Overridden from InputMethodManager::Observer. |
| 1019 void AccessibilityManager::InputMethodChanged( | 1019 void AccessibilityManager::InputMethodChanged( |
| 1020 input_method::InputMethodManager* manager, | 1020 input_method::InputMethodManager* manager, |
| 1021 Profile* /* profile */, | 1021 Profile* /* profile */, |
| 1022 bool show_message) { | 1022 bool show_message) { |
| 1023 // Sticky keys is implemented only in ash. | 1023 // Sticky keys is implemented only in ash. |
| 1024 // TODO(dpolukhin): support Athena, crbug.com/408733. | 1024 // TODO(dpolukhin): support Athena, crbug.com/408733. |
| 1025 if (!ash_util::IsRunningInMash()) { | 1025 if (!IsRunningInMash()) { |
| 1026 ash::Shell::GetInstance()->sticky_keys_controller()->SetModifiersEnabled( | 1026 ash::Shell::GetInstance()->sticky_keys_controller()->SetModifiersEnabled( |
| 1027 manager->IsISOLevel5ShiftUsedByCurrentInputMethod(), | 1027 manager->IsISOLevel5ShiftUsedByCurrentInputMethod(), |
| 1028 manager->IsAltGrUsedByCurrentInputMethod()); | 1028 manager->IsAltGrUsedByCurrentInputMethod()); |
| 1029 } | 1029 } |
| 1030 const chromeos::input_method::InputMethodDescriptor descriptor = | 1030 const chromeos::input_method::InputMethodDescriptor descriptor = |
| 1031 manager->GetActiveIMEState()->GetCurrentInputMethod(); | 1031 manager->GetActiveIMEState()->GetCurrentInputMethod(); |
| 1032 braille_ime_current_ = | 1032 braille_ime_current_ = |
| 1033 (descriptor.id() == extension_misc::kBrailleImeEngineId); | 1033 (descriptor.id() == extension_misc::kBrailleImeEngineId); |
| 1034 } | 1034 } |
| 1035 | 1035 |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1404 content::BrowserContext* context) { | 1404 content::BrowserContext* context) { |
| 1405 keyboard_listener_extension_id_ = id; | 1405 keyboard_listener_extension_id_ = id; |
| 1406 | 1406 |
| 1407 extensions::ExtensionRegistry* registry = | 1407 extensions::ExtensionRegistry* registry = |
| 1408 extensions::ExtensionRegistry::Get(context); | 1408 extensions::ExtensionRegistry::Get(context); |
| 1409 if (!extension_registry_observer_.IsObserving(registry) && !id.empty()) | 1409 if (!extension_registry_observer_.IsObserving(registry) && !id.empty()) |
| 1410 extension_registry_observer_.Add(registry); | 1410 extension_registry_observer_.Add(registry); |
| 1411 } | 1411 } |
| 1412 | 1412 |
| 1413 } // namespace chromeos | 1413 } // namespace chromeos |
| OLD | NEW |