| 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 "ash/audio/sounds.h" | |
| 8 #include "ash/autoclick/autoclick_controller.h" | |
| 9 #include "ash/high_contrast/high_contrast_controller.h" | |
| 10 #include "ash/metrics/user_metrics_recorder.h" | |
| 11 #include "ash/session/session_state_delegate.h" | |
| 12 #include "ash/shell.h" | |
| 13 #include "ash/sticky_keys/sticky_keys_controller.h" | |
| 14 #include "ash/system/tray/system_tray_notifier.h" | |
| 15 #include "base/callback.h" | 7 #include "base/callback.h" |
| 16 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 17 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 18 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| 19 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 20 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 21 #include "base/prefs/pref_member.h" | 13 #include "base/prefs/pref_member.h" |
| 22 #include "base/prefs/pref_service.h" | 14 #include "base/prefs/pref_service.h" |
| 23 #include "base/strings/string_split.h" | 15 #include "base/strings/string_split.h" |
| 24 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
| 25 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 26 #include "base/values.h" | 18 #include "base/values.h" |
| 27 #include "chrome/browser/accessibility/accessibility_extension_api.h" | 19 #include "chrome/browser/accessibility/accessibility_extension_api.h" |
| 28 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
| 29 #include "chrome/browser/chrome_notification_types.h" | 21 #include "chrome/browser/chrome_notification_types.h" |
| 30 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" | |
| 31 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 22 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
| 32 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 23 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
| 33 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 24 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
| 34 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" | 25 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" |
| 35 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 26 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 36 #include "chrome/browser/extensions/component_loader.h" | 27 #include "chrome/browser/extensions/component_loader.h" |
| 37 #include "chrome/browser/extensions/extension_service.h" | 28 #include "chrome/browser/extensions/extension_service.h" |
| 38 #include "chrome/browser/profiles/profile.h" | 29 #include "chrome/browser/profiles/profile.h" |
| 39 #include "chrome/browser/profiles/profile_manager.h" | 30 #include "chrome/browser/profiles/profile_manager.h" |
| 40 #include "chrome/common/chrome_paths.h" | 31 #include "chrome/common/chrome_paths.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 59 #include "extensions/browser/extension_system.h" | 50 #include "extensions/browser/extension_system.h" |
| 60 #include "extensions/browser/file_reader.h" | 51 #include "extensions/browser/file_reader.h" |
| 61 #include "extensions/common/extension.h" | 52 #include "extensions/common/extension.h" |
| 62 #include "extensions/common/extension_messages.h" | 53 #include "extensions/common/extension_messages.h" |
| 63 #include "extensions/common/extension_resource.h" | 54 #include "extensions/common/extension_resource.h" |
| 64 #include "media/audio/sounds/sounds_manager.h" | 55 #include "media/audio/sounds/sounds_manager.h" |
| 65 #include "ui/base/resource/resource_bundle.h" | 56 #include "ui/base/resource/resource_bundle.h" |
| 66 #include "ui/keyboard/keyboard_controller.h" | 57 #include "ui/keyboard/keyboard_controller.h" |
| 67 #include "ui/keyboard/keyboard_util.h" | 58 #include "ui/keyboard/keyboard_util.h" |
| 68 | 59 |
| 60 #if !defined(USE_ATHENA) |
| 61 #include "ash/audio/sounds.h" |
| 62 #include "ash/autoclick/autoclick_controller.h" |
| 63 #include "ash/high_contrast/high_contrast_controller.h" |
| 64 #include "ash/metrics/user_metrics_recorder.h" |
| 65 #include "ash/session/session_state_delegate.h" |
| 66 #include "ash/shell.h" |
| 67 #include "ash/sticky_keys/sticky_keys_controller.h" |
| 68 #include "ash/system/tray/system_tray_notifier.h" |
| 69 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
| 70 #endif |
| 71 |
| 69 using content::BrowserThread; | 72 using content::BrowserThread; |
| 70 using content::RenderViewHost; | 73 using content::RenderViewHost; |
| 71 using extensions::api::braille_display_private::BrailleController; | 74 using extensions::api::braille_display_private::BrailleController; |
| 72 using extensions::api::braille_display_private::DisplayState; | 75 using extensions::api::braille_display_private::DisplayState; |
| 73 using extensions::api::braille_display_private::KeyEvent; | 76 using extensions::api::braille_display_private::KeyEvent; |
| 74 | 77 |
| 75 namespace chromeos { | 78 namespace chromeos { |
| 76 | 79 |
| 77 namespace { | 80 namespace { |
| 78 | 81 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 } | 241 } |
| 239 | 242 |
| 240 } // namespace | 243 } // namespace |
| 241 | 244 |
| 242 /////////////////////////////////////////////////////////////////////////////// | 245 /////////////////////////////////////////////////////////////////////////////// |
| 243 // AccessibilityStatusEventDetails | 246 // AccessibilityStatusEventDetails |
| 244 | 247 |
| 245 AccessibilityStatusEventDetails::AccessibilityStatusEventDetails( | 248 AccessibilityStatusEventDetails::AccessibilityStatusEventDetails( |
| 246 AccessibilityNotificationType notification_type, | 249 AccessibilityNotificationType notification_type, |
| 247 bool enabled, | 250 bool enabled, |
| 248 ash::AccessibilityNotificationVisibility notify) | 251 ui::AccessibilityNotificationVisibility notify) |
| 249 : notification_type(notification_type), | 252 : notification_type(notification_type), |
| 250 enabled(enabled), | 253 enabled(enabled), |
| 251 magnifier_type(ash::kDefaultMagnifierType), | 254 magnifier_type(ui::kDefaultMagnifierType), |
| 252 notify(notify) {} | 255 notify(notify) {} |
| 253 | 256 |
| 254 AccessibilityStatusEventDetails::AccessibilityStatusEventDetails( | 257 AccessibilityStatusEventDetails::AccessibilityStatusEventDetails( |
| 255 AccessibilityNotificationType notification_type, | 258 AccessibilityNotificationType notification_type, |
| 256 bool enabled, | 259 bool enabled, |
| 257 ash::MagnifierType magnifier_type, | 260 ui::MagnifierType magnifier_type, |
| 258 ash::AccessibilityNotificationVisibility notify) | 261 ui::AccessibilityNotificationVisibility notify) |
| 259 : notification_type(notification_type), | 262 : notification_type(notification_type), |
| 260 enabled(enabled), | 263 enabled(enabled), |
| 261 magnifier_type(magnifier_type), | 264 magnifier_type(magnifier_type), |
| 262 notify(notify) {} | 265 notify(notify) {} |
| 263 | 266 |
| 264 /////////////////////////////////////////////////////////////////////////////// | 267 /////////////////////////////////////////////////////////////////////////////// |
| 265 // | 268 // |
| 266 // AccessibilityManager::PrefHandler | 269 // AccessibilityManager::PrefHandler |
| 267 | 270 |
| 268 AccessibilityManager::PrefHandler::PrefHandler(const char* pref_path) | 271 AccessibilityManager::PrefHandler::PrefHandler(const char* pref_path) |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 high_contrast_pref_handler_(prefs::kAccessibilityHighContrastEnabled), | 334 high_contrast_pref_handler_(prefs::kAccessibilityHighContrastEnabled), |
| 332 autoclick_pref_handler_(prefs::kAccessibilityAutoclickEnabled), | 335 autoclick_pref_handler_(prefs::kAccessibilityAutoclickEnabled), |
| 333 autoclick_delay_pref_handler_(prefs::kAccessibilityAutoclickDelayMs), | 336 autoclick_delay_pref_handler_(prefs::kAccessibilityAutoclickDelayMs), |
| 334 virtual_keyboard_pref_handler_( | 337 virtual_keyboard_pref_handler_( |
| 335 prefs::kAccessibilityVirtualKeyboardEnabled), | 338 prefs::kAccessibilityVirtualKeyboardEnabled), |
| 336 large_cursor_enabled_(false), | 339 large_cursor_enabled_(false), |
| 337 sticky_keys_enabled_(false), | 340 sticky_keys_enabled_(false), |
| 338 spoken_feedback_enabled_(false), | 341 spoken_feedback_enabled_(false), |
| 339 high_contrast_enabled_(false), | 342 high_contrast_enabled_(false), |
| 340 autoclick_enabled_(false), | 343 autoclick_enabled_(false), |
| 344 #if defined(USE_ATHENA) |
| 345 autoclick_delay_ms_(400), |
| 346 #else |
| 341 autoclick_delay_ms_(ash::AutoclickController::kDefaultAutoclickDelayMs), | 347 autoclick_delay_ms_(ash::AutoclickController::kDefaultAutoclickDelayMs), |
| 348 #endif |
| 342 virtual_keyboard_enabled_(false), | 349 virtual_keyboard_enabled_(false), |
| 343 spoken_feedback_notification_(ash::A11Y_NOTIFICATION_NONE), | 350 spoken_feedback_notification_(ui::A11Y_NOTIFICATION_NONE), |
| 344 should_speak_chrome_vox_announcements_on_user_screen_(true), | 351 should_speak_chrome_vox_announcements_on_user_screen_(true), |
| 345 system_sounds_enabled_(false), | 352 system_sounds_enabled_(false), |
| 346 braille_display_connected_(false), | 353 braille_display_connected_(false), |
| 347 scoped_braille_observer_(this), | 354 scoped_braille_observer_(this), |
| 348 braille_ime_current_(false), | 355 braille_ime_current_(false), |
| 349 weak_ptr_factory_(this) { | 356 weak_ptr_factory_(this) { |
| 350 notification_registrar_.Add(this, | 357 notification_registrar_.Add(this, |
| 351 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, | 358 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, |
| 352 content::NotificationService::AllSources()); | 359 content::NotificationService::AllSources()); |
| 353 notification_registrar_.Add(this, | 360 notification_registrar_.Add(this, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 378 bundle.GetRawDataResource(IDR_SOUND_EXIT_SCREEN_WAV)); | 385 bundle.GetRawDataResource(IDR_SOUND_EXIT_SCREEN_WAV)); |
| 379 manager->Initialize(SOUND_ENTER_SCREEN, | 386 manager->Initialize(SOUND_ENTER_SCREEN, |
| 380 bundle.GetRawDataResource(IDR_SOUND_ENTER_SCREEN_WAV)); | 387 bundle.GetRawDataResource(IDR_SOUND_ENTER_SCREEN_WAV)); |
| 381 } | 388 } |
| 382 | 389 |
| 383 AccessibilityManager::~AccessibilityManager() { | 390 AccessibilityManager::~AccessibilityManager() { |
| 384 CHECK(this == g_accessibility_manager); | 391 CHECK(this == g_accessibility_manager); |
| 385 AccessibilityStatusEventDetails details( | 392 AccessibilityStatusEventDetails details( |
| 386 ACCESSIBILITY_MANAGER_SHUTDOWN, | 393 ACCESSIBILITY_MANAGER_SHUTDOWN, |
| 387 false, | 394 false, |
| 388 ash::A11Y_NOTIFICATION_NONE); | 395 ui::A11Y_NOTIFICATION_NONE); |
| 389 NotifyAccessibilityStatusChanged(details); | 396 NotifyAccessibilityStatusChanged(details); |
| 390 input_method::InputMethodManager::Get()->RemoveObserver(this); | 397 input_method::InputMethodManager::Get()->RemoveObserver(this); |
| 391 } | 398 } |
| 392 | 399 |
| 393 bool AccessibilityManager::ShouldShowAccessibilityMenu() { | 400 bool AccessibilityManager::ShouldShowAccessibilityMenu() { |
| 394 // If any of the loaded profiles has an accessibility feature turned on - or | 401 // If any of the loaded profiles has an accessibility feature turned on - or |
| 395 // enforced to always show the menu - we return true to show the menu. | 402 // enforced to always show the menu - we return true to show the menu. |
| 396 std::vector<Profile*> profiles = | 403 std::vector<Profile*> profiles = |
| 397 g_browser_process->profile_manager()->GetLoadedProfiles(); | 404 g_browser_process->profile_manager()->GetLoadedProfiles(); |
| 398 for (std::vector<Profile*>::iterator it = profiles.begin(); | 405 for (std::vector<Profile*>::iterator it = profiles.begin(); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 profile_->GetPrefs()->GetBoolean(prefs::kAccessibilityLargeCursorEnabled); | 451 profile_->GetPrefs()->GetBoolean(prefs::kAccessibilityLargeCursorEnabled); |
| 445 | 452 |
| 446 if (large_cursor_enabled_ == enabled) | 453 if (large_cursor_enabled_ == enabled) |
| 447 return; | 454 return; |
| 448 | 455 |
| 449 large_cursor_enabled_ = enabled; | 456 large_cursor_enabled_ = enabled; |
| 450 | 457 |
| 451 AccessibilityStatusEventDetails details( | 458 AccessibilityStatusEventDetails details( |
| 452 ACCESSIBILITY_TOGGLE_LARGE_CURSOR, | 459 ACCESSIBILITY_TOGGLE_LARGE_CURSOR, |
| 453 enabled, | 460 enabled, |
| 454 ash::A11Y_NOTIFICATION_NONE); | 461 ui::A11Y_NOTIFICATION_NONE); |
| 455 | 462 |
| 456 NotifyAccessibilityStatusChanged(details); | 463 NotifyAccessibilityStatusChanged(details); |
| 457 #if !defined(USE_ATHENA) | 464 #if !defined(USE_ATHENA) |
| 458 // crbug.com/408733 (and for all USE_ATHENA in this file) | 465 // crbug.com/408733 (and for all USE_ATHENA in this file) |
| 459 | 466 |
| 460 #if defined(USE_ASH) | 467 #if defined(USE_ASH) |
| 461 // Large cursor is implemented only in ash. | 468 // Large cursor is implemented only in ash. |
| 462 ash::Shell::GetInstance()->cursor_manager()->SetCursorSet( | 469 ash::Shell::GetInstance()->cursor_manager()->SetCursorSet( |
| 463 enabled ? ui::CURSOR_SET_LARGE : ui::CURSOR_SET_NORMAL); | 470 enabled ? ui::CURSOR_SET_LARGE : ui::CURSOR_SET_NORMAL); |
| 464 #endif | 471 #endif |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 return; | 510 return; |
| 504 | 511 |
| 505 sticky_keys_enabled_ = enabled; | 512 sticky_keys_enabled_ = enabled; |
| 506 #if defined(USE_ASH) && !defined(USE_ATHENA) | 513 #if defined(USE_ASH) && !defined(USE_ATHENA) |
| 507 ash::Shell::GetInstance()->sticky_keys_controller()->Enable(enabled); | 514 ash::Shell::GetInstance()->sticky_keys_controller()->Enable(enabled); |
| 508 #endif | 515 #endif |
| 509 } | 516 } |
| 510 | 517 |
| 511 void AccessibilityManager::EnableSpokenFeedback( | 518 void AccessibilityManager::EnableSpokenFeedback( |
| 512 bool enabled, | 519 bool enabled, |
| 513 ash::AccessibilityNotificationVisibility notify) { | 520 ui::AccessibilityNotificationVisibility notify) { |
| 514 if (!profile_) | 521 if (!profile_) |
| 515 return; | 522 return; |
| 516 #if !defined(USE_ATHENA) | 523 #if !defined(USE_ATHENA) |
| 517 ash::Shell::GetInstance()->metrics()->RecordUserMetricsAction( | 524 ash::Shell::GetInstance()->metrics()->RecordUserMetricsAction( |
| 518 enabled ? ash::UMA_STATUS_AREA_ENABLE_SPOKEN_FEEDBACK | 525 enabled ? ash::UMA_STATUS_AREA_ENABLE_SPOKEN_FEEDBACK |
| 519 : ash::UMA_STATUS_AREA_DISABLE_SPOKEN_FEEDBACK); | 526 : ash::UMA_STATUS_AREA_DISABLE_SPOKEN_FEEDBACK); |
| 520 #endif | 527 #endif |
| 521 | 528 |
| 522 spoken_feedback_notification_ = notify; | 529 spoken_feedback_notification_ = notify; |
| 523 | 530 |
| 524 PrefService* pref_service = profile_->GetPrefs(); | 531 PrefService* pref_service = profile_->GetPrefs(); |
| 525 pref_service->SetBoolean(prefs::kAccessibilitySpokenFeedbackEnabled, enabled); | 532 pref_service->SetBoolean(prefs::kAccessibilitySpokenFeedbackEnabled, enabled); |
| 526 pref_service->CommitPendingWrite(); | 533 pref_service->CommitPendingWrite(); |
| 527 | 534 |
| 528 spoken_feedback_notification_ = ash::A11Y_NOTIFICATION_NONE; | 535 spoken_feedback_notification_ = ui::A11Y_NOTIFICATION_NONE; |
| 529 } | 536 } |
| 530 | 537 |
| 531 void AccessibilityManager::UpdateSpokenFeedbackFromPref() { | 538 void AccessibilityManager::UpdateSpokenFeedbackFromPref() { |
| 532 if (!profile_) | 539 if (!profile_) |
| 533 return; | 540 return; |
| 534 | 541 |
| 535 const bool enabled = profile_->GetPrefs()->GetBoolean( | 542 const bool enabled = profile_->GetPrefs()->GetBoolean( |
| 536 prefs::kAccessibilitySpokenFeedbackEnabled); | 543 prefs::kAccessibilitySpokenFeedbackEnabled); |
| 537 | 544 |
| 538 if (spoken_feedback_enabled_ == enabled) | 545 if (spoken_feedback_enabled_ == enabled) |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 Profile* signin_profile = ProfileHelper::GetSigninProfile(); | 645 Profile* signin_profile = ProfileHelper::GetSigninProfile(); |
| 639 UnloadChromeVoxExtension(signin_profile); | 646 UnloadChromeVoxExtension(signin_profile); |
| 640 chrome_vox_loaded_on_lock_screen_ = false; | 647 chrome_vox_loaded_on_lock_screen_ = false; |
| 641 } | 648 } |
| 642 | 649 |
| 643 bool AccessibilityManager::IsSpokenFeedbackEnabled() { | 650 bool AccessibilityManager::IsSpokenFeedbackEnabled() { |
| 644 return spoken_feedback_enabled_; | 651 return spoken_feedback_enabled_; |
| 645 } | 652 } |
| 646 | 653 |
| 647 void AccessibilityManager::ToggleSpokenFeedback( | 654 void AccessibilityManager::ToggleSpokenFeedback( |
| 648 ash::AccessibilityNotificationVisibility notify) { | 655 ui::AccessibilityNotificationVisibility notify) { |
| 649 EnableSpokenFeedback(!IsSpokenFeedbackEnabled(), notify); | 656 EnableSpokenFeedback(!IsSpokenFeedbackEnabled(), notify); |
| 650 } | 657 } |
| 651 | 658 |
| 652 void AccessibilityManager::EnableHighContrast(bool enabled) { | 659 void AccessibilityManager::EnableHighContrast(bool enabled) { |
| 653 if (!profile_) | 660 if (!profile_) |
| 654 return; | 661 return; |
| 655 | 662 |
| 656 PrefService* pref_service = profile_->GetPrefs(); | 663 PrefService* pref_service = profile_->GetPrefs(); |
| 657 pref_service->SetBoolean(prefs::kAccessibilityHighContrastEnabled, enabled); | 664 pref_service->SetBoolean(prefs::kAccessibilityHighContrastEnabled, enabled); |
| 658 pref_service->CommitPendingWrite(); | 665 pref_service->CommitPendingWrite(); |
| 659 } | 666 } |
| 660 | 667 |
| 661 void AccessibilityManager::UpdateHighContrastFromPref() { | 668 void AccessibilityManager::UpdateHighContrastFromPref() { |
| 662 if (!profile_) | 669 if (!profile_) |
| 663 return; | 670 return; |
| 664 | 671 |
| 665 const bool enabled = profile_->GetPrefs()->GetBoolean( | 672 const bool enabled = profile_->GetPrefs()->GetBoolean( |
| 666 prefs::kAccessibilityHighContrastEnabled); | 673 prefs::kAccessibilityHighContrastEnabled); |
| 667 | 674 |
| 668 if (high_contrast_enabled_ == enabled) | 675 if (high_contrast_enabled_ == enabled) |
| 669 return; | 676 return; |
| 670 | 677 |
| 671 high_contrast_enabled_ = enabled; | 678 high_contrast_enabled_ = enabled; |
| 672 | 679 |
| 673 AccessibilityStatusEventDetails details( | 680 AccessibilityStatusEventDetails details( |
| 674 ACCESSIBILITY_TOGGLE_HIGH_CONTRAST_MODE, | 681 ACCESSIBILITY_TOGGLE_HIGH_CONTRAST_MODE, |
| 675 enabled, | 682 enabled, |
| 676 ash::A11Y_NOTIFICATION_NONE); | 683 ui::A11Y_NOTIFICATION_NONE); |
| 677 | 684 |
| 678 NotifyAccessibilityStatusChanged(details); | 685 NotifyAccessibilityStatusChanged(details); |
| 679 | 686 |
| 680 #if !defined(USE_ATHENA) | 687 #if !defined(USE_ATHENA) |
| 681 | 688 |
| 682 #if defined(USE_ASH) | 689 #if defined(USE_ASH) |
| 683 ash::Shell::GetInstance()->high_contrast_controller()->SetEnabled(enabled); | 690 ash::Shell::GetInstance()->high_contrast_controller()->SetEnabled(enabled); |
| 684 #endif | 691 #endif |
| 685 | 692 |
| 686 #if defined(OS_CHROMEOS) | 693 #if defined(OS_CHROMEOS) |
| 687 ash::Shell::GetInstance()->SetCursorCompositingEnabled( | 694 ash::Shell::GetInstance()->SetCursorCompositingEnabled( |
| 688 ShouldEnableCursorCompositing()); | 695 ShouldEnableCursorCompositing()); |
| 689 #endif | 696 #endif |
| 690 | 697 |
| 691 #endif | 698 #endif |
| 692 } | 699 } |
| 693 | 700 |
| 694 void AccessibilityManager::OnLocaleChanged() { | 701 void AccessibilityManager::OnLocaleChanged() { |
| 695 if (!profile_) | 702 if (!profile_) |
| 696 return; | 703 return; |
| 697 | 704 |
| 698 if (!IsSpokenFeedbackEnabled()) | 705 if (!IsSpokenFeedbackEnabled()) |
| 699 return; | 706 return; |
| 700 | 707 |
| 701 // If the system locale changes and spoken feedback is enabled, | 708 // If the system locale changes and spoken feedback is enabled, |
| 702 // reload ChromeVox so that it switches its internal translations | 709 // reload ChromeVox so that it switches its internal translations |
| 703 // to the new language. | 710 // to the new language. |
| 704 EnableSpokenFeedback(false, ash::A11Y_NOTIFICATION_NONE); | 711 EnableSpokenFeedback(false, ui::A11Y_NOTIFICATION_NONE); |
| 705 EnableSpokenFeedback(true, ash::A11Y_NOTIFICATION_NONE); | 712 EnableSpokenFeedback(true, ui::A11Y_NOTIFICATION_NONE); |
| 706 } | 713 } |
| 707 | 714 |
| 708 void AccessibilityManager::PlayEarcon(int sound_key) { | 715 void AccessibilityManager::PlayEarcon(int sound_key) { |
| 716 #if !defined(USE_ATHENA) |
| 709 DCHECK(sound_key < chromeos::SOUND_COUNT); | 717 DCHECK(sound_key < chromeos::SOUND_COUNT); |
| 710 ash::PlaySystemSoundIfSpokenFeedback(sound_key); | 718 ash::PlaySystemSoundIfSpokenFeedback(sound_key); |
| 719 #endif |
| 711 } | 720 } |
| 712 | 721 |
| 713 bool AccessibilityManager::IsHighContrastEnabled() { | 722 bool AccessibilityManager::IsHighContrastEnabled() { |
| 714 return high_contrast_enabled_; | 723 return high_contrast_enabled_; |
| 715 } | 724 } |
| 716 | 725 |
| 717 void AccessibilityManager::EnableAutoclick(bool enabled) { | 726 void AccessibilityManager::EnableAutoclick(bool enabled) { |
| 718 if (!profile_) | 727 if (!profile_) |
| 719 return; | 728 return; |
| 720 | 729 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 const bool enabled = profile_->GetPrefs()->GetBoolean( | 797 const bool enabled = profile_->GetPrefs()->GetBoolean( |
| 789 prefs::kAccessibilityVirtualKeyboardEnabled); | 798 prefs::kAccessibilityVirtualKeyboardEnabled); |
| 790 | 799 |
| 791 if (virtual_keyboard_enabled_ == enabled) | 800 if (virtual_keyboard_enabled_ == enabled) |
| 792 return; | 801 return; |
| 793 virtual_keyboard_enabled_ = enabled; | 802 virtual_keyboard_enabled_ = enabled; |
| 794 | 803 |
| 795 AccessibilityStatusEventDetails details( | 804 AccessibilityStatusEventDetails details( |
| 796 ACCESSIBILITY_TOGGLE_VIRTUAL_KEYBOARD, | 805 ACCESSIBILITY_TOGGLE_VIRTUAL_KEYBOARD, |
| 797 enabled, | 806 enabled, |
| 798 ash::A11Y_NOTIFICATION_NONE); | 807 ui::A11Y_NOTIFICATION_NONE); |
| 799 | 808 |
| 800 NotifyAccessibilityStatusChanged(details); | 809 NotifyAccessibilityStatusChanged(details); |
| 801 | 810 |
| 802 #if defined(USE_ASH) && !defined(USE_ATHENA) | 811 #if defined(USE_ASH) && !defined(USE_ATHENA) |
| 803 keyboard::SetAccessibilityKeyboardEnabled(enabled); | 812 keyboard::SetAccessibilityKeyboardEnabled(enabled); |
| 804 // Note that there are two versions of the on-screen keyboard. A full layout | 813 // Note that there are two versions of the on-screen keyboard. A full layout |
| 805 // is provided for accessibility, which includes sticky modifier keys to | 814 // is provided for accessibility, which includes sticky modifier keys to |
| 806 // enable typing of hotkeys. A compact version is used in touchview mode | 815 // enable typing of hotkeys. A compact version is used in touchview mode |
| 807 // to provide a layout with larger keys to facilitate touch typing. In the | 816 // to provide a layout with larger keys to facilitate touch typing. In the |
| 808 // event that the a11y keyboard is being disabled, an on-screen keyboard might | 817 // event that the a11y keyboard is being disabled, an on-screen keyboard might |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 UpdateBrailleImeState(); | 955 UpdateBrailleImeState(); |
| 947 UpdateLargeCursorFromPref(); | 956 UpdateLargeCursorFromPref(); |
| 948 UpdateStickyKeysFromPref(); | 957 UpdateStickyKeysFromPref(); |
| 949 UpdateSpokenFeedbackFromPref(); | 958 UpdateSpokenFeedbackFromPref(); |
| 950 UpdateHighContrastFromPref(); | 959 UpdateHighContrastFromPref(); |
| 951 UpdateAutoclickFromPref(); | 960 UpdateAutoclickFromPref(); |
| 952 UpdateAutoclickDelayFromPref(); | 961 UpdateAutoclickDelayFromPref(); |
| 953 UpdateVirtualKeyboardFromPref(); | 962 UpdateVirtualKeyboardFromPref(); |
| 954 } | 963 } |
| 955 | 964 |
| 965 #if !defined(USE_ATHENA) |
| 956 void AccessibilityManager::ActiveUserChanged(const std::string& user_id) { | 966 void AccessibilityManager::ActiveUserChanged(const std::string& user_id) { |
| 957 SetProfile(ProfileManager::GetActiveUserProfile()); | 967 SetProfile(ProfileManager::GetActiveUserProfile()); |
| 958 } | 968 } |
| 969 #endif |
| 959 | 970 |
| 960 void AccessibilityManager::SetProfileForTest(Profile* profile) { | 971 void AccessibilityManager::SetProfileForTest(Profile* profile) { |
| 961 SetProfile(profile); | 972 SetProfile(profile); |
| 962 } | 973 } |
| 963 | 974 |
| 964 void AccessibilityManager::SetBrailleControllerForTest( | 975 void AccessibilityManager::SetBrailleControllerForTest( |
| 965 BrailleController* controller) { | 976 BrailleController* controller) { |
| 966 g_braille_controller_for_test = controller; | 977 g_braille_controller_for_test = controller; |
| 967 } | 978 } |
| 968 | 979 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 997 } | 1008 } |
| 998 | 1009 |
| 999 void AccessibilityManager::UpdateChromeOSAccessibilityHistograms() { | 1010 void AccessibilityManager::UpdateChromeOSAccessibilityHistograms() { |
| 1000 UMA_HISTOGRAM_BOOLEAN("Accessibility.CrosSpokenFeedback", | 1011 UMA_HISTOGRAM_BOOLEAN("Accessibility.CrosSpokenFeedback", |
| 1001 IsSpokenFeedbackEnabled()); | 1012 IsSpokenFeedbackEnabled()); |
| 1002 UMA_HISTOGRAM_BOOLEAN("Accessibility.CrosHighContrast", | 1013 UMA_HISTOGRAM_BOOLEAN("Accessibility.CrosHighContrast", |
| 1003 IsHighContrastEnabled()); | 1014 IsHighContrastEnabled()); |
| 1004 UMA_HISTOGRAM_BOOLEAN("Accessibility.CrosVirtualKeyboard", | 1015 UMA_HISTOGRAM_BOOLEAN("Accessibility.CrosVirtualKeyboard", |
| 1005 IsVirtualKeyboardEnabled()); | 1016 IsVirtualKeyboardEnabled()); |
| 1006 UMA_HISTOGRAM_BOOLEAN("Accessibility.CrosStickyKeys", IsStickyKeysEnabled()); | 1017 UMA_HISTOGRAM_BOOLEAN("Accessibility.CrosStickyKeys", IsStickyKeysEnabled()); |
| 1018 #if !defined(USE_ATHENA) |
| 1007 if (MagnificationManager::Get()) { | 1019 if (MagnificationManager::Get()) { |
| 1008 uint32 type = MagnificationManager::Get()->IsMagnifierEnabled() ? | 1020 uint32 type = MagnificationManager::Get()->IsMagnifierEnabled() ? |
| 1009 MagnificationManager::Get()->GetMagnifierType() : 0; | 1021 MagnificationManager::Get()->GetMagnifierType() : 0; |
| 1010 // '0' means magnifier is disabled. | 1022 // '0' means magnifier is disabled. |
| 1011 UMA_HISTOGRAM_ENUMERATION("Accessibility.CrosScreenMagnifier", | 1023 UMA_HISTOGRAM_ENUMERATION("Accessibility.CrosScreenMagnifier", |
| 1012 type, | 1024 type, |
| 1013 ash::kMaxMagnifierType + 1); | 1025 ui::kMaxMagnifierType + 1); |
| 1014 } | 1026 } |
| 1027 #endif |
| 1015 if (profile_) { | 1028 if (profile_) { |
| 1016 const PrefService* const prefs = profile_->GetPrefs(); | 1029 const PrefService* const prefs = profile_->GetPrefs(); |
| 1017 UMA_HISTOGRAM_BOOLEAN( | 1030 UMA_HISTOGRAM_BOOLEAN( |
| 1018 "Accessibility.CrosLargeCursor", | 1031 "Accessibility.CrosLargeCursor", |
| 1019 prefs->GetBoolean(prefs::kAccessibilityLargeCursorEnabled)); | 1032 prefs->GetBoolean(prefs::kAccessibilityLargeCursorEnabled)); |
| 1020 UMA_HISTOGRAM_BOOLEAN( | 1033 UMA_HISTOGRAM_BOOLEAN( |
| 1021 "Accessibility.CrosAlwaysShowA11yMenu", | 1034 "Accessibility.CrosAlwaysShowA11yMenu", |
| 1022 prefs->GetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu)); | 1035 prefs->GetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu)); |
| 1023 | 1036 |
| 1024 bool autoclick_enabled = | 1037 bool autoclick_enabled = |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1050 SetProfile(profile); | 1063 SetProfile(profile); |
| 1051 break; | 1064 break; |
| 1052 } | 1065 } |
| 1053 case chrome::NOTIFICATION_SESSION_STARTED: | 1066 case chrome::NOTIFICATION_SESSION_STARTED: |
| 1054 // Update |profile_| when entering a session. | 1067 // Update |profile_| when entering a session. |
| 1055 SetProfile(ProfileManager::GetActiveUserProfile()); | 1068 SetProfile(ProfileManager::GetActiveUserProfile()); |
| 1056 | 1069 |
| 1057 // Ensure ChromeVox makes announcements at the start of new sessions. | 1070 // Ensure ChromeVox makes announcements at the start of new sessions. |
| 1058 should_speak_chrome_vox_announcements_on_user_screen_ = true; | 1071 should_speak_chrome_vox_announcements_on_user_screen_ = true; |
| 1059 | 1072 |
| 1073 #if !defined(USE_ATHENA) |
| 1060 // Add a session state observer to be able to monitor session changes. | 1074 // Add a session state observer to be able to monitor session changes. |
| 1061 if (!session_state_observer_.get() && ash::Shell::HasInstance()) | 1075 if (!session_state_observer_.get() && ash::Shell::HasInstance()) |
| 1062 session_state_observer_.reset( | 1076 session_state_observer_.reset( |
| 1063 new ash::ScopedSessionStateObserver(this)); | 1077 new ash::ScopedSessionStateObserver(this)); |
| 1078 #endif |
| 1064 break; | 1079 break; |
| 1065 case chrome::NOTIFICATION_PROFILE_DESTROYED: { | 1080 case chrome::NOTIFICATION_PROFILE_DESTROYED: { |
| 1066 // Update |profile_| when exiting a session or shutting down. | 1081 // Update |profile_| when exiting a session or shutting down. |
| 1067 Profile* profile = content::Source<Profile>(source).ptr(); | 1082 Profile* profile = content::Source<Profile>(source).ptr(); |
| 1068 if (profile_ == profile) | 1083 if (profile_ == profile) |
| 1069 SetProfile(NULL); | 1084 SetProfile(NULL); |
| 1070 break; | 1085 break; |
| 1071 } | 1086 } |
| 1072 case chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED: { | 1087 case chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED: { |
| 1073 bool is_screen_locked = *content::Details<bool>(details).ptr(); | 1088 bool is_screen_locked = *content::Details<bool>(details).ptr(); |
| 1074 if (spoken_feedback_enabled_) { | 1089 if (spoken_feedback_enabled_) { |
| 1075 if (is_screen_locked) | 1090 if (is_screen_locked) |
| 1076 LoadChromeVoxToLockScreen(base::Closure()); | 1091 LoadChromeVoxToLockScreen(base::Closure()); |
| 1077 // If spoken feedback was enabled, make sure it is also enabled on | 1092 // If spoken feedback was enabled, make sure it is also enabled on |
| 1078 // the user screen. | 1093 // the user screen. |
| 1079 // The status tray gets verbalized by user screen ChromeVox, so we need | 1094 // The status tray gets verbalized by user screen ChromeVox, so we need |
| 1080 // to load it on the user screen even if the screen is locked. | 1095 // to load it on the user screen even if the screen is locked. |
| 1081 LoadChromeVoxToUserScreen(base::Closure()); | 1096 LoadChromeVoxToUserScreen(base::Closure()); |
| 1082 } | 1097 } |
| 1083 break; | 1098 break; |
| 1084 } | 1099 } |
| 1085 } | 1100 } |
| 1086 } | 1101 } |
| 1087 | 1102 |
| 1088 void AccessibilityManager::OnBrailleDisplayStateChanged( | 1103 void AccessibilityManager::OnBrailleDisplayStateChanged( |
| 1089 const DisplayState& display_state) { | 1104 const DisplayState& display_state) { |
| 1090 braille_display_connected_ = display_state.available; | 1105 braille_display_connected_ = display_state.available; |
| 1091 if (braille_display_connected_) { | 1106 if (braille_display_connected_) { |
| 1092 EnableSpokenFeedback(true, ash::A11Y_NOTIFICATION_SHOW); | 1107 EnableSpokenFeedback(true, ui::A11Y_NOTIFICATION_SHOW); |
| 1093 } | 1108 } |
| 1094 UpdateBrailleImeState(); | 1109 UpdateBrailleImeState(); |
| 1095 | 1110 |
| 1096 AccessibilityStatusEventDetails details( | 1111 AccessibilityStatusEventDetails details( |
| 1097 ACCESSIBILITY_BRAILLE_DISPLAY_CONNECTION_STATE_CHANGED, | 1112 ACCESSIBILITY_BRAILLE_DISPLAY_CONNECTION_STATE_CHANGED, |
| 1098 braille_display_connected_, | 1113 braille_display_connected_, |
| 1099 ash::A11Y_NOTIFICATION_SHOW); | 1114 ui::A11Y_NOTIFICATION_SHOW); |
| 1100 NotifyAccessibilityStatusChanged(details); | 1115 NotifyAccessibilityStatusChanged(details); |
| 1101 } | 1116 } |
| 1102 | 1117 |
| 1103 void AccessibilityManager::OnBrailleKeyEvent(const KeyEvent& event) { | 1118 void AccessibilityManager::OnBrailleKeyEvent(const KeyEvent& event) { |
| 1104 // Ensure the braille IME is active on braille keyboard (dots) input. | 1119 // Ensure the braille IME is active on braille keyboard (dots) input. |
| 1105 if ((event.command == | 1120 if ((event.command == |
| 1106 extensions::api::braille_display_private::KEY_COMMAND_DOTS) && | 1121 extensions::api::braille_display_private::KEY_COMMAND_DOTS) && |
| 1107 !braille_ime_current_) { | 1122 !braille_ime_current_) { |
| 1108 input_method::InputMethodManager::Get() | 1123 input_method::InputMethodManager::Get() |
| 1109 ->GetActiveIMEState() | 1124 ->GetActiveIMEState() |
| 1110 ->ChangeInputMethod(extension_misc::kBrailleImeEngineId, | 1125 ->ChangeInputMethod(extension_misc::kBrailleImeEngineId, |
| 1111 false /* show_message */); | 1126 false /* show_message */); |
| 1112 } | 1127 } |
| 1113 } | 1128 } |
| 1114 | 1129 |
| 1115 void AccessibilityManager::PostLoadChromeVox(Profile* profile) { | 1130 void AccessibilityManager::PostLoadChromeVox(Profile* profile) { |
| 1131 #if !defined(USE_ATHENA) |
| 1116 // Do any setup work needed immediately after ChromeVox actually loads. | 1132 // Do any setup work needed immediately after ChromeVox actually loads. |
| 1117 if (system_sounds_enabled_) | 1133 if (system_sounds_enabled_) |
| 1118 ash::PlaySystemSoundAlways(SOUND_SPOKEN_FEEDBACK_ENABLED); | 1134 ash::PlaySystemSoundAlways(SOUND_SPOKEN_FEEDBACK_ENABLED); |
| 1135 #endif |
| 1119 | 1136 |
| 1120 ExtensionAccessibilityEventRouter::GetInstance()-> | 1137 ExtensionAccessibilityEventRouter::GetInstance()-> |
| 1121 OnChromeVoxLoadStateChanged(profile_, | 1138 OnChromeVoxLoadStateChanged(profile_, |
| 1122 IsSpokenFeedbackEnabled(), | 1139 IsSpokenFeedbackEnabled(), |
| 1123 chrome_vox_loaded_on_lock_screen_ || | 1140 chrome_vox_loaded_on_lock_screen_ || |
| 1124 should_speak_chrome_vox_announcements_on_user_screen_); | 1141 should_speak_chrome_vox_announcements_on_user_screen_); |
| 1125 | 1142 |
| 1126 should_speak_chrome_vox_announcements_on_user_screen_ = | 1143 should_speak_chrome_vox_announcements_on_user_screen_ = |
| 1127 chrome_vox_loaded_on_lock_screen_; | 1144 chrome_vox_loaded_on_lock_screen_; |
| 1128 } | 1145 } |
| 1129 | 1146 |
| 1130 void AccessibilityManager::PostUnloadChromeVox(Profile* profile) { | 1147 void AccessibilityManager::PostUnloadChromeVox(Profile* profile) { |
| 1148 #if !defined(USE_ATHENA) |
| 1131 // Do any teardown work needed immediately after ChromeVox actually unloads. | 1149 // Do any teardown work needed immediately after ChromeVox actually unloads. |
| 1132 if (system_sounds_enabled_) | 1150 if (system_sounds_enabled_) |
| 1133 ash::PlaySystemSoundAlways(SOUND_SPOKEN_FEEDBACK_DISABLED); | 1151 ash::PlaySystemSoundAlways(SOUND_SPOKEN_FEEDBACK_DISABLED); |
| 1152 #endif |
| 1134 } | 1153 } |
| 1135 | 1154 |
| 1136 } // namespace chromeos | 1155 } // namespace chromeos |
| OLD | NEW |