OLD | NEW |
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 <vector> | 10 #include <vector> |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 // Notify the accessibility manager about page navigation. | 165 // Notify the accessibility manager about page navigation. |
166 void UserIsNavigatingAway(); | 166 void UserIsNavigatingAway(); |
167 virtual void UserIsReloading(); | 167 virtual void UserIsReloading(); |
168 void NavigationSucceeded(); | 168 void NavigationSucceeded(); |
169 void NavigationFailed(); | 169 void NavigationFailed(); |
170 | 170 |
171 // Called to notify the accessibility manager that a mouse down event | 171 // Called to notify the accessibility manager that a mouse down event |
172 // occurred in the tab. | 172 // occurred in the tab. |
173 void GotMouseDown(); | 173 void GotMouseDown(); |
174 | 174 |
175 // Update the focused node to |node|, which may be null. | 175 // Send a message to the renderer to set focus to this node. |
176 // If |notify| is true, send a message to the renderer to set focus | 176 void SetFocus(const BrowserAccessibility& node); |
177 // to this node. | 177 |
178 void SetFocus(ui::AXNode* node, bool notify); | 178 // Pretend that the given node has focus, for testing only. Doesn't |
179 void SetFocus(BrowserAccessibility* node, bool notify); | 179 // communicate with the renderer and doesn't fire any events. |
| 180 void SetFocusLocallyForTesting(BrowserAccessibility* node); |
180 | 181 |
181 // Tell the renderer to do the default action for this node. | 182 // Tell the renderer to do the default action for this node. |
182 void DoDefaultAction(const BrowserAccessibility& node); | 183 void DoDefaultAction(const BrowserAccessibility& node); |
183 | 184 |
184 // Tell the renderer to scroll to make |node| visible. | 185 // Tell the renderer to scroll to make |node| visible. |
185 // In addition, if it's not possible to make the entire object visible, | 186 // In addition, if it's not possible to make the entire object visible, |
186 // scroll so that the |subfocus| rect is visible at least. The subfocus | 187 // scroll so that the |subfocus| rect is visible at least. The subfocus |
187 // rect is in local coordinates of the object itself. | 188 // rect is in local coordinates of the object itself. |
188 void ScrollToMakeVisible( | 189 void ScrollToMakeVisible( |
189 const BrowserAccessibility& node, gfx::Rect subfocus); | 190 const BrowserAccessibility& node, gfx::Rect subfocus); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 | 242 |
242 #if defined(OS_ANDROID) | 243 #if defined(OS_ANDROID) |
243 BrowserAccessibilityManagerAndroid* ToBrowserAccessibilityManagerAndroid(); | 244 BrowserAccessibilityManagerAndroid* ToBrowserAccessibilityManagerAndroid(); |
244 #endif | 245 #endif |
245 | 246 |
246 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_X11) | 247 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_X11) |
247 BrowserAccessibilityManagerAuraLinux* | 248 BrowserAccessibilityManagerAuraLinux* |
248 ToBrowserAccessibilityManagerAuraLinux(); | 249 ToBrowserAccessibilityManagerAuraLinux(); |
249 #endif | 250 #endif |
250 | 251 |
251 // Return the object that has focus, if it's a descendant of the | 252 // Return the object that has focus. |
252 // given root (inclusive). Does not make a new reference. | 253 virtual BrowserAccessibility* GetFocus(); |
253 virtual BrowserAccessibility* GetFocus(BrowserAccessibility* root); | |
254 | 254 |
255 // Return the descentant of the given root that has focus, or that object's | 255 // Given a focused node |focus|, returns a descendant of that node if it |
256 // active descendant if it has one. | 256 // has an active descendant, otherwise returns |focus|. |
257 BrowserAccessibility* GetActiveDescendantFocus(BrowserAccessibility* root); | 257 BrowserAccessibility* GetActiveDescendantFocus(BrowserAccessibility* focus); |
258 | 258 |
259 // Returns true if native focus is anywhere in this WebContents or not. | 259 // Returns true if native focus is anywhere in this WebContents or not. |
260 bool NativeViewHasFocus(); | 260 bool NativeViewHasFocus(); |
261 | 261 |
262 // True by default, but some platforms want to treat the root | 262 // True by default, but some platforms want to treat the root |
263 // scroll offsets separately. | 263 // scroll offsets separately. |
264 virtual bool UseRootScrollOffsetsWhenComputingBounds(); | 264 virtual bool UseRootScrollOffsetsWhenComputingBounds(); |
265 | 265 |
266 // Walk the tree. | 266 // Walk the tree. |
267 BrowserAccessibility* NextInTreeOrder(BrowserAccessibility* node) const; | 267 BrowserAccessibility* NextInTreeOrder(BrowserAccessibility* node) const; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 protected: | 333 protected: |
334 // The object that can perform actions on our behalf. | 334 // The object that can perform actions on our behalf. |
335 BrowserAccessibilityDelegate* delegate_; | 335 BrowserAccessibilityDelegate* delegate_; |
336 | 336 |
337 // Factory to create BrowserAccessibility objects (for dependency injection). | 337 // Factory to create BrowserAccessibility objects (for dependency injection). |
338 scoped_ptr<BrowserAccessibilityFactory> factory_; | 338 scoped_ptr<BrowserAccessibilityFactory> factory_; |
339 | 339 |
340 // The underlying tree of accessibility objects. | 340 // The underlying tree of accessibility objects. |
341 scoped_ptr<ui::AXSerializableTree> tree_; | 341 scoped_ptr<ui::AXSerializableTree> tree_; |
342 | 342 |
343 // The node that currently has focus. | |
344 ui::AXNode* focus_; | |
345 | |
346 // A mapping from a node id to its wrapper of type BrowserAccessibility. | 343 // A mapping from a node id to its wrapper of type BrowserAccessibility. |
347 base::hash_map<int32_t, BrowserAccessibility*> id_wrapper_map_; | 344 base::hash_map<int32_t, BrowserAccessibility*> id_wrapper_map_; |
348 | 345 |
349 // True if the user has initiated a navigation to another page. | 346 // True if the user has initiated a navigation to another page. |
350 bool user_is_navigating_away_; | 347 bool user_is_navigating_away_; |
351 | 348 |
352 // The on-screen keyboard state. | 349 // The on-screen keyboard state. |
353 OnScreenKeyboardState osk_state_; | 350 OnScreenKeyboardState osk_state_; |
354 | 351 |
355 BrowserAccessibilityFindInPageInfo find_in_page_info_; | 352 BrowserAccessibilityFindInPageInfo find_in_page_info_; |
356 | 353 |
357 // The global ID of this accessibility tree. | 354 // The global ID of this accessibility tree. |
358 AXTreeIDRegistry::AXTreeID ax_tree_id_; | 355 AXTreeIDRegistry::AXTreeID ax_tree_id_; |
359 | 356 |
360 // If this tree has a parent tree, this is the cached ID of the parent | 357 // If this tree has a parent tree, this is the cached ID of the parent |
361 // node within that parent tree. It's computed as needed and cached for | 358 // node within that parent tree. It's computed as needed and cached for |
362 // speed so that it can be accessed quickly if it hasn't changed. | 359 // speed so that it can be accessed quickly if it hasn't changed. |
363 int parent_node_id_from_parent_tree_; | 360 int parent_node_id_from_parent_tree_; |
364 | 361 |
365 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager); | 362 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager); |
366 }; | 363 }; |
367 | 364 |
368 } // namespace content | 365 } // namespace content |
369 | 366 |
370 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ | 367 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ |
OLD | NEW |