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

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

Issue 7966013: Rewrite renderer accessibility to not use WebAccessibilityCache. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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
« no previous file with comments | « content/renderer/render_view.cc ('k') | content/renderer/renderer_accessibility.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2011 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 #pragma once
8
9 #include <vector>
10
11 #include "base/hash_tables.h"
12 #include "base/task.h"
13 #include "content/renderer/render_view_observer.h"
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityNotif ication.h"
15
16 namespace WebKit {
17 class WebAccessibilityObject;
18 class WebDocument;
19 class WebNode;
20 };
21
22 namespace webkit_glue {
23 struct WebAccessibility;
24 };
25
26 // RendererAccessibility belongs to the RenderView. It's responsible for
27 // sending a serialized representation of WebKit's accessibility tree from
28 // the renderer to the browser and sending updates whenever it changes, and
29 // handling requests from the browser to perform accessibility actions on
30 // nodes in the tree (e.g., change focus, or click on a button).
31 class RendererAccessibility : public RenderViewObserver {
32 public:
33 RendererAccessibility(RenderView* render_view);
34 virtual ~RendererAccessibility();
35
36 // RenderView::Observer implementation.
37 virtual bool OnMessageReceived(const IPC::Message& message);
38 virtual void FocusedNodeChanged(const WebKit::WebNode& node);
39 virtual void DidFinishLoad(WebKit::WebFrame* frame);
40
41 // Called when an accessibility notification occurs in WebKit.
42 virtual void PostAccessibilityNotification(
43 const WebKit::WebAccessibilityObject& obj,
44 WebKit::WebAccessibilityNotification notification);
45
46 private:
47 // One accessibility notification from WebKit. These are queued up and
48 // used to send tree updates and notification messages from the
49 // renderer to the browser.
50 struct Notification {
51 public:
52 // The id of the accessibility object.
53 int32 id;
54
55 // The accessibility notification type.
56 WebKit::WebAccessibilityNotification type;
57 };
58
59 // In order to keep track of what nodes the browser knows about, we keep a
60 // representation of the browser tree - just IDs and parent/child
61 // relationships.
62 struct BrowserTreeNode {
63 BrowserTreeNode() {}
64 ~BrowserTreeNode() {}
65 int32 id;
66 std::vector<BrowserTreeNode*> children;
67 };
68
69 // Send queued notifications from the renderer to the browser.
70 void SendPendingAccessibilityNotifications();
71
72 // Update our representation of what nodes the browser has, given a
73 // tree of nodes.
74 void UpdateBrowserTree(const webkit_glue::WebAccessibility& renderer_node);
75
76 // Clear the given node and recursively delete all of its descendants
77 // from the browser tree. (Does not delete |browser_node|).
78 void ClearBrowserTreeNode(BrowserTreeNode* browser_node);
79
80 // Handlers for messages from the browser to the renderer.
81 void OnAccessibilityDoDefaultAction(int acc_obj_id);
82 void OnAccessibilityNotificationsAck();
83 void OnEnableAccessibility();
84 void OnSetAccessibilityFocus(int acc_obj_id);
85
86 // Whether or not this notification typically needs to send
87 // updates to its children, too.
88 bool ShouldIncludeChildren(const Notification& notification);
89
90 // Returns the main top-level document for this page, or NULL if there's
91 // no view or frame.
92 WebKit::WebDocument GetMainDocument();
93
94 // So we can queue up tasks to be executed later.
95 ScopedRunnableMethodFactory<RendererAccessibility> method_factory_;
96
97 // Notifications from WebKit are collected until they are ready to be
98 // sent to the browser.
99 std::vector<Notification> pending_notifications_;
100
101 // Our representation of the browser tree.
102 BrowserTreeNode* browser_root_;
103
104 // A map from IDs to nodes in the browser tree.
105 base::hash_map<int32, BrowserTreeNode*> browser_id_map_;
106
107 // Set if we are waiting for an accessibility notification ack.
108 bool ack_pending_;
109
110 // True if verbose logging of accessibility events is on.
111 bool logging_;
112
113 // True if we've sent a load complete notification for this page already.
114 bool sent_load_complete_;
115
116 DISALLOW_COPY_AND_ASSIGN(RendererAccessibility);
117 };
118
119 #endif // CONTENT_RENDERER_RENDERER_ACCESSIBILITY_H_
OLDNEW
« no previous file with comments | « content/renderer/render_view.cc ('k') | content/renderer/renderer_accessibility.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698