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

Side by Side Diff: content/browser/accessibility/browser_accessibility_manager.h

Issue 2426193003: Re-land: Create AXAction and AXActionData as a way to simplify accessibility actions (Closed)
Patch Set: Rebase Created 4 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
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_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ 5 #ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_
6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ 6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/callback_forward.h" 13 #include "base/callback_forward.h"
14 #include "base/containers/hash_tables.h" 14 #include "base/containers/hash_tables.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "build/build_config.h" 16 #include "build/build_config.h"
17 #include "content/browser/accessibility/ax_tree_id_registry.h" 17 #include "content/browser/accessibility/ax_tree_id_registry.h"
18 #include "content/browser/accessibility/browser_accessibility_event.h" 18 #include "content/browser/accessibility/browser_accessibility_event.h"
19 #include "content/common/content_export.h" 19 #include "content/common/content_export.h"
20 #include "content/public/browser/ax_event_notification_details.h" 20 #include "content/public/browser/ax_event_notification_details.h"
21 #include "third_party/WebKit/public/web/WebAXEnums.h" 21 #include "third_party/WebKit/public/web/WebAXEnums.h"
22 #include "ui/accessibility/ax_action_data.h"
22 #include "ui/accessibility/ax_node_data.h" 23 #include "ui/accessibility/ax_node_data.h"
23 #include "ui/accessibility/ax_serializable_tree.h" 24 #include "ui/accessibility/ax_serializable_tree.h"
24 #include "ui/accessibility/ax_tree_update.h" 25 #include "ui/accessibility/ax_tree_update.h"
25 #include "ui/gfx/native_widget_types.h" 26 #include "ui/gfx/native_widget_types.h"
26 27
27 struct AccessibilityHostMsg_LocationChangeParams; 28 struct AccessibilityHostMsg_LocationChangeParams;
28 29
29 namespace content { 30 namespace content {
30 class BrowserAccessibility; 31 class BrowserAccessibility;
31 class BrowserAccessibilityManager; 32 class BrowserAccessibilityManager;
(...skipping 25 matching lines...) Expand all
57 // Class that can perform actions on behalf of the BrowserAccessibilityManager. 58 // Class that can perform actions on behalf of the BrowserAccessibilityManager.
58 // Note: BrowserAccessibilityManager should never cache any of the return 59 // Note: BrowserAccessibilityManager should never cache any of the return
59 // values from any of these interfaces, especially those that return pointers. 60 // values from any of these interfaces, especially those that return pointers.
60 // They may only be valid within this call stack. That policy eliminates any 61 // They may only be valid within this call stack. That policy eliminates any
61 // concerns about ownership and lifecycle issues; none of these interfaces 62 // concerns about ownership and lifecycle issues; none of these interfaces
62 // transfer ownership and no return values are guaranteed to be valid outside 63 // transfer ownership and no return values are guaranteed to be valid outside
63 // of the current call stack. 64 // of the current call stack.
64 class CONTENT_EXPORT BrowserAccessibilityDelegate { 65 class CONTENT_EXPORT BrowserAccessibilityDelegate {
65 public: 66 public:
66 virtual ~BrowserAccessibilityDelegate() {} 67 virtual ~BrowserAccessibilityDelegate() {}
67 virtual void AccessibilitySetFocus(int acc_obj_id) = 0; 68
68 virtual void AccessibilityDoDefaultAction(int acc_obj_id) = 0; 69 virtual void AccessibilityPerformAction(const ui::AXActionData& data) = 0;
69 virtual void AccessibilityShowContextMenu(int acc_obj_id) = 0;
70 virtual void AccessibilityScrollToMakeVisible(
71 int acc_obj_id, const gfx::Rect& subfocus) = 0;
72 virtual void AccessibilityScrollToPoint(
73 int acc_obj_id, const gfx::Point& point) = 0;
74 virtual void AccessibilitySetScrollOffset(
75 int acc_obj_id, const gfx::Point& offset) = 0;
76 virtual void AccessibilitySetSelection(int anchor_obj_id,
77 int anchor_offset,
78 int focus_obj_id,
79 int focus_offset) = 0;
80 virtual void AccessibilitySetValue(
81 int acc_obj_id, const base::string16& value) = 0;
82 virtual bool AccessibilityViewHasFocus() const = 0; 70 virtual bool AccessibilityViewHasFocus() const = 0;
83 virtual gfx::Rect AccessibilityGetViewBounds() const = 0; 71 virtual gfx::Rect AccessibilityGetViewBounds() const = 0;
84 virtual gfx::Point AccessibilityOriginInScreen( 72 virtual gfx::Point AccessibilityOriginInScreen(
85 const gfx::Rect& bounds) const = 0; 73 const gfx::Rect& bounds) const = 0;
86 virtual void AccessibilityHitTest(
87 const gfx::Point& point) = 0;
88 virtual void AccessibilitySetAccessibilityFocus(int acc_obj_id) = 0;
89 virtual void AccessibilityFatalError() = 0; 74 virtual void AccessibilityFatalError() = 0;
90 virtual gfx::AcceleratedWidget AccessibilityGetAcceleratedWidget() = 0; 75 virtual gfx::AcceleratedWidget AccessibilityGetAcceleratedWidget() = 0;
91 virtual gfx::NativeViewAccessible AccessibilityGetNativeViewAccessible() = 0; 76 virtual gfx::NativeViewAccessible AccessibilityGetNativeViewAccessible() = 0;
92 }; 77 };
93 78
94 class CONTENT_EXPORT BrowserAccessibilityFactory { 79 class CONTENT_EXPORT BrowserAccessibilityFactory {
95 public: 80 public:
96 virtual ~BrowserAccessibilityFactory() {} 81 virtual ~BrowserAccessibilityFactory() {}
97 82
98 // Create an instance of BrowserAccessibility and return a new 83 // Create an instance of BrowserAccessibility and return a new
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 // communicate with the renderer and doesn't fire any events. 179 // communicate with the renderer and doesn't fire any events.
195 void SetFocusLocallyForTesting(BrowserAccessibility* node); 180 void SetFocusLocallyForTesting(BrowserAccessibility* node);
196 181
197 // For testing only, register a function to be called when focus changes 182 // For testing only, register a function to be called when focus changes
198 // in any BrowserAccessibilityManager. 183 // in any BrowserAccessibilityManager.
199 static void SetFocusChangeCallbackForTesting(const base::Closure& callback); 184 static void SetFocusChangeCallbackForTesting(const base::Closure& callback);
200 185
201 // Tell the renderer to do the default action for this node. 186 // Tell the renderer to do the default action for this node.
202 void DoDefaultAction(const BrowserAccessibility& node); 187 void DoDefaultAction(const BrowserAccessibility& node);
203 188
189 // Tell the renderer to show the context menu for a given node.
190 void ShowContextMenu(const BrowserAccessibility& node);
191
204 // Tell the renderer to scroll to make |node| visible. 192 // Tell the renderer to scroll to make |node| visible.
205 // In addition, if it's not possible to make the entire object visible, 193 // In addition, if it's not possible to make the entire object visible,
206 // scroll so that the |subfocus| rect is visible at least. The subfocus 194 // scroll so that the |subfocus| rect is visible at least. The subfocus
207 // rect is in local coordinates of the object itself. 195 // rect is in local coordinates of the object itself.
208 void ScrollToMakeVisible( 196 void ScrollToMakeVisible(
209 const BrowserAccessibility& node, gfx::Rect subfocus); 197 const BrowserAccessibility& node, gfx::Rect subfocus);
210 198
211 // Tell the renderer to scroll such that |node| is at |point|, 199 // Tell the renderer to scroll such that |node| is at |point|,
212 // where |point| is in global coordinates of the WebContents. 200 // where |point| is in global coordinates of the WebContents.
213 void ScrollToPoint( 201 void ScrollToPoint(
214 const BrowserAccessibility& node, gfx::Point point); 202 const BrowserAccessibility& node, gfx::Point point);
215 203
216 // If |node| is itself a scrollable container, set its scroll 204 // If |node| is itself a scrollable container, set its scroll
217 // offset to |offset|. 205 // offset to |offset|.
218 void SetScrollOffset(const BrowserAccessibility& node, gfx::Point offset); 206 void SetScrollOffset(const BrowserAccessibility& node, gfx::Point offset);
219 207
220 // Tell the renderer to set the value of an editable text node. 208 // Tell the renderer to set the value of an editable text node.
221 void SetValue( 209 void SetValue(
222 const BrowserAccessibility& node, const base::string16& value); 210 const BrowserAccessibility& node, const base::string16& value);
223 211
224 // Tell the renderer to set the text selection on a node. 212 // Tell the renderer to set the text selection on a node.
225 void SetTextSelection( 213 void SetTextSelection(
226 const BrowserAccessibility& node, int start_offset, int end_offset); 214 const BrowserAccessibility& node, int start_offset, int end_offset);
227 215
216 // Tell the renderer to set accessibility focus to this node.
217 void SetAccessibilityFocus(const BrowserAccessibility& node);
218
219 // Tell the renderer to do a hit test on a point in global screen coordinates
220 // and fire a HOVER event on the node that's hit.
221 void HitTest(const gfx::Point& point);
222
228 // Retrieve the bounds of the parent View in screen coordinates. 223 // Retrieve the bounds of the parent View in screen coordinates.
229 gfx::Rect GetViewBounds(); 224 gfx::Rect GetViewBounds();
230 225
231 // Fire an event telling native assistive technology to move focus to the 226 // Fire an event telling native assistive technology to move focus to the
232 // given find in page result. 227 // given find in page result.
233 void ActivateFindInPageResult(int request_id, int match_index); 228 void ActivateFindInPageResult(int request_id, int match_index);
234 229
235 // Called when the renderer process has notified us of about tree changes. 230 // Called when the renderer process has notified us of about tree changes.
236 virtual void OnAccessibilityEvents( 231 virtual void OnAccessibilityEvents(
237 const std::vector<AXEventNotificationDetails>& details); 232 const std::vector<AXEventNotificationDetails>& details);
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 // node within that parent tree. It's computed as needed and cached for 478 // node within that parent tree. It's computed as needed and cached for
484 // speed so that it can be accessed quickly if it hasn't changed. 479 // speed so that it can be accessed quickly if it hasn't changed.
485 int parent_node_id_from_parent_tree_; 480 int parent_node_id_from_parent_tree_;
486 481
487 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager); 482 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager);
488 }; 483 };
489 484
490 } // namespace content 485 } // namespace content
491 486
492 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ 487 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698