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 |
| 10 #include <memory> |
9 #include <utility> | 11 #include <utility> |
10 | 12 |
11 #include "ash/audio/sounds.h" | 13 #include "ash/audio/sounds.h" |
12 #include "ash/autoclick/autoclick_controller.h" | 14 #include "ash/autoclick/autoclick_controller.h" |
13 #include "ash/high_contrast/high_contrast_controller.h" | 15 #include "ash/high_contrast/high_contrast_controller.h" |
14 #include "ash/metrics/user_metrics_recorder.h" | 16 #include "ash/metrics/user_metrics_recorder.h" |
15 #include "ash/session/session_state_delegate.h" | 17 #include "ash/session/session_state_delegate.h" |
16 #include "ash/shelf/shelf.h" | 18 #include "ash/shelf/shelf.h" |
17 #include "ash/shelf/shelf_layout_manager.h" | 19 #include "ash/shelf/shelf_layout_manager.h" |
18 #include "ash/shell.h" | 20 #include "ash/shell.h" |
19 #include "ash/sticky_keys/sticky_keys_controller.h" | 21 #include "ash/sticky_keys/sticky_keys_controller.h" |
20 #include "ash/system/tray/system_tray_notifier.h" | 22 #include "ash/system/tray/system_tray_notifier.h" |
21 #include "base/callback.h" | 23 #include "base/callback.h" |
22 #include "base/callback_helpers.h" | 24 #include "base/callback_helpers.h" |
23 #include "base/command_line.h" | 25 #include "base/command_line.h" |
24 #include "base/macros.h" | 26 #include "base/macros.h" |
25 #include "base/memory/scoped_ptr.h" | |
26 #include "base/memory/singleton.h" | 27 #include "base/memory/singleton.h" |
27 #include "base/metrics/histogram.h" | 28 #include "base/metrics/histogram.h" |
28 #include "base/path_service.h" | 29 #include "base/path_service.h" |
29 #include "base/strings/string_split.h" | 30 #include "base/strings/string_split.h" |
30 #include "base/strings/string_util.h" | 31 #include "base/strings/string_util.h" |
31 #include "base/time/time.h" | 32 #include "base/time/time.h" |
32 #include "base/values.h" | 33 #include "base/values.h" |
33 #include "chrome/browser/accessibility/accessibility_extension_api.h" | 34 #include "chrome/browser/accessibility/accessibility_extension_api.h" |
34 #include "chrome/browser/browser_process.h" | 35 #include "chrome/browser/browser_process.h" |
35 #include "chrome/browser/chrome_notification_types.h" | 36 #include "chrome/browser/chrome_notification_types.h" |
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1041 BrowserThread::PostTaskAndReplyWithResult( | 1042 BrowserThread::PostTaskAndReplyWithResult( |
1042 BrowserThread::IO, | 1043 BrowserThread::IO, |
1043 FROM_HERE, | 1044 FROM_HERE, |
1044 base::Bind(&BrailleController::GetDisplayState, | 1045 base::Bind(&BrailleController::GetDisplayState, |
1045 base::Unretained(braille_controller)), | 1046 base::Unretained(braille_controller)), |
1046 base::Bind(&AccessibilityManager::ReceiveBrailleDisplayState, | 1047 base::Bind(&AccessibilityManager::ReceiveBrailleDisplayState, |
1047 weak_ptr_factory_.GetWeakPtr())); | 1048 weak_ptr_factory_.GetWeakPtr())); |
1048 } | 1049 } |
1049 | 1050 |
1050 void AccessibilityManager::ReceiveBrailleDisplayState( | 1051 void AccessibilityManager::ReceiveBrailleDisplayState( |
1051 scoped_ptr<extensions::api::braille_display_private::DisplayState> state) { | 1052 std::unique_ptr<extensions::api::braille_display_private::DisplayState> |
| 1053 state) { |
1052 OnBrailleDisplayStateChanged(*state); | 1054 OnBrailleDisplayStateChanged(*state); |
1053 } | 1055 } |
1054 | 1056 |
1055 void AccessibilityManager::UpdateBrailleImeState() { | 1057 void AccessibilityManager::UpdateBrailleImeState() { |
1056 if (!profile_) | 1058 if (!profile_) |
1057 return; | 1059 return; |
1058 PrefService* pref_service = profile_->GetPrefs(); | 1060 PrefService* pref_service = profile_->GetPrefs(); |
1059 std::vector<std::string> preload_engines = | 1061 std::vector<std::string> preload_engines = |
1060 base::SplitString(pref_service->GetString(prefs::kLanguagePreloadEngines), | 1062 base::SplitString(pref_service->GetString(prefs::kLanguagePreloadEngines), |
1061 ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); | 1063 ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1234 system_sounds_enabled_ = false; | 1236 system_sounds_enabled_ = false; |
1235 if (!ash::PlaySystemSoundIfSpokenFeedback(SOUND_SHUTDOWN)) | 1237 if (!ash::PlaySystemSoundIfSpokenFeedback(SOUND_SHUTDOWN)) |
1236 return base::TimeDelta(); | 1238 return base::TimeDelta(); |
1237 return media::SoundsManager::Get()->GetDuration(SOUND_SHUTDOWN); | 1239 return media::SoundsManager::Get()->GetDuration(SOUND_SHUTDOWN); |
1238 } | 1240 } |
1239 | 1241 |
1240 void AccessibilityManager::InjectChromeVox(RenderViewHost* render_view_host) { | 1242 void AccessibilityManager::InjectChromeVox(RenderViewHost* render_view_host) { |
1241 LoadChromeVoxExtension(profile_, render_view_host, base::Closure()); | 1243 LoadChromeVoxExtension(profile_, render_view_host, base::Closure()); |
1242 } | 1244 } |
1243 | 1245 |
1244 scoped_ptr<AccessibilityStatusSubscription> | 1246 std::unique_ptr<AccessibilityStatusSubscription> |
1245 AccessibilityManager::RegisterCallback( | 1247 AccessibilityManager::RegisterCallback(const AccessibilityStatusCallback& cb) { |
1246 const AccessibilityStatusCallback& cb) { | |
1247 return callback_list_.Add(cb); | 1248 return callback_list_.Add(cb); |
1248 } | 1249 } |
1249 | 1250 |
1250 void AccessibilityManager::NotifyAccessibilityStatusChanged( | 1251 void AccessibilityManager::NotifyAccessibilityStatusChanged( |
1251 AccessibilityStatusEventDetails& details) { | 1252 AccessibilityStatusEventDetails& details) { |
1252 callback_list_.Notify(details); | 1253 callback_list_.Notify(details); |
1253 } | 1254 } |
1254 | 1255 |
1255 void AccessibilityManager::UpdateChromeOSAccessibilityHistograms() { | 1256 void AccessibilityManager::UpdateChromeOSAccessibilityHistograms() { |
1256 UMA_HISTOGRAM_BOOLEAN("Accessibility.CrosSpokenFeedback", | 1257 UMA_HISTOGRAM_BOOLEAN("Accessibility.CrosSpokenFeedback", |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1398 void AccessibilityManager::PostLoadChromeVox(Profile* profile) { | 1399 void AccessibilityManager::PostLoadChromeVox(Profile* profile) { |
1399 // Do any setup work needed immediately after ChromeVox actually loads. | 1400 // Do any setup work needed immediately after ChromeVox actually loads. |
1400 ash::PlaySystemSoundAlways(SOUND_SPOKEN_FEEDBACK_ENABLED); | 1401 ash::PlaySystemSoundAlways(SOUND_SPOKEN_FEEDBACK_ENABLED); |
1401 | 1402 |
1402 if (chrome_vox_loaded_on_lock_screen_ || | 1403 if (chrome_vox_loaded_on_lock_screen_ || |
1403 should_speak_chrome_vox_announcements_on_user_screen_) { | 1404 should_speak_chrome_vox_announcements_on_user_screen_) { |
1404 extensions::EventRouter* event_router = | 1405 extensions::EventRouter* event_router = |
1405 extensions::EventRouter::Get(profile); | 1406 extensions::EventRouter::Get(profile); |
1406 CHECK(event_router); | 1407 CHECK(event_router); |
1407 | 1408 |
1408 scoped_ptr<base::ListValue> event_args(new base::ListValue()); | 1409 std::unique_ptr<base::ListValue> event_args(new base::ListValue()); |
1409 scoped_ptr<extensions::Event> event(new extensions::Event( | 1410 std::unique_ptr<extensions::Event> event(new extensions::Event( |
1410 extensions::events::ACCESSIBILITY_PRIVATE_ON_INTRODUCE_CHROME_VOX, | 1411 extensions::events::ACCESSIBILITY_PRIVATE_ON_INTRODUCE_CHROME_VOX, |
1411 extensions::api::accessibility_private::OnIntroduceChromeVox:: | 1412 extensions::api::accessibility_private::OnIntroduceChromeVox:: |
1412 kEventName, | 1413 kEventName, |
1413 std::move(event_args))); | 1414 std::move(event_args))); |
1414 event_router->DispatchEventWithLazyListener( | 1415 event_router->DispatchEventWithLazyListener( |
1415 extension_misc::kChromeVoxExtensionId, std::move(event)); | 1416 extension_misc::kChromeVoxExtensionId, std::move(event)); |
1416 } | 1417 } |
1417 | 1418 |
1418 should_speak_chrome_vox_announcements_on_user_screen_ = | 1419 should_speak_chrome_vox_announcements_on_user_screen_ = |
1419 chrome_vox_loaded_on_lock_screen_; | 1420 chrome_vox_loaded_on_lock_screen_; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1457 content::BrowserContext* context) { | 1458 content::BrowserContext* context) { |
1458 keyboard_listener_extension_id_ = id; | 1459 keyboard_listener_extension_id_ = id; |
1459 | 1460 |
1460 extensions::ExtensionRegistry* registry = | 1461 extensions::ExtensionRegistry* registry = |
1461 extensions::ExtensionRegistry::Get(context); | 1462 extensions::ExtensionRegistry::Get(context); |
1462 if (!extension_registry_observer_.IsObserving(registry) && !id.empty()) | 1463 if (!extension_registry_observer_.IsObserving(registry) && !id.empty()) |
1463 extension_registry_observer_.Add(registry); | 1464 extension_registry_observer_.Add(registry); |
1464 } | 1465 } |
1465 | 1466 |
1466 } // namespace chromeos | 1467 } // namespace chromeos |
OLD | NEW |