OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "content/renderer/accessibility/renderer_accessibility.h" | 5 #include "content/renderer/accessibility/renderer_accessibility.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "content/public/common/content_switches.h" | 8 #include "content/public/common/content_switches.h" |
9 #include "content/renderer/render_view_impl.h" | 9 #include "content/renderer/render_view_impl.h" |
10 #include "third_party/WebKit/public/web/WebAccessibilityObject.h" | 10 #include "third_party/WebKit/public/web/WebAXObject.h" |
11 #include "third_party/WebKit/public/web/WebDocument.h" | 11 #include "third_party/WebKit/public/web/WebDocument.h" |
12 #include "third_party/WebKit/public/web/WebFrame.h" | 12 #include "third_party/WebKit/public/web/WebFrame.h" |
13 #include "third_party/WebKit/public/web/WebView.h" | 13 #include "third_party/WebKit/public/web/WebView.h" |
14 | 14 |
15 using WebKit::WebAccessibilityNotification; | 15 using WebKit::WebAXObject; |
16 using WebKit::WebAccessibilityObject; | |
17 using WebKit::WebDocument; | 16 using WebKit::WebDocument; |
18 using WebKit::WebFrame; | 17 using WebKit::WebFrame; |
19 using WebKit::WebView; | 18 using WebKit::WebView; |
20 | 19 |
21 namespace content { | 20 namespace content { |
22 | 21 |
23 RendererAccessibility::RendererAccessibility( | 22 RendererAccessibility::RendererAccessibility( |
24 RenderViewImpl* render_view) | 23 RenderViewImpl* render_view) |
25 : RenderViewObserver(render_view), | 24 : RenderViewObserver(render_view), |
26 render_view_(render_view), | 25 render_view_(render_view), |
(...skipping 10 matching lines...) Expand all Loading... |
37 WebView* view = render_view()->GetWebView(); | 36 WebView* view = render_view()->GetWebView(); |
38 WebFrame* main_frame = view ? view->mainFrame() : NULL; | 37 WebFrame* main_frame = view ? view->mainFrame() : NULL; |
39 | 38 |
40 if (main_frame) | 39 if (main_frame) |
41 return main_frame->document(); | 40 return main_frame->document(); |
42 | 41 |
43 return WebDocument(); | 42 return WebDocument(); |
44 } | 43 } |
45 | 44 |
46 #ifndef NDEBUG | 45 #ifndef NDEBUG |
47 const std::string RendererAccessibility::AccessibilityNotificationToString( | 46 const std::string RendererAccessibility::AccessibilityEventToString( |
48 AccessibilityNotification notification) { | 47 WebKit::WebAXEvent event) { |
49 switch (notification) { | 48 switch (event) { |
50 case AccessibilityNotificationActiveDescendantChanged: | 49 case WebKit::WebAXEventActiveDescendantChanged: |
51 return "active descendant changed"; | 50 return "active descendant changed"; |
52 case AccessibilityNotificationAriaAttributeChanged: | 51 case WebKit::WebAXEventAriaAttributeChanged: |
53 return "aria attribute changed"; | 52 return "aria attribute changed"; |
54 case AccessibilityNotificationAutocorrectionOccurred: | 53 case WebKit::WebAXEventAutocorrectionOccured: |
55 return "autocorrection occurred"; | 54 return "autocorrection occurred"; |
56 case AccessibilityNotificationBlur: | 55 case WebKit::WebAXEventBlur: |
57 return "blur"; | 56 return "blur"; |
58 case AccessibilityNotificationAlert: | 57 case WebKit::WebAXEventAlert: |
59 return "alert"; | 58 return "alert"; |
60 case AccessibilityNotificationCheckStateChanged: | 59 case WebKit::WebAXEventCheckedStateChanged: |
61 return "check state changed"; | 60 return "check state changed"; |
62 case AccessibilityNotificationChildrenChanged: | 61 case WebKit::WebAXEventChildrenChanged: |
63 return "children changed"; | 62 return "children changed"; |
64 case AccessibilityNotificationFocusChanged: | 63 case WebKit::WebAXEventFocus: |
65 return "focus changed"; | 64 return "focus changed"; |
66 case AccessibilityNotificationInvalidStatusChanged: | 65 case WebKit::WebAXEventInvalidStatusChanged: |
67 return "invalid status changed"; | 66 return "invalid status changed"; |
68 case AccessibilityNotificationLayoutComplete: | 67 case WebKit::WebAXEventLayoutComplete: |
69 return "layout complete"; | 68 return "layout complete"; |
70 case AccessibilityNotificationLiveRegionChanged: | 69 case WebKit::WebAXEventLiveRegionChanged: |
71 return "live region changed"; | 70 return "live region changed"; |
72 case AccessibilityNotificationLoadComplete: | 71 case WebKit::WebAXEventLoadComplete: |
73 return "load complete"; | 72 return "load complete"; |
74 case AccessibilityNotificationMenuListItemSelected: | 73 case WebKit::WebAXEventMenuListItemSelected: |
75 return "menu list item selected"; | 74 return "menu list item selected"; |
76 case AccessibilityNotificationMenuListValueChanged: | 75 case WebKit::WebAXEventMenuListValueChanged: |
77 return "menu list changed"; | 76 return "menu list changed"; |
78 case AccessibilityNotificationObjectShow: | 77 case WebKit::WebAXEventShow: |
79 return "object show"; | 78 return "object show"; |
80 case AccessibilityNotificationObjectHide: | 79 case WebKit::WebAXEventHide: |
81 return "object hide"; | 80 return "object hide"; |
82 case AccessibilityNotificationRowCountChanged: | 81 case WebKit::WebAXEventRowCountChanged: |
83 return "row count changed"; | 82 return "row count changed"; |
84 case AccessibilityNotificationRowCollapsed: | 83 case WebKit::WebAXEventRowCollapsed: |
85 return "row collapsed"; | 84 return "row collapsed"; |
86 case AccessibilityNotificationRowExpanded: | 85 case WebKit::WebAXEventRowExpanded: |
87 return "row expanded"; | 86 return "row expanded"; |
88 case AccessibilityNotificationScrolledToAnchor: | 87 case WebKit::WebAXEventScrolledToAnchor: |
89 return "scrolled to anchor"; | 88 return "scrolled to anchor"; |
90 case AccessibilityNotificationSelectedChildrenChanged: | 89 case WebKit::WebAXEventSelectedChildrenChanged: |
91 return "selected children changed"; | 90 return "selected children changed"; |
92 case AccessibilityNotificationSelectedTextChanged: | 91 case WebKit::WebAXEventSelectedTextChanged: |
93 return "selected text changed"; | 92 return "selected text changed"; |
94 case AccessibilityNotificationTextChanged: | 93 case WebKit::WebAXEventTextChanged: |
95 return "text changed"; | 94 return "text changed"; |
96 case AccessibilityNotificationTextInserted: | 95 case WebKit::WebAXEventTextInserted: |
97 return "text inserted"; | 96 return "text inserted"; |
98 case AccessibilityNotificationTextRemoved: | 97 case WebKit::WebAXEventTextRemoved: |
99 return "text removed"; | 98 return "text removed"; |
100 case AccessibilityNotificationValueChanged: | 99 case WebKit::WebAXEventValueChanged: |
101 return "value changed"; | 100 return "value changed"; |
102 default: | 101 default: |
103 NOTREACHED(); | 102 NOTREACHED(); |
104 } | 103 } |
105 return ""; | 104 return ""; |
106 } | 105 } |
107 #endif | 106 #endif |
108 | 107 |
109 } // namespace content | 108 } // namespace content |
OLD | NEW |