Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(386)

Side by Side Diff: content/renderer/renderer_accessibility_complete.h

Issue 10544099: Refactor all accessibility code out of webkit/glue. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More Mac compile errors Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #ifndef CONTENT_RENDERER_RENDERER_ACCESSIBILITY_COMPLETE_H_ 5 #ifndef CONTENT_RENDERER_RENDERER_ACCESSIBILITY_COMPLETE_H_
6 #define CONTENT_RENDERER_RENDERER_ACCESSIBILITY_COMPLETE_H_ 6 #define CONTENT_RENDERER_RENDERER_ACCESSIBILITY_COMPLETE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/hash_tables.h" 11 #include "base/hash_tables.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "content/common/accessibility_node_data.h"
13 #include "content/public/renderer/render_view_observer.h" 14 #include "content/public/renderer/render_view_observer.h"
14 #include "content/renderer/renderer_accessibility.h" 15 #include "content/renderer/renderer_accessibility.h"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityNotif ication.h" 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityNotif ication.h"
16 17
17 class RenderViewImpl; 18 class RenderViewImpl;
18 19
19 namespace WebKit { 20 namespace WebKit {
20 class WebAccessibilityObject; 21 class WebAccessibilityObject;
21 class WebDocument; 22 class WebDocument;
22 class WebNode; 23 class WebNode;
23 }; 24 };
24 25
25 namespace webkit_glue {
26 struct WebAccessibility;
27 };
28
29 namespace content { 26 namespace content {
30 27
31 // This is the subclass of RendererAccessibility that implements 28 // This is the subclass of RendererAccessibility that implements
32 // complete accessibility support for assistive technology (as opposed to 29 // complete accessibility support for assistive technology (as opposed to
33 // partial support - see RendererAccessibilityFocusOnly). 30 // partial support - see RendererAccessibilityFocusOnly).
34 // 31 //
35 // This version turns on WebKit's accessibility code and sends 32 // This version turns on WebKit's accessibility code and sends
36 // a serialized representation of that tree whenever it changes. It also 33 // a serialized representation of that tree whenever it changes. It also
37 // handles requests from the browser to perform accessibility actions on 34 // handles requests from the browser to perform accessibility actions on
38 // nodes in the tree (e.g., change focus, or click on a button). 35 // nodes in the tree (e.g., change focus, or click on a button).
(...skipping 26 matching lines...) Expand all
65 ~BrowserTreeNode() {} 62 ~BrowserTreeNode() {}
66 int32 id; 63 int32 id;
67 std::vector<BrowserTreeNode*> children; 64 std::vector<BrowserTreeNode*> children;
68 }; 65 };
69 66
70 // Send queued notifications from the renderer to the browser. 67 // Send queued notifications from the renderer to the browser.
71 void SendPendingAccessibilityNotifications(); 68 void SendPendingAccessibilityNotifications();
72 69
73 // Update our representation of what nodes the browser has, given a 70 // Update our representation of what nodes the browser has, given a
74 // tree of nodes. 71 // tree of nodes.
75 void UpdateBrowserTree(const webkit_glue::WebAccessibility& renderer_node); 72 void UpdateBrowserTree(const AccessibilityNodeData& renderer_node);
76 73
77 // Clear the given node and recursively delete all of its descendants 74 // Clear the given node and recursively delete all of its descendants
78 // from the browser tree. (Does not delete |browser_node|). 75 // from the browser tree. (Does not delete |browser_node|).
79 void ClearBrowserTreeNode(BrowserTreeNode* browser_node); 76 void ClearBrowserTreeNode(BrowserTreeNode* browser_node);
80 77
81 // Handlers for messages from the browser to the renderer. 78 // Handlers for messages from the browser to the renderer.
82 void OnDoDefaultAction(int acc_obj_id); 79 void OnDoDefaultAction(int acc_obj_id);
83 void OnNotificationsAck(); 80 void OnNotificationsAck();
84 void OnChangeScrollPosition(int acc_obj_id, int scroll_x, int scroll_y); 81 void OnChangeScrollPosition(int acc_obj_id, int scroll_x, int scroll_y);
85 void OnScrollToMakeVisible(int acc_obj_id, gfx::Rect subfocus); 82 void OnScrollToMakeVisible(int acc_obj_id, gfx::Rect subfocus);
86 void OnScrollToPoint(int acc_obj_id, gfx::Point point); 83 void OnScrollToPoint(int acc_obj_id, gfx::Point point);
87 void OnSetFocus(int acc_obj_id); 84 void OnSetFocus(int acc_obj_id);
88 85
89 void OnSetTextSelection(int acc_obj_id, int start_offset, int end_offset); 86 void OnSetTextSelection(int acc_obj_id, int start_offset, int end_offset);
90 87
91 // Whether or not this notification typically needs to send 88 // Whether or not this notification typically needs to send
92 // updates to its children, too. 89 // updates to its children, too.
93 bool ShouldIncludeChildren( 90 bool ShouldIncludeChildren(
94 const AccessibilityHostMsg_NotificationParams& notification); 91 const AccessibilityHostMsg_NotificationParams& notification);
95 92
96 // Checks if a WebKit accessibility object is an editable text node. 93 // Checks if a WebKit accessibility object is an editable text node.
97 bool IsEditableText(const WebKit::WebAccessibilityObject& node); 94 bool IsEditableText(const WebKit::WebAccessibilityObject& node);
98 95
99 // Recursively explore the tree of WebKit accessibility objects rooted 96 // Recursively explore the tree of WebKit accessibility objects rooted
100 // at |src|, and for each editable text node encountered, add a 97 // at |src|, and for each editable text node encountered, add a
101 // corresponding WebAccessibility node as a child of |dst|. 98 // corresponding WebAccessibility node as a child of |dst|.
102 void RecursiveAddEditableTextNodesToTree( 99 void RecursiveAddEditableTextNodesToTree(
103 const WebKit::WebAccessibilityObject& src, 100 const WebKit::WebAccessibilityObject& src,
104 webkit_glue::WebAccessibility* dst); 101 AccessibilityNodeData* dst);
105 102
106 // Build a tree of serializable WebAccessibility nodes to send to the 103 // Build a tree of serializable AccessibilityNodeData nodes to send to the
107 // browser process, given a WebAccessibilityObject node from WebKit. 104 // browser process, given a WebAccessibilityObject node from WebKit.
108 // Modifies |dst| in-place, it's assumed to be empty. 105 // Modifies |dst| in-place, it's assumed to be empty.
109 void BuildAccessibilityTree(const WebKit::WebAccessibilityObject& src, 106 void BuildAccessibilityTree(const WebKit::WebAccessibilityObject& src,
110 bool include_children, 107 bool include_children,
111 webkit_glue::WebAccessibility* dst); 108 AccessibilityNodeData* dst);
112 109
113 // So we can queue up tasks to be executed later. 110 // So we can queue up tasks to be executed later.
114 base::WeakPtrFactory<RendererAccessibilityComplete> weak_factory_; 111 base::WeakPtrFactory<RendererAccessibilityComplete> weak_factory_;
115 112
116 // Notifications from WebKit are collected until they are ready to be 113 // Notifications from WebKit are collected until they are ready to be
117 // sent to the browser. 114 // sent to the browser.
118 std::vector<AccessibilityHostMsg_NotificationParams> pending_notifications_; 115 std::vector<AccessibilityHostMsg_NotificationParams> pending_notifications_;
119 116
120 // Our representation of the browser tree. 117 // Our representation of the browser tree.
121 BrowserTreeNode* browser_root_; 118 BrowserTreeNode* browser_root_;
(...skipping 14 matching lines...) Expand all
136 133
137 // True if verbose logging of accessibility events is on. 134 // True if verbose logging of accessibility events is on.
138 bool logging_; 135 bool logging_;
139 136
140 DISALLOW_COPY_AND_ASSIGN(RendererAccessibilityComplete); 137 DISALLOW_COPY_AND_ASSIGN(RendererAccessibilityComplete);
141 }; 138 };
142 139
143 #endif // CONTENT_RENDERER_RENDERER_ACCESSIBILITY_COMPLETE_H_ 140 #endif // CONTENT_RENDERER_RENDERER_ACCESSIBILITY_COMPLETE_H_
144 141
145 } // namespace content 142 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/renderer_accessibility_browsertest.cc ('k') | content/renderer/renderer_accessibility_complete.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698