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