[iOS] Cleanup ios/chrome/ios_chrome.gyp
[chromium-blink-merge.git] / ui / accessibility / platform / ax_platform_node_base.h
blob324b2394e28610123b4903608818ebf8ae45881f
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
3 // found in the LICENSE file.
5 #ifndef UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_BASE_H_
6 #define UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_BASE_H_
8 #include "ui/accessibility/ax_enums.h"
9 #include "ui/accessibility/platform/ax_platform_node.h"
10 #include "ui/gfx/geometry/rect.h"
11 #include "ui/gfx/native_widget_types.h"
13 namespace ui {
15 struct AXNodeData;
16 class AXPlatformNodeDelegate;
18 class AXPlatformNodeBase : public AXPlatformNode {
19 public:
20 virtual void Init(AXPlatformNodeDelegate* delegate);
22 // These are simple wrappers to our delegate.
23 const AXNodeData& GetData() const;
24 gfx::Rect GetBoundsInScreen() const;
25 gfx::NativeViewAccessible GetParent();
26 int GetChildCount();
27 gfx::NativeViewAccessible ChildAtIndex(int index);
29 // This needs to be implemented for each platform.
30 virtual int GetIndexInParent() = 0;
32 // AXPlatformNode.
33 void Destroy() override;
34 gfx::NativeViewAccessible GetNativeViewAccessible() override;
35 AXPlatformNodeDelegate* GetDelegate() const override;
37 // Helpers.
38 AXPlatformNodeBase* GetPreviousSibling();
39 AXPlatformNodeBase* GetNextSibling();
40 bool IsDescendant(AXPlatformNodeBase* descendant);
42 bool HasBoolAttribute(ui::AXBoolAttribute attr) const;
43 bool GetBoolAttribute(ui::AXBoolAttribute attr) const;
44 bool GetBoolAttribute(ui::AXBoolAttribute attr, bool* value) const;
46 bool HasFloatAttribute(ui::AXFloatAttribute attr) const;
47 float GetFloatAttribute(ui::AXFloatAttribute attr) const;
48 bool GetFloatAttribute(ui::AXFloatAttribute attr, float* value) const;
50 bool HasIntAttribute(ui::AXIntAttribute attribute) const;
51 int GetIntAttribute(ui::AXIntAttribute attribute) const;
52 bool GetIntAttribute(ui::AXIntAttribute attribute, int* value) const;
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;
64 AXPlatformNodeDelegate* delegate_; // Weak. Owns this.
66 protected:
67 AXPlatformNodeBase();
68 ~AXPlatformNodeBase() override;
70 // Cast a gfx::NativeViewAccessible to an AXPlatformNodeBase if it is one,
71 // or return NULL if it's not an instance of this class.
72 static AXPlatformNodeBase* FromNativeViewAccessible(
73 gfx::NativeViewAccessible accessible);
77 private:
78 DISALLOW_COPY_AND_ASSIGN(AXPlatformNodeBase);
81 } // namespace ui
83 #endif // UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_BASE_H_