| 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> |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 // of the current call stack. | 66 // of the current call stack. |
| 67 class CONTENT_EXPORT BrowserAccessibilityDelegate { | 67 class CONTENT_EXPORT BrowserAccessibilityDelegate { |
| 68 public: | 68 public: |
| 69 virtual ~BrowserAccessibilityDelegate() {} | 69 virtual ~BrowserAccessibilityDelegate() {} |
| 70 | 70 |
| 71 virtual void AccessibilityPerformAction(const ui::AXActionData& data) = 0; | 71 virtual void AccessibilityPerformAction(const ui::AXActionData& data) = 0; |
| 72 virtual bool AccessibilityViewHasFocus() const = 0; | 72 virtual bool AccessibilityViewHasFocus() const = 0; |
| 73 virtual gfx::Rect AccessibilityGetViewBounds() const = 0; | 73 virtual gfx::Rect AccessibilityGetViewBounds() const = 0; |
| 74 virtual gfx::Point AccessibilityOriginInScreen( | 74 virtual gfx::Point AccessibilityOriginInScreen( |
| 75 const gfx::Rect& bounds) const = 0; | 75 const gfx::Rect& bounds) const = 0; |
| 76 virtual float AccessibilityGetDeviceScaleFactor() const = 0; |
| 76 virtual void AccessibilityFatalError() = 0; | 77 virtual void AccessibilityFatalError() = 0; |
| 77 virtual gfx::AcceleratedWidget AccessibilityGetAcceleratedWidget() = 0; | 78 virtual gfx::AcceleratedWidget AccessibilityGetAcceleratedWidget() = 0; |
| 78 virtual gfx::NativeViewAccessible AccessibilityGetNativeViewAccessible() = 0; | 79 virtual gfx::NativeViewAccessible AccessibilityGetNativeViewAccessible() = 0; |
| 79 }; | 80 }; |
| 80 | 81 |
| 81 class CONTENT_EXPORT BrowserAccessibilityFactory { | 82 class CONTENT_EXPORT BrowserAccessibilityFactory { |
| 82 public: | 83 public: |
| 83 virtual ~BrowserAccessibilityFactory() {} | 84 virtual ~BrowserAccessibilityFactory() {} |
| 84 | 85 |
| 85 // Create an instance of BrowserAccessibility and return a new | 86 // Create an instance of BrowserAccessibility and return a new |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 int end_offset); | 320 int end_offset); |
| 320 | 321 |
| 321 static gfx::Rect GetPageBoundsForRange( | 322 static gfx::Rect GetPageBoundsForRange( |
| 322 const BrowserAccessibility& start_object, | 323 const BrowserAccessibility& start_object, |
| 323 int start_offset, | 324 int start_offset, |
| 324 const BrowserAccessibility& end_object, | 325 const BrowserAccessibility& end_object, |
| 325 int end_offset); | 326 int end_offset); |
| 326 | 327 |
| 327 // Accessors. | 328 // Accessors. |
| 328 ui::AXTreeIDRegistry::AXTreeID ax_tree_id() const { return ax_tree_id_; } | 329 ui::AXTreeIDRegistry::AXTreeID ax_tree_id() const { return ax_tree_id_; } |
| 330 float device_scale_factor() const { return device_scale_factor_; } |
| 329 | 331 |
| 330 // AXTreeDelegate implementation. | 332 // AXTreeDelegate implementation. |
| 331 void OnNodeDataWillChange(ui::AXTree* tree, | 333 void OnNodeDataWillChange(ui::AXTree* tree, |
| 332 const ui::AXNodeData& old_node_data, | 334 const ui::AXNodeData& old_node_data, |
| 333 const ui::AXNodeData& new_node_data) override; | 335 const ui::AXNodeData& new_node_data) override; |
| 334 void OnTreeDataChanged(ui::AXTree* tree) override; | 336 void OnTreeDataChanged(ui::AXTree* tree) override; |
| 335 void OnNodeWillBeDeleted(ui::AXTree* tree, ui::AXNode* node) override; | 337 void OnNodeWillBeDeleted(ui::AXTree* tree, ui::AXNode* node) override; |
| 336 void OnSubtreeWillBeDeleted(ui::AXTree* tree, ui::AXNode* node) override; | 338 void OnSubtreeWillBeDeleted(ui::AXTree* tree, ui::AXNode* node) override; |
| 337 void OnNodeWillBeReparented(ui::AXTree* tree, ui::AXNode* node) override; | 339 void OnNodeWillBeReparented(ui::AXTree* tree, ui::AXNode* node) override; |
| 338 void OnSubtreeWillBeReparented(ui::AXTree* tree, ui::AXNode* node) override; | 340 void OnSubtreeWillBeReparented(ui::AXTree* tree, ui::AXNode* node) override; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 356 | 358 |
| 357 // Returns the BrowserAccessibilityDelegate from |GetRootManager|, above. | 359 // Returns the BrowserAccessibilityDelegate from |GetRootManager|, above. |
| 358 BrowserAccessibilityDelegate* GetDelegateFromRootManager(); | 360 BrowserAccessibilityDelegate* GetDelegateFromRootManager(); |
| 359 | 361 |
| 360 // Returns whether this is the top document. | 362 // Returns whether this is the top document. |
| 361 bool IsRootTree(); | 363 bool IsRootTree(); |
| 362 | 364 |
| 363 // Get a snapshot of the current tree as an AXTreeUpdate. | 365 // Get a snapshot of the current tree as an AXTreeUpdate. |
| 364 ui::AXTreeUpdate SnapshotAXTreeForTesting(); | 366 ui::AXTreeUpdate SnapshotAXTreeForTesting(); |
| 365 | 367 |
| 368 // Use a custom device scale factor for testing. |
| 369 void UseCustomDeviceScaleFactorForTesting(float device_scale_factor); |
| 370 |
| 366 // Given a point in screen coordinates, trigger an asynchronous hit test | 371 // Given a point in screen coordinates, trigger an asynchronous hit test |
| 367 // but return the best possible match instantly. | 372 // but return the best possible match instantly. |
| 368 // | 373 // |
| 369 // | 374 // |
| 370 BrowserAccessibility* CachingAsyncHitTest(const gfx::Point& screen_point); | 375 BrowserAccessibility* CachingAsyncHitTest(const gfx::Point& screen_point); |
| 371 | 376 |
| 372 // Called in response to a hover event, caches the result for the next | 377 // Called in response to a hover event, caches the result for the next |
| 373 // call to CachingAsyncHitTest(). | 378 // call to CachingAsyncHitTest(). |
| 374 void CacheHitTestResult(BrowserAccessibility* hit_test_result); | 379 void CacheHitTestResult(BrowserAccessibility* hit_test_result); |
| 375 | 380 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 bool connected_to_parent_tree_node_; | 465 bool connected_to_parent_tree_node_; |
| 461 | 466 |
| 462 // The global ID of this accessibility tree. | 467 // The global ID of this accessibility tree. |
| 463 ui::AXTreeIDRegistry::AXTreeID ax_tree_id_; | 468 ui::AXTreeIDRegistry::AXTreeID ax_tree_id_; |
| 464 | 469 |
| 465 // If this tree has a parent tree, this is the cached ID of the parent | 470 // 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 | 471 // 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. | 472 // speed so that it can be accessed quickly if it hasn't changed. |
| 468 int parent_node_id_from_parent_tree_; | 473 int parent_node_id_from_parent_tree_; |
| 469 | 474 |
| 475 // The device scale factor for the view associated with this frame, |
| 476 // cached each time there's any update to the accessibility tree. |
| 477 float device_scale_factor_; |
| 478 |
| 479 // For testing only: If true, the manually-set device scale factor will be |
| 480 // used and it won't be updated from the delegate. |
| 481 bool use_custom_device_scale_factor_for_testing_; |
| 482 |
| 470 private: | 483 private: |
| 471 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager); | 484 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager); |
| 472 }; | 485 }; |
| 473 | 486 |
| 474 } // namespace content | 487 } // namespace content |
| 475 | 488 |
| 476 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ | 489 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ |
| OLD | NEW |