| 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 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 spoken_feedback_notification_ = ash::A11Y_NOTIFICATION_NONE; | 446 spoken_feedback_notification_ = ash::A11Y_NOTIFICATION_NONE; |
| 447 } | 447 } |
| 448 | 448 |
| 449 void AccessibilityManager::UpdateSpokenFeedbackFromPref() { | 449 void AccessibilityManager::UpdateSpokenFeedbackFromPref() { |
| 450 if (!profile_) | 450 if (!profile_) |
| 451 return; | 451 return; |
| 452 | 452 |
| 453 const bool enabled = profile_->GetPrefs()->GetBoolean( | 453 const bool enabled = profile_->GetPrefs()->GetBoolean( |
| 454 prefs::kAccessibilitySpokenFeedbackEnabled); | 454 prefs::kAccessibilitySpokenFeedbackEnabled); |
| 455 | 455 |
| 456 if (enabled) | 456 if (enabled) { |
| 457 chromevox_loader_->SetProfile(profile_); | 457 chromevox_loader_->SetProfile( |
| 458 profile_, base::Bind(&AccessibilityManager::PostSwitchChromeVoxProfile, |
| 459 weak_ptr_factory_.GetWeakPtr())); |
| 460 } |
| 458 | 461 |
| 459 if (spoken_feedback_enabled_ == enabled) | 462 if (spoken_feedback_enabled_ == enabled) |
| 460 return; | 463 return; |
| 461 | 464 |
| 462 spoken_feedback_enabled_ = enabled; | 465 spoken_feedback_enabled_ = enabled; |
| 463 | 466 |
| 464 AccessibilityStatusEventDetails details( | 467 AccessibilityStatusEventDetails details( |
| 465 ACCESSIBILITY_TOGGLE_SPOKEN_FEEDBACK, | 468 ACCESSIBILITY_TOGGLE_SPOKEN_FEEDBACK, |
| 466 enabled, | 469 enabled, |
| 467 spoken_feedback_notification_); | 470 spoken_feedback_notification_); |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1029 local_state_pref_change_registrar_->Add( | 1032 local_state_pref_change_registrar_->Add( |
| 1030 prefs::kApplicationLocale, | 1033 prefs::kApplicationLocale, |
| 1031 base::Bind(&AccessibilityManager::OnLocaleChanged, | 1034 base::Bind(&AccessibilityManager::OnLocaleChanged, |
| 1032 base::Unretained(this))); | 1035 base::Unretained(this))); |
| 1033 | 1036 |
| 1034 content::BrowserAccessibilityState::GetInstance()->AddHistogramCallback( | 1037 content::BrowserAccessibilityState::GetInstance()->AddHistogramCallback( |
| 1035 base::Bind( | 1038 base::Bind( |
| 1036 &AccessibilityManager::UpdateChromeOSAccessibilityHistograms, | 1039 &AccessibilityManager::UpdateChromeOSAccessibilityHistograms, |
| 1037 base::Unretained(this))); | 1040 base::Unretained(this))); |
| 1038 | 1041 |
| 1039 chromevox_loader_->SetProfile(profile); | 1042 chromevox_loader_->SetProfile( |
| 1043 profile, base::Bind(&AccessibilityManager::PostSwitchChromeVoxProfile, |
| 1044 weak_ptr_factory_.GetWeakPtr())); |
| 1040 | 1045 |
| 1041 extensions::ExtensionRegistry* registry = | 1046 extensions::ExtensionRegistry* registry = |
| 1042 extensions::ExtensionRegistry::Get(profile); | 1047 extensions::ExtensionRegistry::Get(profile); |
| 1043 if (!extension_registry_observer_.IsObserving(registry)) | 1048 if (!extension_registry_observer_.IsObserving(registry)) |
| 1044 extension_registry_observer_.Add(registry); | 1049 extension_registry_observer_.Add(registry); |
| 1045 } | 1050 } |
| 1046 | 1051 |
| 1047 large_cursor_pref_handler_.HandleProfileChanged(profile_, profile); | 1052 large_cursor_pref_handler_.HandleProfileChanged(profile_, profile); |
| 1048 spoken_feedback_pref_handler_.HandleProfileChanged(profile_, profile); | 1053 spoken_feedback_pref_handler_.HandleProfileChanged(profile_, profile); |
| 1049 high_contrast_pref_handler_.HandleProfileChanged(profile_, profile); | 1054 high_contrast_pref_handler_.HandleProfileChanged(profile_, profile); |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1311 AccessibilityFocusRingController::GetInstance()->SetFocusRing( | 1316 AccessibilityFocusRingController::GetInstance()->SetFocusRing( |
| 1312 std::vector<gfx::Rect>(), | 1317 std::vector<gfx::Rect>(), |
| 1313 AccessibilityFocusRingController::PERSIST_FOCUS_RING); | 1318 AccessibilityFocusRingController::PERSIST_FOCUS_RING); |
| 1314 | 1319 |
| 1315 if (chromevox_panel_) { | 1320 if (chromevox_panel_) { |
| 1316 chromevox_panel_->Close(); | 1321 chromevox_panel_->Close(); |
| 1317 chromevox_panel_ = nullptr; | 1322 chromevox_panel_ = nullptr; |
| 1318 } | 1323 } |
| 1319 } | 1324 } |
| 1320 | 1325 |
| 1326 void AccessibilityManager::PostSwitchChromeVoxProfile() { |
| 1327 if (chromevox_panel_) { |
| 1328 chromevox_panel_->Close(); |
| 1329 chromevox_panel_ = nullptr; |
| 1330 } |
| 1331 chromevox_panel_ = new ChromeVoxPanel(profile_); |
| 1332 chromevox_panel_widget_observer_.reset( |
| 1333 new ChromeVoxPanelWidgetObserver(chromevox_panel_->GetWidget(), this)); |
| 1334 } |
| 1335 |
| 1321 void AccessibilityManager::OnChromeVoxPanelClosing() { | 1336 void AccessibilityManager::OnChromeVoxPanelClosing() { |
| 1322 aura::Window* root_window = chromevox_panel_->GetRootWindow(); | 1337 aura::Window* root_window = chromevox_panel_->GetRootWindow(); |
| 1323 chromevox_panel_widget_observer_.reset(nullptr); | 1338 chromevox_panel_widget_observer_.reset(nullptr); |
| 1324 chromevox_panel_ = nullptr; | 1339 chromevox_panel_ = nullptr; |
| 1325 | 1340 |
| 1326 ash::WmShelf* shelf = | 1341 ash::WmShelf* shelf = |
| 1327 ash::WmShelf::ForWindow(ash::WmWindowAura::Get(root_window)); | 1342 ash::WmShelf::ForWindow(ash::WmWindowAura::Get(root_window)); |
| 1328 if (!shelf->IsShelfInitialized()) | 1343 if (!shelf->IsShelfInitialized()) |
| 1329 return; | 1344 return; |
| 1330 | 1345 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1343 content::BrowserContext* context) { | 1358 content::BrowserContext* context) { |
| 1344 keyboard_listener_extension_id_ = id; | 1359 keyboard_listener_extension_id_ = id; |
| 1345 | 1360 |
| 1346 extensions::ExtensionRegistry* registry = | 1361 extensions::ExtensionRegistry* registry = |
| 1347 extensions::ExtensionRegistry::Get(context); | 1362 extensions::ExtensionRegistry::Get(context); |
| 1348 if (!extension_registry_observer_.IsObserving(registry) && !id.empty()) | 1363 if (!extension_registry_observer_.IsObserving(registry) && !id.empty()) |
| 1349 extension_registry_observer_.Add(registry); | 1364 extension_registry_observer_.Add(registry); |
| 1350 } | 1365 } |
| 1351 | 1366 |
| 1352 } // namespace chromeos | 1367 } // namespace chromeos |
| OLD | NEW |