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 #ifndef CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_MANAGER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_MANAGER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "ash/session/session_state_observer.h" | 10 #include "ash/session/session_state_observer.h" |
11 #include "ash/shell_observer.h" | 11 #include "ash/shell_observer.h" |
12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
13 #include "base/callback_list.h" | 13 #include "base/callback_list.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/prefs/pref_change_registrar.h" | 15 #include "base/prefs/pref_change_registrar.h" |
16 #include "base/scoped_observer.h" | 16 #include "base/scoped_observer.h" |
17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
18 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 18 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
19 #include "chrome/browser/chromeos/accessibility/chromevox_panel.h" | |
19 #include "chrome/browser/extensions/api/braille_display_private/braille_controll er.h" | 20 #include "chrome/browser/extensions/api/braille_display_private/braille_controll er.h" |
20 #include "content/public/browser/notification_observer.h" | 21 #include "content/public/browser/notification_observer.h" |
21 #include "content/public/browser/notification_registrar.h" | 22 #include "content/public/browser/notification_registrar.h" |
22 #include "extensions/browser/event_router.h" | 23 #include "extensions/browser/event_router.h" |
23 #include "extensions/browser/extension_system.h" | 24 #include "extensions/browser/extension_system.h" |
24 #include "ui/base/ime/chromeos/input_method_manager.h" | 25 #include "ui/base/ime/chromeos/input_method_manager.h" |
25 #include "ui/chromeos/accessibility_types.h" | 26 #include "ui/chromeos/accessibility_types.h" |
26 | 27 |
27 namespace content { | 28 namespace content { |
28 class RenderViewHost; | 29 class RenderViewHost; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 | 62 |
62 typedef base::Callback<void(const AccessibilityStatusEventDetails&)> | 63 typedef base::Callback<void(const AccessibilityStatusEventDetails&)> |
63 AccessibilityStatusCallback; | 64 AccessibilityStatusCallback; |
64 | 65 |
65 typedef base::CallbackList<void(const AccessibilityStatusEventDetails&)> | 66 typedef base::CallbackList<void(const AccessibilityStatusEventDetails&)> |
66 AccessibilityStatusCallbackList; | 67 AccessibilityStatusCallbackList; |
67 | 68 |
68 typedef AccessibilityStatusCallbackList::Subscription | 69 typedef AccessibilityStatusCallbackList::Subscription |
69 AccessibilityStatusSubscription; | 70 AccessibilityStatusSubscription; |
70 | 71 |
72 class ChromeVoxPanelWidgetObserver; | |
73 | |
71 // AccessibilityManager changes the statuses of accessibility features | 74 // AccessibilityManager changes the statuses of accessibility features |
72 // watching profile notifications and pref-changes. | 75 // watching profile notifications and pref-changes. |
73 // TODO(yoshiki): merge MagnificationManager with AccessibilityManager. | 76 // TODO(yoshiki): merge MagnificationManager with AccessibilityManager. |
74 class AccessibilityManager | 77 class AccessibilityManager |
75 : public content::NotificationObserver, | 78 : public content::NotificationObserver, |
76 public extensions::api::braille_display_private::BrailleObserver, | 79 public extensions::api::braille_display_private::BrailleObserver, |
77 public ash::SessionStateObserver, | 80 public ash::SessionStateObserver, |
78 public ash::ShellObserver, | 81 public ash::ShellObserver, |
79 public input_method::InputMethodManager::Observer { | 82 public input_method::InputMethodManager::Observer { |
80 public: | 83 public: |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
193 AccessibilityStatusEventDetails& details); | 196 AccessibilityStatusEventDetails& details); |
194 | 197 |
195 // Notify accessibility when locale changes occur. | 198 // Notify accessibility when locale changes occur. |
196 void OnLocaleChanged(); | 199 void OnLocaleChanged(); |
197 | 200 |
198 // Plays an earcon. Earcons are brief and distinctive sounds that indicate | 201 // Plays an earcon. Earcons are brief and distinctive sounds that indicate |
199 // when their mapped event has occurred. The sound key enums can be found in | 202 // when their mapped event has occurred. The sound key enums can be found in |
200 // chromeos/audio/chromeos_sounds.h. | 203 // chromeos/audio/chromeos_sounds.h. |
201 void PlayEarcon(int sound_key); | 204 void PlayEarcon(int sound_key); |
202 | 205 |
206 // Get work area insets due to accessibility overlays on one of the | |
207 // screen edges. | |
208 void ComputeWorkAreaInsets(aura::Window* root_window, | |
209 gfx::Insets* out_insets) const; | |
210 | |
211 // Called by our widget observer when the ChromeVoxPanel is closing. | |
212 void OnChromeVoxPanelClosing(); | |
213 | |
203 // Profile having the a11y context. | 214 // Profile having the a11y context. |
204 Profile* profile() { return profile_; } | 215 Profile* profile() { return profile_; } |
205 | 216 |
206 protected: | 217 protected: |
207 AccessibilityManager(); | 218 AccessibilityManager(); |
208 ~AccessibilityManager() override; | 219 ~AccessibilityManager() override; |
209 | 220 |
210 private: | 221 private: |
211 void LoadChromeVox(); | 222 void LoadChromeVox(); |
212 void LoadChromeVoxToUserScreen(const base::Closure& done_cb); | 223 void LoadChromeVoxToUserScreen(const base::Closure& done_cb); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
286 bool system_sounds_enabled_; | 297 bool system_sounds_enabled_; |
287 | 298 |
288 AccessibilityStatusCallbackList callback_list_; | 299 AccessibilityStatusCallbackList callback_list_; |
289 | 300 |
290 bool braille_display_connected_; | 301 bool braille_display_connected_; |
291 ScopedObserver<extensions::api::braille_display_private::BrailleController, | 302 ScopedObserver<extensions::api::braille_display_private::BrailleController, |
292 AccessibilityManager> scoped_braille_observer_; | 303 AccessibilityManager> scoped_braille_observer_; |
293 | 304 |
294 bool braille_ime_current_; | 305 bool braille_ime_current_; |
295 | 306 |
307 ChromeVoxPanel* chromevox_panel_; | |
308 ChromeVoxPanelWidgetObserver* chromevox_panel_widget_observer_; | |
Jun Mukai
2015/11/06 18:21:04
Consider using scoped_ptr. Also you don't have to
dmazzoni
2015/11/09 23:02:06
Switched to using scoped_ptr, but I can't use scop
| |
309 | |
296 base::WeakPtrFactory<AccessibilityManager> weak_ptr_factory_; | 310 base::WeakPtrFactory<AccessibilityManager> weak_ptr_factory_; |
297 | 311 |
298 DISALLOW_COPY_AND_ASSIGN(AccessibilityManager); | 312 DISALLOW_COPY_AND_ASSIGN(AccessibilityManager); |
299 }; | 313 }; |
300 | 314 |
301 } // namespace chromeos | 315 } // namespace chromeos |
302 | 316 |
303 #endif // CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_MANAGER_H_ | 317 #endif // CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_MANAGER_H_ |
OLD | NEW |