| 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
| 14 #include "third_party/WebKit/public/web/WebAXEnums.h" | 14 #include "third_party/WebKit/public/web/WebAXEnums.h" |
| 15 #include "ui/accessibility/ax_node_data.h" | 15 #include "ui/accessibility/ax_node_data.h" |
| 16 #include "ui/accessibility/ax_serializable_tree.h" |
| 16 #include "ui/accessibility/ax_tree.h" | 17 #include "ui/accessibility/ax_tree.h" |
| 17 #include "ui/accessibility/ax_tree_update.h" | 18 #include "ui/accessibility/ax_tree_update.h" |
| 18 #include "ui/gfx/native_widget_types.h" | 19 #include "ui/gfx/native_widget_types.h" |
| 19 | 20 |
| 20 struct AccessibilityHostMsg_EventParams; | 21 struct AccessibilityHostMsg_EventParams; |
| 21 struct AccessibilityHostMsg_LocationChangeParams; | 22 struct AccessibilityHostMsg_LocationChangeParams; |
| 22 | 23 |
| 23 namespace content { | 24 namespace content { |
| 24 class BrowserAccessibility; | 25 class BrowserAccessibility; |
| 25 #if defined(OS_ANDROID) | 26 #if defined(OS_ANDROID) |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 // AXTreeDelegate implementation. | 173 // AXTreeDelegate implementation. |
| 173 virtual void OnNodeWillBeDeleted(ui::AXNode* node) OVERRIDE; | 174 virtual void OnNodeWillBeDeleted(ui::AXNode* node) OVERRIDE; |
| 174 virtual void OnNodeCreated(ui::AXNode* node) OVERRIDE; | 175 virtual void OnNodeCreated(ui::AXNode* node) OVERRIDE; |
| 175 virtual void OnNodeChanged(ui::AXNode* node) OVERRIDE; | 176 virtual void OnNodeChanged(ui::AXNode* node) OVERRIDE; |
| 176 virtual void OnNodeCreationFinished(ui::AXNode* node) OVERRIDE; | 177 virtual void OnNodeCreationFinished(ui::AXNode* node) OVERRIDE; |
| 177 virtual void OnNodeChangeFinished(ui::AXNode* node) OVERRIDE; | 178 virtual void OnNodeChangeFinished(ui::AXNode* node) OVERRIDE; |
| 178 virtual void OnRootChanged(ui::AXNode* new_root) OVERRIDE {} | 179 virtual void OnRootChanged(ui::AXNode* new_root) OVERRIDE {} |
| 179 | 180 |
| 180 BrowserAccessibilityDelegate* delegate() const { return delegate_; } | 181 BrowserAccessibilityDelegate* delegate() const { return delegate_; } |
| 181 | 182 |
| 183 // Get a snapshot of the current tree as an AXTreeUpdate. |
| 184 ui::AXTreeUpdate SnapshotAXTreeForTesting(); |
| 185 |
| 182 // Frame tree support. | 186 // Frame tree support. |
| 183 void SetParentFrameIds(int parent_frame_frame_id, int parent_frame_node_id); | 187 void SetParentFrameIds(int parent_frame_frame_id, int parent_frame_node_id); |
| 188 void SetChildFrameId(int node_id, int child_frame_id); |
| 184 BrowserAccessibility* GetCrossFrameParent(); | 189 BrowserAccessibility* GetCrossFrameParent(); |
| 185 | 190 |
| 186 protected: | 191 protected: |
| 187 BrowserAccessibilityManager( | 192 BrowserAccessibilityManager( |
| 188 BrowserAccessibilityDelegate* delegate, | 193 BrowserAccessibilityDelegate* delegate, |
| 189 BrowserAccessibilityFactory* factory); | 194 BrowserAccessibilityFactory* factory); |
| 190 | 195 |
| 191 BrowserAccessibilityManager( | 196 BrowserAccessibilityManager( |
| 192 const ui::AXTreeUpdate& initial_tree, | 197 const ui::AXTreeUpdate& initial_tree, |
| 193 BrowserAccessibilityDelegate* delegate, | 198 BrowserAccessibilityDelegate* delegate, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 209 // touch event was within the bounds of the currently focused object. | 214 // touch event was within the bounds of the currently focused object. |
| 210 // Otherwise we'll just wait to see if focus changes. | 215 // Otherwise we'll just wait to see if focus changes. |
| 211 OSK_ALLOWED_WITHIN_FOCUSED_OBJECT, | 216 OSK_ALLOWED_WITHIN_FOCUSED_OBJECT, |
| 212 | 217 |
| 213 // Focus has changed within a tab that's already visible. Allow the | 218 // Focus has changed within a tab that's already visible. Allow the |
| 214 // on-screen keyboard to show anytime that a touch event leads to an | 219 // on-screen keyboard to show anytime that a touch event leads to an |
| 215 // editable text control getting focus. | 220 // editable text control getting focus. |
| 216 OSK_ALLOWED | 221 OSK_ALLOWED |
| 217 }; | 222 }; |
| 218 | 223 |
| 219 // Update a set of nodes using data received from the renderer | |
| 220 // process. | |
| 221 bool UpdateNodes(const std::vector<ui::AXNodeData>& nodes); | |
| 222 | |
| 223 // Update one node from the tree using data received from the renderer | |
| 224 // process. Returns true on success, false on fatal error. | |
| 225 bool UpdateNode(const ui::AXNodeData& src); | |
| 226 | |
| 227 void SetRoot(BrowserAccessibility* root); | |
| 228 | |
| 229 BrowserAccessibility* CreateNode( | |
| 230 BrowserAccessibility* parent, | |
| 231 int32 id, | |
| 232 int32 index_in_parent); | |
| 233 | |
| 234 protected: | 224 protected: |
| 235 // The object that can perform actions on our behalf. | 225 // The object that can perform actions on our behalf. |
| 236 BrowserAccessibilityDelegate* delegate_; | 226 BrowserAccessibilityDelegate* delegate_; |
| 237 | 227 |
| 238 // Factory to create BrowserAccessibility objects (for dependency injection). | 228 // Factory to create BrowserAccessibility objects (for dependency injection). |
| 239 scoped_ptr<BrowserAccessibilityFactory> factory_; | 229 scoped_ptr<BrowserAccessibilityFactory> factory_; |
| 240 | 230 |
| 241 // The underlying tree of accessibility objects. | 231 // The underlying tree of accessibility objects. |
| 242 scoped_ptr<ui::AXTree> tree_; | 232 scoped_ptr<ui::AXSerializableTree> tree_; |
| 243 | 233 |
| 244 // The node that currently has focus. | 234 // The node that currently has focus. |
| 245 ui::AXNode* focus_; | 235 ui::AXNode* focus_; |
| 246 | 236 |
| 247 // A mapping from a node id to its wrapper of type BrowserAccessibility. | 237 // A mapping from a node id to its wrapper of type BrowserAccessibility. |
| 248 base::hash_map<int32, BrowserAccessibility*> id_wrapper_map_; | 238 base::hash_map<int32, BrowserAccessibility*> id_wrapper_map_; |
| 249 | 239 |
| 250 // The id of the parent frame and the hosting node within the parent frame. | 240 // The id of the parent frame and the hosting node within the parent frame. |
| 251 // The parent frame id can be mapped to another BrowserAccessibilityManager | 241 // The parent frame id can be mapped to another BrowserAccessibilityManager |
| 252 // using FrameTreeAccessibility. | 242 // using FrameTreeAccessibility. |
| 253 int32 parent_frame_frame_id_; | 243 int32 parent_frame_frame_id_; |
| 254 int32 parent_frame_node_id_; | 244 int32 parent_frame_node_id_; |
| 255 | 245 |
| 256 // The on-screen keyboard state. | 246 // The on-screen keyboard state. |
| 257 OnScreenKeyboardState osk_state_; | 247 OnScreenKeyboardState osk_state_; |
| 258 | 248 |
| 259 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager); | 249 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager); |
| 260 }; | 250 }; |
| 261 | 251 |
| 262 } // namespace content | 252 } // namespace content |
| 263 | 253 |
| 264 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ | 254 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ |
| OLD | NEW |