Chromium Code Reviews| 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 // Send a message to the renderer to set focus to this node. | 175 // Update the focused node to |node|, which may be null. |
| 176 void SetFocus(const BrowserAccessibility& node); | 176 // If |notify| is true, send a message to the renderer to set focus |
| 177 | 177 // to this node. |
| 178 // Pretend that the given node has focus, for testing only. Doesn't | 178 void SetFocus(ui::AXNode* node, bool notify); |
|
Mark Mentovai
2016/02/19 17:16:16
Dominic should comment on this.
| |
| 179 // communicate with the renderer and doesn't fire any events. | 179 void SetFocus(BrowserAccessibility* node, bool notify); |
| 180 void SetFocusLocallyForTesting(BrowserAccessibility* node); | |
| 181 | 180 |
| 182 // Tell the renderer to do the default action for this node. | 181 // Tell the renderer to do the default action for this node. |
| 183 void DoDefaultAction(const BrowserAccessibility& node); | 182 void DoDefaultAction(const BrowserAccessibility& node); |
| 184 | 183 |
| 185 // Tell the renderer to scroll to make |node| visible. | 184 // Tell the renderer to scroll to make |node| visible. |
| 186 // In addition, if it's not possible to make the entire object visible, | 185 // In addition, if it's not possible to make the entire object visible, |
| 187 // scroll so that the |subfocus| rect is visible at least. The subfocus | 186 // scroll so that the |subfocus| rect is visible at least. The subfocus |
| 188 // rect is in local coordinates of the object itself. | 187 // rect is in local coordinates of the object itself. |
| 189 void ScrollToMakeVisible( | 188 void ScrollToMakeVisible( |
| 190 const BrowserAccessibility& node, gfx::Rect subfocus); | 189 const BrowserAccessibility& node, gfx::Rect subfocus); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 242 | 241 |
| 243 #if defined(OS_ANDROID) | 242 #if defined(OS_ANDROID) |
| 244 BrowserAccessibilityManagerAndroid* ToBrowserAccessibilityManagerAndroid(); | 243 BrowserAccessibilityManagerAndroid* ToBrowserAccessibilityManagerAndroid(); |
| 245 #endif | 244 #endif |
| 246 | 245 |
| 247 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_X11) | 246 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_X11) |
| 248 BrowserAccessibilityManagerAuraLinux* | 247 BrowserAccessibilityManagerAuraLinux* |
| 249 ToBrowserAccessibilityManagerAuraLinux(); | 248 ToBrowserAccessibilityManagerAuraLinux(); |
| 250 #endif | 249 #endif |
| 251 | 250 |
| 252 // Return the object that has focus. | 251 // Return the object that has focus, if it's a descendant of the |
| 253 virtual BrowserAccessibility* GetFocus(); | 252 // given root (inclusive). Does not make a new reference. |
| 253 virtual BrowserAccessibility* GetFocus(BrowserAccessibility* root); | |
| 254 | 254 |
| 255 // Given a focused node |focus|, returns a descendant of that node if it | 255 // Return the descentant of the given root that has focus, or that object's |
| 256 // has an active descendant, otherwise returns |focus|. | 256 // active descendant if it has one. |
| 257 BrowserAccessibility* GetActiveDescendantFocus(BrowserAccessibility* focus); | 257 BrowserAccessibility* GetActiveDescendantFocus(BrowserAccessibility* root); |
| 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_; | |
|
dmazzoni
2016/02/19 17:29:24
This is definitely wrong. I got rid of this in my
| |
| 370 | |
| 368 // A mapping from a node id to its wrapper of type BrowserAccessibility. | 371 // A mapping from a node id to its wrapper of type BrowserAccessibility. |
| 369 base::hash_map<int32_t, BrowserAccessibility*> id_wrapper_map_; | 372 base::hash_map<int32_t, BrowserAccessibility*> id_wrapper_map_; |
| 370 | 373 |
| 371 // True if the user has initiated a navigation to another page. | 374 // True if the user has initiated a navigation to another page. |
| 372 bool user_is_navigating_away_; | 375 bool user_is_navigating_away_; |
| 373 | 376 |
| 374 // The on-screen keyboard state. | 377 // The on-screen keyboard state. |
| 375 OnScreenKeyboardState osk_state_; | 378 OnScreenKeyboardState osk_state_; |
| 376 | 379 |
| 377 BrowserAccessibilityFindInPageInfo find_in_page_info_; | 380 BrowserAccessibilityFindInPageInfo find_in_page_info_; |
| 378 | 381 |
| 379 // The global ID of this accessibility tree. | 382 // The global ID of this accessibility tree. |
| 380 AXTreeIDRegistry::AXTreeID ax_tree_id_; | 383 AXTreeIDRegistry::AXTreeID ax_tree_id_; |
| 381 | 384 |
| 382 // If this tree has a parent tree, this is the cached ID of the parent | 385 // If this tree has a parent tree, this is the cached ID of the parent |
| 383 // node within that parent tree. It's computed as needed and cached for | 386 // node within that parent tree. It's computed as needed and cached for |
| 384 // speed so that it can be accessed quickly if it hasn't changed. | 387 // speed so that it can be accessed quickly if it hasn't changed. |
| 385 int parent_node_id_from_parent_tree_; | 388 int parent_node_id_from_parent_tree_; |
| 386 | 389 |
| 387 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager); | 390 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager); |
| 388 }; | 391 }; |
| 389 | 392 |
| 390 } // namespace content | 393 } // namespace content |
| 391 | 394 |
| 392 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ | 395 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ |
| OLD | NEW |