OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_RENDERER_RENDERER_ACCESSIBILITY_H_ | |
6 #define CONTENT_RENDERER_RENDERER_ACCESSIBILITY_H_ | |
7 | |
8 #include "content/common/accessibility_messages.h" | |
9 #include "content/public/renderer/render_view_observer.h" | |
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityNotif
ication.h" | |
11 | |
12 namespace WebKit { | |
13 class WebAccessibilityObject; | |
14 class WebDocument; | |
15 }; | |
16 | |
17 namespace content { | |
18 class RenderViewImpl; | |
19 | |
20 // The browser process implement native accessibility APIs, allowing | |
21 // assistive technology (e.g., screen readers, magnifiers) to access and | |
22 // control the web contents with high-level APIs. These APIs are also used | |
23 // by automation tools, and Windows 8 uses them to determine when the | |
24 // on-screen keyboard should be shown. | |
25 // | |
26 // An instance of this class (or rather, a subclass) belongs to RenderViewImpl. | |
27 // Accessibility is initialized based on the AccessibilityMode of | |
28 // RenderViewImpl; it lazily starts as Off or EditableTextOnly depending on | |
29 // the operating system, and switches to Complete if assistive technology is | |
30 // detected or a flag is set. | |
31 // | |
32 // A tree of accessible objects is built here and sent to the browser process; | |
33 // the browser process maintains this as a tree of platform-native | |
34 // accessible objects that can be used to respond to accessibility requests | |
35 // from other processes. | |
36 // | |
37 // This base class just contains common code and will not do anything by itself. | |
38 // The two subclasses are: | |
39 // | |
40 // RendererAccessibilityComplete - turns on WebKit accessibility and | |
41 // provides a full accessibility implementation for when | |
42 // assistive technology is running. | |
43 // | |
44 // RendererAccessibilityFocusOnly - does not turn on WebKit | |
45 // accessibility. Only sends a minimal accessible tree to the | |
46 // browser whenever focus changes. This mode is currently used | |
47 // to support opening the on-screen keyboard in response to | |
48 // touch events on Windows 8 in Metro mode. | |
49 // | |
50 // What both subclasses have in common is that they are responsible for | |
51 // | |
52 class RendererAccessibility : public RenderViewObserver { | |
53 public: | |
54 explicit RendererAccessibility(RenderViewImpl* render_view); | |
55 virtual ~RendererAccessibility(); | |
56 | |
57 // Called when an accessibility notification occurs in WebKit. | |
58 virtual void HandleWebAccessibilityNotification( | |
59 const WebKit::WebAccessibilityObject& obj, | |
60 WebKit::WebAccessibilityNotification notification) = 0; | |
61 | |
62 protected: | |
63 // Returns the main top-level document for this page, or NULL if there's | |
64 // no view or frame. | |
65 WebKit::WebDocument GetMainDocument(); | |
66 | |
67 #ifndef NDEBUG | |
68 const std::string AccessibilityNotificationToString( | |
69 AccessibilityNotification notification); | |
70 #endif | |
71 | |
72 // The RenderViewImpl that owns us. | |
73 RenderViewImpl* render_view_; | |
74 | |
75 // True if verbose logging of accessibility events is on. | |
76 bool logging_; | |
77 | |
78 DISALLOW_COPY_AND_ASSIGN(RendererAccessibility); | |
79 }; | |
80 | |
81 } // namespace content | |
82 | |
83 #endif // CONTENT_RENDERER_RENDERER_ACCESSIBILITY_H_ | |
OLD | NEW |