| 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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 : profile_(NULL), | 396 : profile_(NULL), |
| 397 chrome_vox_loaded_on_lock_screen_(false), | 397 chrome_vox_loaded_on_lock_screen_(false), |
| 398 chrome_vox_loaded_on_user_screen_(false), | 398 chrome_vox_loaded_on_user_screen_(false), |
| 399 large_cursor_pref_handler_(prefs::kAccessibilityLargeCursorEnabled), | 399 large_cursor_pref_handler_(prefs::kAccessibilityLargeCursorEnabled), |
| 400 spoken_feedback_pref_handler_(prefs::kAccessibilitySpokenFeedbackEnabled), | 400 spoken_feedback_pref_handler_(prefs::kAccessibilitySpokenFeedbackEnabled), |
| 401 high_contrast_pref_handler_(prefs::kAccessibilityHighContrastEnabled), | 401 high_contrast_pref_handler_(prefs::kAccessibilityHighContrastEnabled), |
| 402 autoclick_pref_handler_(prefs::kAccessibilityAutoclickEnabled), | 402 autoclick_pref_handler_(prefs::kAccessibilityAutoclickEnabled), |
| 403 autoclick_delay_pref_handler_(prefs::kAccessibilityAutoclickDelayMs), | 403 autoclick_delay_pref_handler_(prefs::kAccessibilityAutoclickDelayMs), |
| 404 virtual_keyboard_pref_handler_( | 404 virtual_keyboard_pref_handler_( |
| 405 prefs::kAccessibilityVirtualKeyboardEnabled), | 405 prefs::kAccessibilityVirtualKeyboardEnabled), |
| 406 mono_audio_pref_handler_( | 406 mono_audio_pref_handler_(prefs::kAccessibilityMonoAudioEnabled), |
| 407 prefs::kAccessibilityMonoAudioEnabled), | |
| 408 caret_highlight_pref_handler_(prefs::kAccessibilityCaretHighlightEnabled), | 407 caret_highlight_pref_handler_(prefs::kAccessibilityCaretHighlightEnabled), |
| 409 cursor_highlight_pref_handler_( | 408 cursor_highlight_pref_handler_( |
| 410 prefs::kAccessibilityCursorHighlightEnabled), | 409 prefs::kAccessibilityCursorHighlightEnabled), |
| 411 focus_highlight_pref_handler_(prefs::kAccessibilityFocusHighlightEnabled), | 410 focus_highlight_pref_handler_(prefs::kAccessibilityFocusHighlightEnabled), |
| 412 select_to_speak_pref_handler_(prefs::kAccessibilitySelectToSpeakEnabled), | 411 select_to_speak_pref_handler_(prefs::kAccessibilitySelectToSpeakEnabled), |
| 413 switch_access_pref_handler_(prefs::kAccessibilitySwitchAccessEnabled), | 412 switch_access_pref_handler_(prefs::kAccessibilitySwitchAccessEnabled), |
| 414 large_cursor_enabled_(false), | 413 large_cursor_enabled_(false), |
| 415 sticky_keys_enabled_(false), | 414 sticky_keys_enabled_(false), |
| 416 spoken_feedback_enabled_(false), | 415 spoken_feedback_enabled_(false), |
| 417 high_contrast_enabled_(false), | 416 high_contrast_enabled_(false), |
| 418 autoclick_enabled_(false), | 417 autoclick_enabled_(false), |
| 419 autoclick_delay_ms_(ash::AutoclickController::kDefaultAutoclickDelayMs), | 418 autoclick_delay_ms_(ash::AutoclickController::GetDefaultAutoclickDelay()), |
| 420 virtual_keyboard_enabled_(false), | 419 virtual_keyboard_enabled_(false), |
| 421 mono_audio_enabled_(false), | 420 mono_audio_enabled_(false), |
| 422 caret_highlight_enabled_(false), | 421 caret_highlight_enabled_(false), |
| 423 cursor_highlight_enabled_(false), | 422 cursor_highlight_enabled_(false), |
| 424 focus_highlight_enabled_(false), | 423 focus_highlight_enabled_(false), |
| 425 select_to_speak_enabled_(false), | 424 select_to_speak_enabled_(false), |
| 426 switch_access_enabled_(false), | 425 switch_access_enabled_(false), |
| 427 spoken_feedback_notification_(ui::A11Y_NOTIFICATION_NONE), | 426 spoken_feedback_notification_(ui::A11Y_NOTIFICATION_NONE), |
| 428 should_speak_chrome_vox_announcements_on_user_screen_(true), | 427 should_speak_chrome_vox_announcements_on_user_screen_(true), |
| 429 system_sounds_enabled_(false), | 428 system_sounds_enabled_(false), |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 838 void AccessibilityManager::SetAutoclickDelay(int delay_ms) { | 837 void AccessibilityManager::SetAutoclickDelay(int delay_ms) { |
| 839 if (!profile_) | 838 if (!profile_) |
| 840 return; | 839 return; |
| 841 | 840 |
| 842 PrefService* pref_service = profile_->GetPrefs(); | 841 PrefService* pref_service = profile_->GetPrefs(); |
| 843 pref_service->SetInteger(prefs::kAccessibilityAutoclickDelayMs, delay_ms); | 842 pref_service->SetInteger(prefs::kAccessibilityAutoclickDelayMs, delay_ms); |
| 844 pref_service->CommitPendingWrite(); | 843 pref_service->CommitPendingWrite(); |
| 845 } | 844 } |
| 846 | 845 |
| 847 int AccessibilityManager::GetAutoclickDelay() const { | 846 int AccessibilityManager::GetAutoclickDelay() const { |
| 848 return autoclick_delay_ms_; | 847 return int{autoclick_delay_ms_.InMilliseconds()}; |
| 849 } | 848 } |
| 850 | 849 |
| 851 void AccessibilityManager::UpdateAutoclickDelayFromPref() { | 850 void AccessibilityManager::UpdateAutoclickDelayFromPref() { |
| 852 if (!profile_) | 851 if (!profile_) |
| 853 return; | 852 return; |
| 854 | 853 |
| 855 int autoclick_delay_ms = | 854 base::TimeDelta autoclick_delay_ms = base::TimeDelta::FromMilliseconds( |
| 856 profile_->GetPrefs()->GetInteger(prefs::kAccessibilityAutoclickDelayMs); | 855 int64_t{profile_->GetPrefs()->GetInteger( |
| 856 prefs::kAccessibilityAutoclickDelayMs)}); |
| 857 | 857 |
| 858 if (autoclick_delay_ms == autoclick_delay_ms_) | 858 if (autoclick_delay_ms == autoclick_delay_ms_) |
| 859 return; | 859 return; |
| 860 autoclick_delay_ms_ = autoclick_delay_ms; | 860 autoclick_delay_ms_ = autoclick_delay_ms; |
| 861 | 861 |
| 862 ash::Shell::GetInstance()->autoclick_controller()->SetAutoclickDelay( | 862 ash::Shell::GetInstance()->autoclick_controller()->SetAutoclickDelay( |
| 863 autoclick_delay_ms_); | 863 autoclick_delay_ms_); |
| 864 } | 864 } |
| 865 | 865 |
| 866 void AccessibilityManager::EnableVirtualKeyboard(bool enabled) { | 866 void AccessibilityManager::EnableVirtualKeyboard(bool enabled) { |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1535 content::BrowserContext* context) { | 1535 content::BrowserContext* context) { |
| 1536 keyboard_listener_extension_id_ = id; | 1536 keyboard_listener_extension_id_ = id; |
| 1537 | 1537 |
| 1538 extensions::ExtensionRegistry* registry = | 1538 extensions::ExtensionRegistry* registry = |
| 1539 extensions::ExtensionRegistry::Get(context); | 1539 extensions::ExtensionRegistry::Get(context); |
| 1540 if (!extension_registry_observer_.IsObserving(registry) && !id.empty()) | 1540 if (!extension_registry_observer_.IsObserving(registry) && !id.empty()) |
| 1541 extension_registry_observer_.Add(registry); | 1541 extension_registry_observer_.Add(registry); |
| 1542 } | 1542 } |
| 1543 | 1543 |
| 1544 } // namespace chromeos | 1544 } // namespace chromeos |
| OLD | NEW |