OLD | NEW |
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 CONTENT_BROWSER_FRAME_HOST_FRAME_ACCESSIBILITY_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_FRAME_ACCESSIBILITY_H_ |
6 #define CONTENT_BROWSER_FRAME_HOST_FRAME_ACCESSIBILITY_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_FRAME_ACCESSIBILITY_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/singleton.h" | 11 #include "base/memory/singleton.h" |
12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 | 15 |
16 class RenderFrameHostImpl; | 16 class RenderFrameHostImpl; |
17 | 17 |
18 // This singleton class maintains the mappings necessary to link child frames | 18 // This singleton class maintains the mappings necessary to link child frames |
19 // and guest frames into a single tree for accessibility. This class is only | 19 // and guest frames into a single tree for accessibility. This class is only |
20 // used if accessibility is enabled. | 20 // used if accessibility is enabled. |
21 class CONTENT_EXPORT FrameAccessibility { | 21 class CONTENT_EXPORT FrameAccessibility { |
22 public: | 22 public: |
23 static FrameAccessibility* GetInstance(); | 23 static FrameAccessibility* GetInstance(); |
24 | 24 |
25 // Add a mapping between an accessibility node of |parent_frame_host| | 25 // Add a mapping between an accessibility node of |parent_frame_host| |
26 // and the child frame with the given frame tree node id, in the same | 26 // and the child frame with the given frame tree node id, in the same |
27 // frame tree. | 27 // frame tree. |
28 void AddChildFrame(RenderFrameHostImpl* parent_frame_host, | 28 void AddChildFrame(RenderFrameHostImpl* parent_frame_host, |
29 int accessibility_node_id, | 29 int accessibility_node_id, |
30 int64 child_frame_tree_node_id); | 30 int child_frame_tree_node_id); |
31 | 31 |
32 // Add a mapping between an accessibility node of |parent_frame_host| | 32 // Add a mapping between an accessibility node of |parent_frame_host| |
33 // and the main frame of the guest Webcontents with the given | 33 // and the main frame of the guest Webcontents with the given |
34 // browser plugin instance id. | 34 // browser plugin instance id. |
35 void AddGuestWebContents(RenderFrameHostImpl* parent_frame_host, | 35 void AddGuestWebContents(RenderFrameHostImpl* parent_frame_host, |
36 int accessibility_node_id, | 36 int accessibility_node_id, |
37 int browser_plugin_instance_id); | 37 int browser_plugin_instance_id); |
38 | 38 |
39 // This is called when a RenderFrameHostImpl is deleted, so invalid | 39 // This is called when a RenderFrameHostImpl is deleted, so invalid |
40 // mappings can be removed from this data structure. | 40 // mappings can be removed from this data structure. |
(...skipping 21 matching lines...) Expand all Loading... |
62 bool GetParent(RenderFrameHostImpl* child_frame_host, | 62 bool GetParent(RenderFrameHostImpl* child_frame_host, |
63 RenderFrameHostImpl** out_parent_frame_host, | 63 RenderFrameHostImpl** out_parent_frame_host, |
64 int* out_accessibility_node_id); | 64 int* out_accessibility_node_id); |
65 | 65 |
66 private: | 66 private: |
67 FrameAccessibility(); | 67 FrameAccessibility(); |
68 virtual ~FrameAccessibility(); | 68 virtual ~FrameAccessibility(); |
69 | 69 |
70 RenderFrameHostImpl* GetRFHIFromFrameTreeNodeId( | 70 RenderFrameHostImpl* GetRFHIFromFrameTreeNodeId( |
71 RenderFrameHostImpl* parent_frame_host, | 71 RenderFrameHostImpl* parent_frame_host, |
72 int64 child_frame_tree_node_id); | 72 int child_frame_tree_node_id); |
73 | 73 |
74 // This structure stores the parent-child relationship between an | 74 // This structure stores the parent-child relationship between an |
75 // accessibility node in a parent frame and its child frame, where the | 75 // accessibility node in a parent frame and its child frame, where the |
76 // child frame may be an iframe or the main frame of a guest browser | 76 // child frame may be an iframe or the main frame of a guest browser |
77 // plugin. It allows the accessibility code to walk both down and up | 77 // plugin. It allows the accessibility code to walk both down and up |
78 // the "composed" accessibility tree. | 78 // the "composed" accessibility tree. |
79 struct ChildFrameMapping { | 79 struct ChildFrameMapping { |
80 ChildFrameMapping(); | 80 ChildFrameMapping(); |
81 | 81 |
82 // The parent frame host. Required. | 82 // The parent frame host. Required. |
83 RenderFrameHostImpl* parent_frame_host; | 83 RenderFrameHostImpl* parent_frame_host; |
84 | 84 |
85 // The id of the accessibility node that's the host of the child frame, | 85 // The id of the accessibility node that's the host of the child frame, |
86 // for example the accessibility node for the <iframe> element or the | 86 // for example the accessibility node for the <iframe> element or the |
87 // <embed> element. | 87 // <embed> element. |
88 int accessibility_node_id; | 88 int accessibility_node_id; |
89 | 89 |
90 // If the child frame is an iframe, this is the iframe's FrameTreeNode id, | 90 // If the child frame is an iframe, this is the iframe's FrameTreeNode id, |
91 // otherwise 0. | 91 // otherwise 0. |
92 int64 child_frame_tree_node_id; | 92 int child_frame_tree_node_id; |
93 | 93 |
94 // If the child frame is a browser plugin, this is its instance id, | 94 // If the child frame is a browser plugin, this is its instance id, |
95 // otherwise 0. | 95 // otherwise 0. |
96 int browser_plugin_instance_id; | 96 int browser_plugin_instance_id; |
97 }; | 97 }; |
98 | 98 |
99 std::vector<ChildFrameMapping> mappings_; | 99 std::vector<ChildFrameMapping> mappings_; |
100 | 100 |
101 friend struct DefaultSingletonTraits<FrameAccessibility>; | 101 friend struct DefaultSingletonTraits<FrameAccessibility>; |
102 }; | 102 }; |
103 | 103 |
104 } // namespace content | 104 } // namespace content |
105 | 105 |
106 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_ACCESSIBILITY_H_ | 106 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_ACCESSIBILITY_H_ |
OLD | NEW |