OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_STATE_H_ | 5 #ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_STATE_H_ |
6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_STATE_H_ | 6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_STATE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "content/common/content_export.h" |
10 | 11 |
11 template <typename T> struct DefaultSingletonTraits; | 12 template <typename T> struct DefaultSingletonTraits; |
12 | 13 |
13 // The BrowserAccessibilityState class is used to determine if Chrome should be | 14 // The BrowserAccessibilityState class is used to determine if Chrome should be |
14 // customized for users with assistive technology, such as screen readers. We | 15 // customized for users with assistive technology, such as screen readers. We |
15 // modify the behavior of certain user interfaces to provide a better experience | 16 // modify the behavior of certain user interfaces to provide a better experience |
16 // for screen reader users. The way we detect a screen reader program is | 17 // for screen reader users. The way we detect a screen reader program is |
17 // different for each platform. | 18 // different for each platform. |
18 // | 19 // |
19 // Screen Reader Detection | 20 // Screen Reader Detection |
20 // (1) On windows many screen reader detection mechinisms will give false | 21 // (1) On windows many screen reader detection mechinisms will give false |
21 // positives like relying on the SPI_GETSCREENREADER system parameter. In Chrome | 22 // positives like relying on the SPI_GETSCREENREADER system parameter. In Chrome |
22 // we attempt to dynamically detect a MSAA client screen reader by calling | 23 // we attempt to dynamically detect a MSAA client screen reader by calling |
23 // NotifiyWinEvent in NativeWidgetWin with a custom ID and wait to see if the ID | 24 // NotifiyWinEvent in NativeWidgetWin with a custom ID and wait to see if the ID |
24 // is requested by a subsequent call to WM_GETOBJECT. | 25 // is requested by a subsequent call to WM_GETOBJECT. |
25 // (2) On mac we detect dynamically if VoiceOver is running. We rely upon the | 26 // (2) On mac we detect dynamically if VoiceOver is running. We rely upon the |
26 // undocumented accessibility attribute @"AXEnhancedUserInterface" which is set | 27 // undocumented accessibility attribute @"AXEnhancedUserInterface" which is set |
27 // when VoiceOver is launched and unset when VoiceOver is closed. This is an | 28 // when VoiceOver is launched and unset when VoiceOver is closed. This is an |
28 // improvement over reading defaults preference values (which has no callback | 29 // improvement over reading defaults preference values (which has no callback |
29 // mechanism). | 30 // mechanism). |
30 class BrowserAccessibilityState { | 31 class CONTENT_EXPORT BrowserAccessibilityState { |
31 public: | 32 public: |
32 // Returns the singleton instance. | 33 // Returns the singleton instance. |
33 static BrowserAccessibilityState* GetInstance(); | 34 static BrowserAccessibilityState* GetInstance(); |
34 | 35 |
35 ~BrowserAccessibilityState(); | 36 ~BrowserAccessibilityState(); |
36 | 37 |
37 // Called when screen reader client is detected. | 38 // Called when screen reader client is detected. |
38 void OnScreenReaderDetected(); | 39 void OnScreenReaderDetected(); |
39 | 40 |
40 // Returns true if the browser should be customized for accessibility. | 41 // Returns true if the browser should be customized for accessibility. |
41 bool IsAccessibleBrowser(); | 42 bool IsAccessibleBrowser(); |
42 | 43 |
43 private: | 44 private: |
44 BrowserAccessibilityState(); | 45 BrowserAccessibilityState(); |
45 friend struct DefaultSingletonTraits<BrowserAccessibilityState>; | 46 friend struct DefaultSingletonTraits<BrowserAccessibilityState>; |
46 | 47 |
47 // Set to true when a screen reader client is detected. | 48 // Set to true when a screen reader client is detected. |
48 bool screen_reader_active_; | 49 bool screen_reader_active_; |
49 | 50 |
50 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityState); | 51 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityState); |
51 }; | 52 }; |
52 | 53 |
53 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_STATE_H_ | 54 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_STATE_H_ |
OLD | NEW |