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" | 7 #include "ash/audio/sounds.h" |
8 #include "ash/autoclick/autoclick_controller.h" | 8 #include "ash/autoclick/autoclick_controller.h" |
9 #include "ash/high_contrast/high_contrast_controller.h" | 9 #include "ash/high_contrast/high_contrast_controller.h" |
10 #include "ash/metrics/user_metrics_recorder.h" | 10 #include "ash/metrics/user_metrics_recorder.h" |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 high_contrast_enabled_(false), | 370 high_contrast_enabled_(false), |
371 autoclick_enabled_(false), | 371 autoclick_enabled_(false), |
372 autoclick_delay_ms_(ash::AutoclickController::kDefaultAutoclickDelayMs), | 372 autoclick_delay_ms_(ash::AutoclickController::kDefaultAutoclickDelayMs), |
373 virtual_keyboard_enabled_(false), | 373 virtual_keyboard_enabled_(false), |
374 spoken_feedback_notification_(ui::A11Y_NOTIFICATION_NONE), | 374 spoken_feedback_notification_(ui::A11Y_NOTIFICATION_NONE), |
375 should_speak_chrome_vox_announcements_on_user_screen_(true), | 375 should_speak_chrome_vox_announcements_on_user_screen_(true), |
376 system_sounds_enabled_(false), | 376 system_sounds_enabled_(false), |
377 braille_display_connected_(false), | 377 braille_display_connected_(false), |
378 scoped_braille_observer_(this), | 378 scoped_braille_observer_(this), |
379 braille_ime_current_(false), | 379 braille_ime_current_(false), |
| 380 chromevox_panel_(nullptr), |
380 weak_ptr_factory_(this) { | 381 weak_ptr_factory_(this) { |
381 notification_registrar_.Add(this, | 382 notification_registrar_.Add(this, |
382 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, | 383 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, |
383 content::NotificationService::AllSources()); | 384 content::NotificationService::AllSources()); |
384 notification_registrar_.Add(this, | 385 notification_registrar_.Add(this, |
385 chrome::NOTIFICATION_SESSION_STARTED, | 386 chrome::NOTIFICATION_SESSION_STARTED, |
386 content::NotificationService::AllSources()); | 387 content::NotificationService::AllSources()); |
387 notification_registrar_.Add(this, | 388 notification_registrar_.Add(this, |
388 chrome::NOTIFICATION_PROFILE_DESTROYED, | 389 chrome::NOTIFICATION_PROFILE_DESTROYED, |
389 content::NotificationService::AllSources()); | 390 content::NotificationService::AllSources()); |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 chrome_vox_loaded_on_lock_screen_ = true; | 630 chrome_vox_loaded_on_lock_screen_ = true; |
630 LoadChromeVoxExtension( | 631 LoadChromeVoxExtension( |
631 profile, | 632 profile, |
632 lock_web_ui->GetWebContents()->GetRenderViewHost(), | 633 lock_web_ui->GetWebContents()->GetRenderViewHost(), |
633 done_cb); | 634 done_cb); |
634 } | 635 } |
635 } | 636 } |
636 } | 637 } |
637 | 638 |
638 void AccessibilityManager::UnloadChromeVox() { | 639 void AccessibilityManager::UnloadChromeVox() { |
| 640 if (chromevox_panel_) { |
| 641 chromevox_panel_->Close(); |
| 642 chromevox_panel_ = nullptr; |
| 643 } |
| 644 |
639 if (chrome_vox_loaded_on_lock_screen_) | 645 if (chrome_vox_loaded_on_lock_screen_) |
640 UnloadChromeVoxFromLockScreen(); | 646 UnloadChromeVoxFromLockScreen(); |
641 | 647 |
642 if (chrome_vox_loaded_on_user_screen_) { | 648 if (chrome_vox_loaded_on_user_screen_) { |
643 UnloadChromeVoxExtension(profile_); | 649 UnloadChromeVoxExtension(profile_); |
644 chrome_vox_loaded_on_user_screen_ = false; | 650 chrome_vox_loaded_on_user_screen_ = false; |
645 } | 651 } |
646 | 652 |
647 PostUnloadChromeVox(profile_); | 653 PostUnloadChromeVox(profile_); |
648 } | 654 } |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1131 extensions::events::ACCESSIBILITY_PRIVATE_ON_INTRODUCE_CHROME_VOX, | 1137 extensions::events::ACCESSIBILITY_PRIVATE_ON_INTRODUCE_CHROME_VOX, |
1132 extensions::api::accessibility_private::OnIntroduceChromeVox:: | 1138 extensions::api::accessibility_private::OnIntroduceChromeVox:: |
1133 kEventName, | 1139 kEventName, |
1134 event_args.Pass())); | 1140 event_args.Pass())); |
1135 event_router->DispatchEventWithLazyListener( | 1141 event_router->DispatchEventWithLazyListener( |
1136 extension_misc::kChromeVoxExtensionId, event.Pass()); | 1142 extension_misc::kChromeVoxExtensionId, event.Pass()); |
1137 } | 1143 } |
1138 | 1144 |
1139 should_speak_chrome_vox_announcements_on_user_screen_ = | 1145 should_speak_chrome_vox_announcements_on_user_screen_ = |
1140 chrome_vox_loaded_on_lock_screen_; | 1146 chrome_vox_loaded_on_lock_screen_; |
| 1147 |
| 1148 chromevox_panel_ = new ChromeVoxPanel(profile_); |
1141 } | 1149 } |
1142 | 1150 |
1143 void AccessibilityManager::PostUnloadChromeVox(Profile* profile) { | 1151 void AccessibilityManager::PostUnloadChromeVox(Profile* profile) { |
1144 // Do any teardown work needed immediately after ChromeVox actually unloads. | 1152 // Do any teardown work needed immediately after ChromeVox actually unloads. |
1145 ash::PlaySystemSoundAlways(SOUND_SPOKEN_FEEDBACK_DISABLED); | 1153 ash::PlaySystemSoundAlways(SOUND_SPOKEN_FEEDBACK_DISABLED); |
1146 // Clear the accessibility focus ring. | 1154 // Clear the accessibility focus ring. |
1147 AccessibilityFocusRingController::GetInstance()->SetFocusRing( | 1155 AccessibilityFocusRingController::GetInstance()->SetFocusRing( |
1148 std::vector<gfx::Rect>()); | 1156 std::vector<gfx::Rect>()); |
1149 } | 1157 } |
1150 | 1158 |
| 1159 gfx::Insets AccessibilityManager::GetWorkAreaInsets( |
| 1160 aura::Window* root_window) const { |
| 1161 if (chromevox_panel_ && chromevox_panel_->GetRootWindow() == root_window) |
| 1162 return gfx::Insets(chromevox_panel_->GetHeight(), 0, 0, 0); |
| 1163 else |
| 1164 return gfx::Insets(); |
| 1165 } |
| 1166 |
1151 } // namespace chromeos | 1167 } // namespace chromeos |
OLD | NEW |