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

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

Issue 63253002: Rename WebKit namespace to blink (part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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_ACCESSIBILITY_RENDERER_ACCESSIBILITY_COMPLETE_H_ 5 #ifndef CONTENT_RENDERER_ACCESSIBILITY_RENDERER_ACCESSIBILITY_COMPLETE_H_
6 #define CONTENT_RENDERER_ACCESSIBILITY_RENDERER_ACCESSIBILITY_COMPLETE_H_ 6 #define CONTENT_RENDERER_ACCESSIBILITY_RENDERER_ACCESSIBILITY_COMPLETE_H_
7 7
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/containers/hash_tables.h" 11 #include "base/containers/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/common/accessibility_node_data.h"
14 #include "content/public/renderer/render_view_observer.h" 14 #include "content/public/renderer/render_view_observer.h"
15 #include "content/renderer/accessibility/renderer_accessibility.h" 15 #include "content/renderer/accessibility/renderer_accessibility.h"
16 #include "third_party/WebKit/public/web/WebAXEnums.h" 16 #include "third_party/WebKit/public/web/WebAXEnums.h"
17 #include "third_party/WebKit/public/web/WebAXObject.h" 17 #include "third_party/WebKit/public/web/WebAXObject.h"
18 18
19 namespace WebKit { 19 namespace blink {
20 class WebDocument; 20 class WebDocument;
21 class WebNode; 21 class WebNode;
22 }; 22 };
23 23
24 namespace content { 24 namespace content {
25 class RenderViewImpl; 25 class RenderViewImpl;
26 26
27 // This is the subclass of RendererAccessibility that implements 27 // This is the subclass of RendererAccessibility that implements
28 // complete accessibility support for assistive technology (as opposed to 28 // complete accessibility support for assistive technology (as opposed to
29 // partial support - see RendererAccessibilityFocusOnly). 29 // partial support - see RendererAccessibilityFocusOnly).
30 // 30 //
31 // This version turns on WebKit's accessibility code and sends 31 // This version turns on WebKit's accessibility code and sends
32 // a serialized representation of that tree whenever it changes. It also 32 // a serialized representation of that tree whenever it changes. It also
33 // handles requests from the browser to perform accessibility actions on 33 // handles requests from the browser to perform accessibility actions on
34 // nodes in the tree (e.g., change focus, or click on a button). 34 // nodes in the tree (e.g., change focus, or click on a button).
35 class CONTENT_EXPORT RendererAccessibilityComplete 35 class CONTENT_EXPORT RendererAccessibilityComplete
36 : public RendererAccessibility { 36 : public RendererAccessibility {
37 public: 37 public:
38 explicit RendererAccessibilityComplete(RenderViewImpl* render_view); 38 explicit RendererAccessibilityComplete(RenderViewImpl* render_view);
39 virtual ~RendererAccessibilityComplete(); 39 virtual ~RendererAccessibilityComplete();
40 40
41 // RenderView::Observer implementation. 41 // RenderView::Observer implementation.
42 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 42 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
43 virtual void FocusedNodeChanged(const WebKit::WebNode& node) OVERRIDE; 43 virtual void FocusedNodeChanged(const blink::WebNode& node) OVERRIDE;
44 virtual void DidFinishLoad(WebKit::WebFrame* frame) OVERRIDE; 44 virtual void DidFinishLoad(blink::WebFrame* frame) OVERRIDE;
45 45
46 // RendererAccessibility. 46 // RendererAccessibility.
47 virtual void HandleWebAccessibilityEvent( 47 virtual void HandleWebAccessibilityEvent(
48 const WebKit::WebAXObject& obj, WebKit::WebAXEvent event) OVERRIDE; 48 const blink::WebAXObject& obj, blink::WebAXEvent event) OVERRIDE;
49 49
50 // In order to keep track of what nodes the browser knows about, we keep a 50 // In order to keep track of what nodes the browser knows about, we keep a
51 // representation of the browser tree - just IDs and parent/child 51 // representation of the browser tree - just IDs and parent/child
52 // relationships. 52 // relationships.
53 struct CONTENT_EXPORT BrowserTreeNode { 53 struct CONTENT_EXPORT BrowserTreeNode {
54 BrowserTreeNode(); 54 BrowserTreeNode();
55 virtual ~BrowserTreeNode(); 55 virtual ~BrowserTreeNode();
56 int32 id; 56 int32 id;
57 gfx::Rect location; 57 gfx::Rect location;
58 BrowserTreeNode* parent; 58 BrowserTreeNode* parent;
(...skipping 12 matching lines...) Expand all
71 // that updates the coordinates of these objects. 71 // that updates the coordinates of these objects.
72 void AppendLocationChangeEvents( 72 void AppendLocationChangeEvents(
73 std::vector<AccessibilityHostMsg_EventParams>* events); 73 std::vector<AccessibilityHostMsg_EventParams>* events);
74 74
75 private: 75 private:
76 // Serialize the given accessibility object |obj| and append it to 76 // Serialize the given accessibility object |obj| and append it to
77 // |dst|, and then recursively also serialize any *new* children of 77 // |dst|, and then recursively also serialize any *new* children of
78 // |obj|, based on what object ids we know the browser already has. 78 // |obj|, based on what object ids we know the browser already has.
79 // The set of ids serialized is added to |ids_serialized|, and any 79 // The set of ids serialized is added to |ids_serialized|, and any
80 // ids previously in that set are not serialized again. 80 // ids previously in that set are not serialized again.
81 void SerializeChangedNodes(const WebKit::WebAXObject& obj, 81 void SerializeChangedNodes(const blink::WebAXObject& obj,
82 std::vector<AccessibilityNodeData>* dst, 82 std::vector<AccessibilityNodeData>* dst,
83 std::set<int>* ids_serialized); 83 std::set<int>* ids_serialized);
84 84
85 // Clear the given node and recursively delete all of its descendants 85 // Clear the given node and recursively delete all of its descendants
86 // from the browser tree. (Does not delete |browser_node|). 86 // from the browser tree. (Does not delete |browser_node|).
87 void ClearBrowserTreeNode(BrowserTreeNode* browser_node); 87 void ClearBrowserTreeNode(BrowserTreeNode* browser_node);
88 88
89 // Handlers for messages from the browser to the renderer. 89 // Handlers for messages from the browser to the renderer.
90 void OnDoDefaultAction(int acc_obj_id); 90 void OnDoDefaultAction(int acc_obj_id);
91 void OnEventsAck(); 91 void OnEventsAck();
92 void OnChangeScrollPosition(int acc_obj_id, int scroll_x, int scroll_y); 92 void OnChangeScrollPosition(int acc_obj_id, int scroll_x, int scroll_y);
93 void OnScrollToMakeVisible(int acc_obj_id, gfx::Rect subfocus); 93 void OnScrollToMakeVisible(int acc_obj_id, gfx::Rect subfocus);
94 void OnScrollToPoint(int acc_obj_id, gfx::Point point); 94 void OnScrollToPoint(int acc_obj_id, gfx::Point point);
95 void OnSetFocus(int acc_obj_id); 95 void OnSetFocus(int acc_obj_id);
96 void OnSetTextSelection(int acc_obj_id, int start_offset, int end_offset); 96 void OnSetTextSelection(int acc_obj_id, int start_offset, int end_offset);
97 void OnFatalError(); 97 void OnFatalError();
98 98
99 // Checks if a WebKit accessibility object is an editable text node. 99 // Checks if a WebKit accessibility object is an editable text node.
100 bool IsEditableText(const WebKit::WebAXObject& node); 100 bool IsEditableText(const blink::WebAXObject& node);
101 101
102 // Recursively explore the tree of WebKit accessibility objects rooted 102 // Recursively explore the tree of WebKit accessibility objects rooted
103 // at |src|, and for each editable text node encountered, add a 103 // at |src|, and for each editable text node encountered, add a
104 // corresponding WebAccessibility node as a child of |dst|. 104 // corresponding WebAccessibility node as a child of |dst|.
105 void RecursiveAddEditableTextNodesToTree( 105 void RecursiveAddEditableTextNodesToTree(
106 const WebKit::WebAXObject& src, 106 const blink::WebAXObject& src,
107 AccessibilityNodeData* dst); 107 AccessibilityNodeData* dst);
108 108
109 // Build a tree of serializable AccessibilityNodeData nodes to send to the 109 // Build a tree of serializable AccessibilityNodeData nodes to send to the
110 // browser process, given a WebAXObject node from WebKit. 110 // browser process, given a WebAXObject node from WebKit.
111 // Modifies |dst| in-place, it's assumed to be empty. 111 // Modifies |dst| in-place, it's assumed to be empty.
112 void BuildAccessibilityTree(const WebKit::WebAXObject& src, 112 void BuildAccessibilityTree(const blink::WebAXObject& src,
113 bool include_children, 113 bool include_children,
114 AccessibilityNodeData* dst); 114 AccessibilityNodeData* dst);
115 115
116 // So we can queue up tasks to be executed later. 116 // So we can queue up tasks to be executed later.
117 base::WeakPtrFactory<RendererAccessibilityComplete> weak_factory_; 117 base::WeakPtrFactory<RendererAccessibilityComplete> weak_factory_;
118 118
119 // Events from WebKit are collected until they are ready to be 119 // Events from WebKit are collected until they are ready to be
120 // sent to the browser. 120 // sent to the browser.
121 std::vector<AccessibilityHostMsg_EventParams> pending_events_; 121 std::vector<AccessibilityHostMsg_EventParams> pending_events_;
122 122
(...skipping 16 matching lines...) Expand all
139 139
140 // True if verbose logging of accessibility events is on. 140 // True if verbose logging of accessibility events is on.
141 bool logging_; 141 bool logging_;
142 142
143 DISALLOW_COPY_AND_ASSIGN(RendererAccessibilityComplete); 143 DISALLOW_COPY_AND_ASSIGN(RendererAccessibilityComplete);
144 }; 144 };
145 145
146 #endif // CONTENT_RENDERER_ACCESSIBILITY_RENDERER_ACCESSIBILITY_COMPLETE_H_ 146 #endif // CONTENT_RENDERER_ACCESSIBILITY_RENDERER_ACCESSIBILITY_COMPLETE_H_
147 147
148 } // namespace content 148 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698