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_H_ | 5 #ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ |
| 6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ | 6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 // | 68 // |
| 69 //////////////////////////////////////////////////////////////////////////////// | 69 //////////////////////////////////////////////////////////////////////////////// |
| 70 class CONTENT_EXPORT BrowserAccessibility : public ui::AXPlatformNodeDelegate { | 70 class CONTENT_EXPORT BrowserAccessibility : public ui::AXPlatformNodeDelegate { |
| 71 public: | 71 public: |
| 72 // Creates a platform specific BrowserAccessibility. Ownership passes to the | 72 // Creates a platform specific BrowserAccessibility. Ownership passes to the |
| 73 // caller. | 73 // caller. |
| 74 static BrowserAccessibility* Create(); | 74 static BrowserAccessibility* Create(); |
| 75 | 75 |
| 76 virtual ~BrowserAccessibility(); | 76 virtual ~BrowserAccessibility(); |
| 77 | 77 |
| 78 static BrowserAccessibility* GetFromUniqueID(int32_t unique_id); | 78 static BrowserAccessibility* GetFromUniqueId(int32_t unique_id); |
| 79 | 79 |
| 80 // Called only once, immediately after construction. The constructor doesn't | 80 // Called only once, immediately after construction. The constructor doesn't |
| 81 // take any arguments because in the Windows subclass we use a special | 81 // take any arguments because in the Windows subclass we use a special |
| 82 // function to construct a COM object. | 82 // function to construct a COM object. |
| 83 virtual void Init(BrowserAccessibilityManager* manager, ui::AXNode* node); | 83 virtual void Init(BrowserAccessibilityManager* manager, ui::AXNode* node); |
| 84 | 84 |
| 85 // Called after the object is first initialized and again every time | 85 // Called after the object is first initialized and again every time |
| 86 // its data changes. | 86 // its data changes. |
| 87 virtual void OnDataChanged() {} | 87 virtual void OnDataChanged() {} |
| 88 | 88 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 193 // has had Destroy() called but its reference count is not yet zero, | 193 // has had Destroy() called but its reference count is not yet zero, |
| 194 // instance_active() returns false and queries on this object return failure. | 194 // instance_active() returns false and queries on this object return failure. |
| 195 virtual void Destroy(); | 195 virtual void Destroy(); |
| 196 | 196 |
| 197 // Subclasses should override this to support platform reference counting. | 197 // Subclasses should override this to support platform reference counting. |
| 198 virtual void NativeAddReference() { } | 198 virtual void NativeAddReference() { } |
| 199 | 199 |
| 200 // Subclasses should override this to support platform reference counting. | 200 // Subclasses should override this to support platform reference counting. |
| 201 virtual void NativeReleaseReference(); | 201 virtual void NativeReleaseReference(); |
| 202 | 202 |
| 203 virtual int32_t unique_id() const; | |
|
dmazzoni
2017/07/17 08:38:20
Since this is virtual it needs to get GetUniqueId(
| |
| 204 | |
| 203 // | 205 // |
| 204 // Accessors | 206 // Accessors |
| 205 // | 207 // |
| 206 | 208 |
| 207 BrowserAccessibilityManager* manager() const { return manager_; } | 209 BrowserAccessibilityManager* manager() const { return manager_; } |
| 208 bool instance_active() const { return node_ && manager_; } | 210 bool instance_active() const { return node_ && manager_; } |
| 209 ui::AXNode* node() const { return node_; } | 211 ui::AXNode* node() const { return node_; } |
| 210 int32_t unique_id() const { return unique_id_; } | |
| 211 | 212 |
| 212 // These access the internal accessibility tree, which doesn't necessarily | 213 // These access the internal accessibility tree, which doesn't necessarily |
| 213 // reflect the accessibility tree that should be exposed on each platform. | 214 // reflect the accessibility tree that should be exposed on each platform. |
| 214 // Use PlatformChildCount and PlatformGetChild to implement platform | 215 // Use PlatformChildCount and PlatformGetChild to implement platform |
| 215 // accessibility APIs. | 216 // accessibility APIs. |
| 216 uint32_t InternalChildCount() const; | 217 uint32_t InternalChildCount() const; |
| 217 BrowserAccessibility* InternalGetChild(uint32_t child_index) const; | 218 BrowserAccessibility* InternalGetChild(uint32_t child_index) const; |
| 218 BrowserAccessibility* InternalGetParent() const; | 219 BrowserAccessibility* InternalGetParent() const; |
| 219 | 220 |
| 220 BrowserAccessibility* PlatformGetParent() const; | 221 BrowserAccessibility* PlatformGetParent() const; |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 351 using AXPlatformRange = ui::AXRange<AXPlatformPositionInstance::element_type>; | 352 using AXPlatformRange = ui::AXRange<AXPlatformPositionInstance::element_type>; |
| 352 | 353 |
| 353 BrowserAccessibility(); | 354 BrowserAccessibility(); |
| 354 | 355 |
| 355 // The manager of this tree of accessibility objects. | 356 // The manager of this tree of accessibility objects. |
| 356 BrowserAccessibilityManager* manager_; | 357 BrowserAccessibilityManager* manager_; |
| 357 | 358 |
| 358 // The underlying node. | 359 // The underlying node. |
| 359 ui::AXNode* node_; | 360 ui::AXNode* node_; |
| 360 | 361 |
| 362 private: | |
| 361 // A unique ID, since node IDs are frame-local. | 363 // A unique ID, since node IDs are frame-local. |
| 362 int32_t unique_id_; | 364 int32_t unique_id_; |
| 363 | 365 |
| 364 private: | |
| 365 // |GetInnerText| recursively includes all the text from descendants such as | 366 // |GetInnerText| recursively includes all the text from descendants such as |
| 366 // text found in any embedded object. In contrast, |GetText| might include a | 367 // text found in any embedded object. In contrast, |GetText| might include a |
| 367 // special character in the place of every embedded object instead of its | 368 // special character in the place of every embedded object instead of its |
| 368 // text, depending on the platform. | 369 // text, depending on the platform. |
| 369 base::string16 GetInnerText() const; | 370 base::string16 GetInnerText() const; |
| 370 | 371 |
| 371 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); | 372 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); |
| 372 }; | 373 }; |
| 373 | 374 |
| 374 } // namespace content | 375 } // namespace content |
| 375 | 376 |
| 376 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ | 377 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ |
| OLD | NEW |