Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / content / renderer / accessibility / blink_ax_tree_source.h
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.
4
5 #ifndef CONTENT_RENDERER_ACCESSIBILITY_BLINK_AX_TREE_SOURCE_H_
6 #define CONTENT_RENDERER_ACCESSIBILITY_BLINK_AX_TREE_SOURCE_H_
7
8 #include "third_party/WebKit/public/web/WebAXObject.h"
9 #include "ui/accessibility/ax_node_data.h"
10 #include "ui/accessibility/ax_tree_source.h"
11
12 namespace content {
13
14 class RenderFrameImpl;
15
16 class BlinkAXTreeSource
17     : public ui::AXTreeSource<blink::WebAXObject> {
18  public:
19   BlinkAXTreeSource(RenderFrameImpl* render_frame);
20   virtual ~BlinkAXTreeSource();
21
22   // Walks up the ancestor chain to see if this is a descendant of the root.
23   bool IsInTree(blink::WebAXObject node) const;
24
25   // AXTreeSource implementation.
26   virtual blink::WebAXObject GetRoot() const OVERRIDE;
27   virtual blink::WebAXObject GetFromId(int32 id) const OVERRIDE;
28   virtual int32 GetId(blink::WebAXObject node) const OVERRIDE;
29   virtual void GetChildren(
30       blink::WebAXObject node,
31       std::vector<blink::WebAXObject>* out_children) const OVERRIDE;
32   virtual blink::WebAXObject GetParent(blink::WebAXObject node) const
33       OVERRIDE;
34   virtual void SerializeNode(blink::WebAXObject node,
35                              ui::AXNodeData* out_data) const OVERRIDE;
36   virtual bool IsValid(blink::WebAXObject node) const OVERRIDE;
37   virtual bool IsEqual(blink::WebAXObject node1,
38                        blink::WebAXObject node2) const OVERRIDE;
39   virtual blink::WebAXObject GetNull() const OVERRIDE;
40
41   blink::WebDocument GetMainDocument() const;
42
43  private:
44   RenderFrameImpl* render_frame_;
45 };
46
47 }  // namespace content
48
49 #endif  // CONTENT_RENDERER_ACCESSIBILITY_BLINK_AX_TREE_SOURCE_H_