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 static BrowserAccessibility* NextInTreeOrder( | 267 static BrowserAccessibility* NextInTreeOrder( |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 protected: | 358 protected: |
359 // The object that can perform actions on our behalf. | 359 // The object that can perform actions on our behalf. |
360 BrowserAccessibilityDelegate* delegate_; | 360 BrowserAccessibilityDelegate* delegate_; |
361 | 361 |
362 // Factory to create BrowserAccessibility objects (for dependency injection). | 362 // Factory to create BrowserAccessibility objects (for dependency injection). |
363 scoped_ptr<BrowserAccessibilityFactory> factory_; | 363 scoped_ptr<BrowserAccessibilityFactory> factory_; |
364 | 364 |
365 // The underlying tree of accessibility objects. | 365 // The underlying tree of accessibility objects. |
366 scoped_ptr<ui::AXSerializableTree> tree_; | 366 scoped_ptr<ui::AXSerializableTree> tree_; |
367 | 367 |
368 // The node that currently has focus. | |
369 ui::AXNode* focus_; | |
370 | |
371 // A mapping from a node id to its wrapper of type BrowserAccessibility. | 368 // A mapping from a node id to its wrapper of type BrowserAccessibility. |
372 base::hash_map<int32_t, BrowserAccessibility*> id_wrapper_map_; | 369 base::hash_map<int32_t, BrowserAccessibility*> id_wrapper_map_; |
373 | 370 |
374 // True if the user has initiated a navigation to another page. | 371 // True if the user has initiated a navigation to another page. |
375 bool user_is_navigating_away_; | 372 bool user_is_navigating_away_; |
376 | 373 |
377 // The on-screen keyboard state. | 374 // The on-screen keyboard state. |
378 OnScreenKeyboardState osk_state_; | 375 OnScreenKeyboardState osk_state_; |
379 | 376 |
380 BrowserAccessibilityFindInPageInfo find_in_page_info_; | 377 BrowserAccessibilityFindInPageInfo find_in_page_info_; |
381 | 378 |
382 // The global ID of this accessibility tree. | 379 // The global ID of this accessibility tree. |
383 AXTreeIDRegistry::AXTreeID ax_tree_id_; | 380 AXTreeIDRegistry::AXTreeID ax_tree_id_; |
384 | 381 |
385 // If this tree has a parent tree, this is the cached ID of the parent | 382 // If this tree has a parent tree, this is the cached ID of the parent |
386 // node within that parent tree. It's computed as needed and cached for | 383 // node within that parent tree. It's computed as needed and cached for |
387 // speed so that it can be accessed quickly if it hasn't changed. | 384 // speed so that it can be accessed quickly if it hasn't changed. |
388 int parent_node_id_from_parent_tree_; | 385 int parent_node_id_from_parent_tree_; |
389 | 386 |
390 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager); | 387 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager); |
391 }; | 388 }; |
392 | 389 |
393 } // namespace content | 390 } // namespace content |
394 | 391 |
395 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ | 392 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ |
OLD | NEW |