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

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

Issue 2410333005: Create AXAction and AXActionData as a way to simplify accessibility actions (Closed)
Patch Set: Fix Android compile 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(ui::AXAction action,
69 virtual void AccessibilityShowContextMenu(int acc_obj_id) = 0; 70 const ui::AXActionData& data) = 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; 71 virtual bool AccessibilityViewHasFocus() const = 0;
83 virtual gfx::Rect AccessibilityGetViewBounds() const = 0; 72 virtual gfx::Rect AccessibilityGetViewBounds() const = 0;
84 virtual gfx::Point AccessibilityOriginInScreen( 73 virtual gfx::Point AccessibilityOriginInScreen(
85 const gfx::Rect& bounds) const = 0; 74 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; 75 virtual void AccessibilityFatalError() = 0;
90 virtual gfx::AcceleratedWidget AccessibilityGetAcceleratedWidget() = 0; 76 virtual gfx::AcceleratedWidget AccessibilityGetAcceleratedWidget() = 0;
91 virtual gfx::NativeViewAccessible AccessibilityGetNativeViewAccessible() = 0; 77 virtual gfx::NativeViewAccessible AccessibilityGetNativeViewAccessible() = 0;
92 }; 78 };
93 79
94 class CONTENT_EXPORT BrowserAccessibilityFactory { 80 class CONTENT_EXPORT BrowserAccessibilityFactory {
95 public: 81 public:
96 virtual ~BrowserAccessibilityFactory() {} 82 virtual ~BrowserAccessibilityFactory() {}
97 83
98 // Create an instance of BrowserAccessibility and return a new 84 // 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. 180 // communicate with the renderer and doesn't fire any events.
195 void SetFocusLocallyForTesting(BrowserAccessibility* node); 181 void SetFocusLocallyForTesting(BrowserAccessibility* node);
196 182
197 // For testing only, register a function to be called when focus changes 183 // For testing only, register a function to be called when focus changes
198 // in any BrowserAccessibilityManager. 184 // in any BrowserAccessibilityManager.
199 static void SetFocusChangeCallbackForTesting(const base::Closure& callback); 185 static void SetFocusChangeCallbackForTesting(const base::Closure& callback);
200 186
201 // Tell the renderer to do the default action for this node. 187 // Tell the renderer to do the default action for this node.
202 void DoDefaultAction(const BrowserAccessibility& node); 188 void DoDefaultAction(const BrowserAccessibility& node);
203 189
190 // Tell the renderer to show the context menu for a given node.
191 void ShowContextMenu(const BrowserAccessibility& node);
192
204 // Tell the renderer to scroll to make |node| visible. 193 // Tell the renderer to scroll to make |node| visible.
205 // In addition, if it's not possible to make the entire object visible, 194 // 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 195 // scroll so that the |subfocus| rect is visible at least. The subfocus
207 // rect is in local coordinates of the object itself. 196 // rect is in local coordinates of the object itself.
208 void ScrollToMakeVisible( 197 void ScrollToMakeVisible(
209 const BrowserAccessibility& node, gfx::Rect subfocus); 198 const BrowserAccessibility& node, gfx::Rect subfocus);
210 199
211 // Tell the renderer to scroll such that |node| is at |point|, 200 // Tell the renderer to scroll such that |node| is at |point|,
212 // where |point| is in global coordinates of the WebContents. 201 // where |point| is in global coordinates of the WebContents.
213 void ScrollToPoint( 202 void ScrollToPoint(
214 const BrowserAccessibility& node, gfx::Point point); 203 const BrowserAccessibility& node, gfx::Point point);
215 204
216 // If |node| is itself a scrollable container, set its scroll 205 // If |node| is itself a scrollable container, set its scroll
217 // offset to |offset|. 206 // offset to |offset|.
218 void SetScrollOffset(const BrowserAccessibility& node, gfx::Point offset); 207 void SetScrollOffset(const BrowserAccessibility& node, gfx::Point offset);
219 208
220 // Tell the renderer to set the value of an editable text node. 209 // Tell the renderer to set the value of an editable text node.
221 void SetValue( 210 void SetValue(
222 const BrowserAccessibility& node, const base::string16& value); 211 const BrowserAccessibility& node, const base::string16& value);
223 212
224 // Tell the renderer to set the text selection on a node. 213 // Tell the renderer to set the text selection on a node.
225 void SetTextSelection( 214 void SetTextSelection(
226 const BrowserAccessibility& node, int start_offset, int end_offset); 215 const BrowserAccessibility& node, int start_offset, int end_offset);
227 216
217 // Tell the renderer to set accessibility focus to this node.
218 void SetAccessibilityFocus(const BrowserAccessibility& node);
219
220 // Tell the renderer to do a hit test on a point in global screen coordinates
221 // and fire a HOVER event on the node that's hit.
222 void HitTest(const gfx::Point& point);
223
228 // Retrieve the bounds of the parent View in screen coordinates. 224 // Retrieve the bounds of the parent View in screen coordinates.
229 gfx::Rect GetViewBounds(); 225 gfx::Rect GetViewBounds();
230 226
231 // Fire an event telling native assistive technology to move focus to the 227 // Fire an event telling native assistive technology to move focus to the
232 // given find in page result. 228 // given find in page result.
233 void ActivateFindInPageResult(int request_id, int match_index); 229 void ActivateFindInPageResult(int request_id, int match_index);
234 230
235 // Called when the renderer process has notified us of about tree changes. 231 // Called when the renderer process has notified us of about tree changes.
236 virtual void OnAccessibilityEvents( 232 virtual void OnAccessibilityEvents(
237 const std::vector<AXEventNotificationDetails>& details); 233 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 479 // 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. 480 // speed so that it can be accessed quickly if it hasn't changed.
485 int parent_node_id_from_parent_tree_; 481 int parent_node_id_from_parent_tree_;
486 482
487 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager); 483 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager);
488 }; 484 };
489 485
490 } // namespace content 486 } // namespace content
491 487
492 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ 488 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698