| 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_platform_position.h" | 17 #include "content/browser/accessibility/ax_platform_position.h" |
| 18 #include "content/browser/accessibility/ax_tree_id_registry.h" | |
| 19 #include "content/browser/accessibility/browser_accessibility_event.h" | 18 #include "content/browser/accessibility/browser_accessibility_event.h" |
| 20 #include "content/common/content_export.h" | 19 #include "content/common/content_export.h" |
| 21 #include "content/public/browser/ax_event_notification_details.h" | 20 #include "content/public/browser/ax_event_notification_details.h" |
| 22 #include "third_party/WebKit/public/web/WebAXEnums.h" | 21 #include "third_party/WebKit/public/web/WebAXEnums.h" |
| 23 #include "ui/accessibility/ax_action_data.h" | 22 #include "ui/accessibility/ax_action_data.h" |
| 24 #include "ui/accessibility/ax_node_data.h" | 23 #include "ui/accessibility/ax_node_data.h" |
| 25 #include "ui/accessibility/ax_range.h" | 24 #include "ui/accessibility/ax_range.h" |
| 26 #include "ui/accessibility/ax_serializable_tree.h" | 25 #include "ui/accessibility/ax_serializable_tree.h" |
| 26 #include "ui/accessibility/ax_tree_id_registry.h" |
| 27 #include "ui/accessibility/ax_tree_update.h" | 27 #include "ui/accessibility/ax_tree_update.h" |
| 28 #include "ui/gfx/native_widget_types.h" | 28 #include "ui/gfx/native_widget_types.h" |
| 29 | 29 |
| 30 struct AccessibilityHostMsg_LocationChangeParams; | 30 struct AccessibilityHostMsg_LocationChangeParams; |
| 31 | 31 |
| 32 namespace content { | 32 namespace content { |
| 33 class BrowserAccessibility; | 33 class BrowserAccessibility; |
| 34 class BrowserAccessibilityManager; | 34 class BrowserAccessibilityManager; |
| 35 #if defined(OS_ANDROID) | 35 #if defined(OS_ANDROID) |
| 36 class BrowserAccessibilityManagerAndroid; | 36 class BrowserAccessibilityManagerAndroid; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 class CONTENT_EXPORT BrowserAccessibilityManager : public ui::AXTreeDelegate { | 111 class CONTENT_EXPORT BrowserAccessibilityManager : public ui::AXTreeDelegate { |
| 112 public: | 112 public: |
| 113 // Creates the platform-specific BrowserAccessibilityManager, but | 113 // Creates the platform-specific BrowserAccessibilityManager, but |
| 114 // with no parent window pointer. Only useful for unit tests. | 114 // with no parent window pointer. Only useful for unit tests. |
| 115 static BrowserAccessibilityManager* Create( | 115 static BrowserAccessibilityManager* Create( |
| 116 const ui::AXTreeUpdate& initial_tree, | 116 const ui::AXTreeUpdate& initial_tree, |
| 117 BrowserAccessibilityDelegate* delegate, | 117 BrowserAccessibilityDelegate* delegate, |
| 118 BrowserAccessibilityFactory* factory = new BrowserAccessibilityFactory()); | 118 BrowserAccessibilityFactory* factory = new BrowserAccessibilityFactory()); |
| 119 | 119 |
| 120 static BrowserAccessibilityManager* FromID( | 120 static BrowserAccessibilityManager* FromID( |
| 121 AXTreeIDRegistry::AXTreeID ax_tree_id); | 121 ui::AXTreeIDRegistry::AXTreeID ax_tree_id); |
| 122 | 122 |
| 123 ~BrowserAccessibilityManager() override; | 123 ~BrowserAccessibilityManager() override; |
| 124 | 124 |
| 125 void Initialize(const ui::AXTreeUpdate& initial_tree); | 125 void Initialize(const ui::AXTreeUpdate& initial_tree); |
| 126 | 126 |
| 127 static ui::AXTreeUpdate GetEmptyDocument(); | 127 static ui::AXTreeUpdate GetEmptyDocument(); |
| 128 | 128 |
| 129 virtual void NotifyAccessibilityEvent( | 129 virtual void NotifyAccessibilityEvent( |
| 130 BrowserAccessibilityEvent::Source source, | 130 BrowserAccessibilityEvent::Source source, |
| 131 ui::AXEvent event_type, | 131 ui::AXEvent event_type, |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 const BrowserAccessibility& end_object, | 318 const BrowserAccessibility& end_object, |
| 319 int end_offset); | 319 int end_offset); |
| 320 | 320 |
| 321 static gfx::Rect GetPageBoundsForRange( | 321 static gfx::Rect GetPageBoundsForRange( |
| 322 const BrowserAccessibility& start_object, | 322 const BrowserAccessibility& start_object, |
| 323 int start_offset, | 323 int start_offset, |
| 324 const BrowserAccessibility& end_object, | 324 const BrowserAccessibility& end_object, |
| 325 int end_offset); | 325 int end_offset); |
| 326 | 326 |
| 327 // Accessors. | 327 // Accessors. |
| 328 AXTreeIDRegistry::AXTreeID ax_tree_id() const { return ax_tree_id_; } | 328 ui::AXTreeIDRegistry::AXTreeID ax_tree_id() const { return ax_tree_id_; } |
| 329 | 329 |
| 330 // AXTreeDelegate implementation. | 330 // AXTreeDelegate implementation. |
| 331 void OnNodeDataWillChange(ui::AXTree* tree, | 331 void OnNodeDataWillChange(ui::AXTree* tree, |
| 332 const ui::AXNodeData& old_node_data, | 332 const ui::AXNodeData& old_node_data, |
| 333 const ui::AXNodeData& new_node_data) override; | 333 const ui::AXNodeData& new_node_data) override; |
| 334 void OnTreeDataChanged(ui::AXTree* tree) override; | 334 void OnTreeDataChanged(ui::AXTree* tree) override; |
| 335 void OnNodeWillBeDeleted(ui::AXTree* tree, ui::AXNode* node) override; | 335 void OnNodeWillBeDeleted(ui::AXTree* tree, ui::AXNode* node) override; |
| 336 void OnSubtreeWillBeDeleted(ui::AXTree* tree, ui::AXNode* node) override; | 336 void OnSubtreeWillBeDeleted(ui::AXTree* tree, ui::AXNode* node) override; |
| 337 void OnNodeWillBeReparented(ui::AXTree* tree, ui::AXNode* node) override; | 337 void OnNodeWillBeReparented(ui::AXTree* tree, ui::AXNode* node) override; |
| 338 void OnSubtreeWillBeReparented(ui::AXTree* tree, ui::AXNode* node) override; | 338 void OnSubtreeWillBeReparented(ui::AXTree* tree, ui::AXNode* node) override; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 int last_hover_ax_tree_id_; | 453 int last_hover_ax_tree_id_; |
| 454 int last_hover_node_id_; | 454 int last_hover_node_id_; |
| 455 gfx::Rect last_hover_bounds_; | 455 gfx::Rect last_hover_bounds_; |
| 456 | 456 |
| 457 // True if the root's parent is in another accessibility tree and that | 457 // True if the root's parent is in another accessibility tree and that |
| 458 // parent's child is the root. Ensures that the parent node is notified | 458 // parent's child is the root. Ensures that the parent node is notified |
| 459 // once when this subtree is first connected. | 459 // once when this subtree is first connected. |
| 460 bool connected_to_parent_tree_node_; | 460 bool connected_to_parent_tree_node_; |
| 461 | 461 |
| 462 // The global ID of this accessibility tree. | 462 // The global ID of this accessibility tree. |
| 463 AXTreeIDRegistry::AXTreeID ax_tree_id_; | 463 ui::AXTreeIDRegistry::AXTreeID ax_tree_id_; |
| 464 | 464 |
| 465 // If this tree has a parent tree, this is the cached ID of the parent | 465 // If this tree has a parent tree, this is the cached ID of the parent |
| 466 // node within that parent tree. It's computed as needed and cached for | 466 // node within that parent tree. It's computed as needed and cached for |
| 467 // speed so that it can be accessed quickly if it hasn't changed. | 467 // speed so that it can be accessed quickly if it hasn't changed. |
| 468 int parent_node_id_from_parent_tree_; | 468 int parent_node_id_from_parent_tree_; |
| 469 | 469 |
| 470 private: |
| 470 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager); | 471 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager); |
| 471 }; | 472 }; |
| 472 | 473 |
| 473 } // namespace content | 474 } // namespace content |
| 474 | 475 |
| 475 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ | 476 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ |
| OLD | NEW |