Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Side by Side Diff: ui/accessibility/platform/ax_platform_node_base.h

Issue 909143003: Re-land: Implement NativeViewAccessibilityWin using AXPlatformNodeWin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update GN build Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_BASE_H_ 5 #ifndef UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_BASE_H_
6 #define UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_BASE_H_ 6 #define UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_BASE_H_
7 7
8 #include "ui/accessibility/ax_enums.h" 8 #include "ui/accessibility/ax_enums.h"
9 #include "ui/accessibility/platform/ax_platform_node.h" 9 #include "ui/accessibility/platform/ax_platform_node.h"
10 #include "ui/gfx/geometry/rect.h" 10 #include "ui/gfx/geometry/rect.h"
11 #include "ui/gfx/native_widget_types.h" 11 #include "ui/gfx/native_widget_types.h"
12 12
13 namespace ui { 13 namespace ui {
14 14
15 struct AXNodeData;
15 class AXPlatformNodeDelegate; 16 class AXPlatformNodeDelegate;
16 17
17 class AXPlatformNodeBase : public AXPlatformNode { 18 class AXPlatformNodeBase : public AXPlatformNode {
18 public: 19 public:
19 virtual void Init(AXPlatformNodeDelegate* delegate); 20 virtual void Init(AXPlatformNodeDelegate* delegate);
20 21
21 // These are simple wrappers to our delegate. 22 // These are simple wrappers to our delegate.
22 AXRole GetRole() const; 23 const AXNodeData& GetData() const;
23 gfx::Rect GetBoundsInScreen() const; 24 gfx::Rect GetBoundsInScreen() const;
24 gfx::NativeViewAccessible GetParent(); 25 gfx::NativeViewAccessible GetParent();
25 int GetChildCount(); 26 int GetChildCount();
26 gfx::NativeViewAccessible ChildAtIndex(int index); 27 gfx::NativeViewAccessible ChildAtIndex(int index);
27 28
28 // AXPlatformNode 29 // This needs to be implemented for each platform.
30 virtual int GetIndexInParent() = 0;
31
32 // AXPlatformNode.
29 void Destroy() override; 33 void Destroy() override;
30 gfx::NativeViewAccessible GetNativeViewAccessible() override; 34 gfx::NativeViewAccessible GetNativeViewAccessible() override;
35 AXPlatformNodeDelegate* GetDelegate() const override;
36
37 // Helpers.
38 AXPlatformNodeBase* GetPreviousSibling();
39 AXPlatformNodeBase* GetNextSibling();
40 bool IsDescendant(AXPlatformNodeBase* descendant);
41
42 bool HasBoolAttribute(ui::AXBoolAttribute attr) const;
43 bool GetBoolAttribute(ui::AXBoolAttribute attr) const;
44 bool GetBoolAttribute(ui::AXBoolAttribute attr, bool* value) const;
45
46 bool HasFloatAttribute(ui::AXFloatAttribute attr) const;
47 float GetFloatAttribute(ui::AXFloatAttribute attr) const;
48 bool GetFloatAttribute(ui::AXFloatAttribute attr, float* value) const;
49
50 bool HasIntAttribute(ui::AXIntAttribute attribute) const;
51 int GetIntAttribute(ui::AXIntAttribute attribute) const;
52 bool GetIntAttribute(ui::AXIntAttribute attribute, int* value) const;
53
54 bool HasStringAttribute(
55 ui::AXStringAttribute attribute) const;
56 const std::string& GetStringAttribute(ui::AXStringAttribute attribute) const;
57 bool GetStringAttribute(ui::AXStringAttribute attribute,
58 std::string* value) const;
59 bool GetString16Attribute(ui::AXStringAttribute attribute,
60 base::string16* value) const;
61 base::string16 GetString16Attribute(
62 ui::AXStringAttribute attribute) const;
31 63
32 protected: 64 protected:
33 AXPlatformNodeBase(); 65 AXPlatformNodeBase();
34 ~AXPlatformNodeBase() override; 66 ~AXPlatformNodeBase() override;
35 67
68 // Cast a gfx::NativeViewAccessible to an AXPlatformNodeBase if it is one,
69 // or return NULL if it's not an instance of this class.
70 static AXPlatformNodeBase* FromNativeViewAccessible(
71 gfx::NativeViewAccessible accessible);
72
36 AXPlatformNodeDelegate* delegate_; // Weak. Owns this. 73 AXPlatformNodeDelegate* delegate_; // Weak. Owns this.
37 74
38 private: 75 private:
39 DISALLOW_COPY_AND_ASSIGN(AXPlatformNodeBase); 76 DISALLOW_COPY_AND_ASSIGN(AXPlatformNodeBase);
40 }; 77 };
41 78
42 } // namespace ui 79 } // namespace ui
43 80
44 #endif // UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_BASE_H_ 81 #endif // UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_BASE_H_
OLDNEW
« no previous file with comments | « ui/accessibility/platform/ax_platform_node.cc ('k') | ui/accessibility/platform/ax_platform_node_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698