| 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 <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/common/content_export.h" | 19 #include "content/common/content_export.h" |
| 19 #include "content/public/browser/ax_event_notification_details.h" | 20 #include "content/public/browser/ax_event_notification_details.h" |
| 20 #include "third_party/WebKit/public/web/WebAXEnums.h" | 21 #include "third_party/WebKit/public/web/WebAXEnums.h" |
| 21 #include "ui/accessibility/ax_node_data.h" | 22 #include "ui/accessibility/ax_node_data.h" |
| 22 #include "ui/accessibility/ax_serializable_tree.h" | 23 #include "ui/accessibility/ax_serializable_tree.h" |
| 23 #include "ui/accessibility/ax_tree_update.h" | 24 #include "ui/accessibility/ax_tree_update.h" |
| 24 #include "ui/gfx/native_widget_types.h" | 25 #include "ui/gfx/native_widget_types.h" |
| 25 | 26 |
| 26 struct AccessibilityHostMsg_LocationChangeParams; | 27 struct AccessibilityHostMsg_LocationChangeParams; |
| 27 | 28 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 static BrowserAccessibilityManager* FromID( | 136 static BrowserAccessibilityManager* FromID( |
| 136 AXTreeIDRegistry::AXTreeID ax_tree_id); | 137 AXTreeIDRegistry::AXTreeID ax_tree_id); |
| 137 | 138 |
| 138 ~BrowserAccessibilityManager() override; | 139 ~BrowserAccessibilityManager() override; |
| 139 | 140 |
| 140 void Initialize(const ui::AXTreeUpdate& initial_tree); | 141 void Initialize(const ui::AXTreeUpdate& initial_tree); |
| 141 | 142 |
| 142 static ui::AXTreeUpdate GetEmptyDocument(); | 143 static ui::AXTreeUpdate GetEmptyDocument(); |
| 143 | 144 |
| 144 virtual void NotifyAccessibilityEvent( | 145 virtual void NotifyAccessibilityEvent( |
| 145 ui::AXEvent event_type, BrowserAccessibility* node) { } | 146 BrowserAccessibilityEvent::Source source, |
| 147 ui::AXEvent event_type, |
| 148 BrowserAccessibility* node); |
| 146 | 149 |
| 147 // Checks whether focus has changed since the last time it was checked, | 150 // Checks whether focus has changed since the last time it was checked, |
| 148 // taking into account whether the window has focus and which frame within | 151 // taking into account whether the window has focus and which frame within |
| 149 // the frame tree has focus. If focus has changed, calls FireFocusEvent. | 152 // the frame tree has focus. If focus has changed, calls FireFocusEvent. |
| 150 void FireFocusEventsIfNeeded(); | 153 void FireFocusEventsIfNeeded(BrowserAccessibilityEvent::Source source); |
| 151 | 154 |
| 152 // Return whether or not we are currently able to fire events. | 155 // Return whether or not we are currently able to fire events. |
| 153 virtual bool CanFireEvents(); | 156 virtual bool CanFireEvents(); |
| 154 | 157 |
| 155 // Fire a focus event. Virtual so that some platforms can customize it, | 158 // Fire a focus event. Virtual so that some platforms can customize it, |
| 156 // like firing a focus event on the root first, on Windows. | 159 // like firing a focus event on the root first, on Windows. |
| 157 virtual void FireFocusEvent(BrowserAccessibility* node); | 160 virtual void FireFocusEvent(BrowserAccessibilityEvent::Source source, |
| 161 BrowserAccessibility* node); |
| 158 | 162 |
| 159 // Return a pointer to the root of the tree, does not make a new reference. | 163 // Return a pointer to the root of the tree, does not make a new reference. |
| 160 BrowserAccessibility* GetRoot(); | 164 BrowserAccessibility* GetRoot(); |
| 161 | 165 |
| 162 // Returns a pointer to the BrowserAccessibility object for a given AXNode. | 166 // Returns a pointer to the BrowserAccessibility object for a given AXNode. |
| 163 BrowserAccessibility* GetFromAXNode(const ui::AXNode* node) const; | 167 BrowserAccessibility* GetFromAXNode(const ui::AXNode* node) const; |
| 164 | 168 |
| 165 // Return a pointer to the object corresponding to the given id, | 169 // Return a pointer to the object corresponding to the given id, |
| 166 // does not make a new reference. | 170 // does not make a new reference. |
| 167 BrowserAccessibility* GetFromID(int32_t id) const; | 171 BrowserAccessibility* GetFromID(int32_t id) const; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 179 // Called to notify the accessibility manager that its associated native | 183 // Called to notify the accessibility manager that its associated native |
| 180 // view lost focus. | 184 // view lost focus. |
| 181 virtual void OnWindowBlurred(); | 185 virtual void OnWindowBlurred(); |
| 182 | 186 |
| 183 // Notify the accessibility manager about page navigation. | 187 // Notify the accessibility manager about page navigation. |
| 184 void UserIsNavigatingAway(); | 188 void UserIsNavigatingAway(); |
| 185 virtual void UserIsReloading(); | 189 virtual void UserIsReloading(); |
| 186 void NavigationSucceeded(); | 190 void NavigationSucceeded(); |
| 187 void NavigationFailed(); | 191 void NavigationFailed(); |
| 188 | 192 |
| 189 // Called to notify the accessibility manager that a mouse down event | |
| 190 // occurred in the tab. | |
| 191 void GotMouseDown(); | |
| 192 | |
| 193 // Send a message to the renderer to set focus to this node. | 193 // Send a message to the renderer to set focus to this node. |
| 194 void SetFocus(const BrowserAccessibility& node); | 194 void SetFocus(const BrowserAccessibility& node); |
| 195 | 195 |
| 196 // Pretend that the given node has focus, for testing only. Doesn't | 196 // Pretend that the given node has focus, for testing only. Doesn't |
| 197 // communicate with the renderer and doesn't fire any events. | 197 // communicate with the renderer and doesn't fire any events. |
| 198 void SetFocusLocallyForTesting(BrowserAccessibility* node); | 198 void SetFocusLocallyForTesting(BrowserAccessibility* node); |
| 199 | 199 |
| 200 // For testing only, register a function to be called when focus changes | 200 // For testing only, register a function to be called when focus changes |
| 201 // in any BrowserAccessibilityManager. | 201 // in any BrowserAccessibilityManager. |
| 202 static void SetFocusChangeCallbackForTesting(const base::Closure& callback); | 202 static void SetFocusChangeCallbackForTesting(const base::Closure& callback); |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 // node within that parent tree. It's computed as needed and cached for | 438 // node within that parent tree. It's computed as needed and cached for |
| 439 // speed so that it can be accessed quickly if it hasn't changed. | 439 // speed so that it can be accessed quickly if it hasn't changed. |
| 440 int parent_node_id_from_parent_tree_; | 440 int parent_node_id_from_parent_tree_; |
| 441 | 441 |
| 442 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager); | 442 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager); |
| 443 }; | 443 }; |
| 444 | 444 |
| 445 } // namespace content | 445 } // namespace content |
| 446 | 446 |
| 447 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ | 447 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ |
| OLD | NEW |