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" |
(...skipping 30 matching lines...) Expand all Loading... |
41 void OnRenderFrameHostDestroyed(RenderFrameHostImpl* render_frame_host); | 41 void OnRenderFrameHostDestroyed(RenderFrameHostImpl* render_frame_host); |
42 | 42 |
43 // Given a parent RenderFrameHostImpl and an accessibility node id, look up | 43 // Given a parent RenderFrameHostImpl and an accessibility node id, look up |
44 // a child frame or guest frame that was previously associated with this | 44 // a child frame or guest frame that was previously associated with this |
45 // frame and node id. If a mapping exists, return the resulting frame if | 45 // frame and node id. If a mapping exists, return the resulting frame if |
46 // it's valid. If it doesn't resolve to a valid RenderFrameHostImpl, | 46 // it's valid. If it doesn't resolve to a valid RenderFrameHostImpl, |
47 // returns NULL. | 47 // returns NULL. |
48 RenderFrameHostImpl* GetChild(RenderFrameHostImpl* parent_frame_host, | 48 RenderFrameHostImpl* GetChild(RenderFrameHostImpl* parent_frame_host, |
49 int accessibility_node_id); | 49 int accessibility_node_id); |
50 | 50 |
| 51 // Given a parent RenderFrameHostImpl and an accessibility node id, look up |
| 52 // all child frames or guest frames that were previously associated with this |
| 53 // frame, and populate |child_frame_hosts| with all of them that resolve |
| 54 // to a valid RenderFrameHostImpl. |
| 55 void GetAllChildFrames(RenderFrameHostImpl* parent_frame_host, |
| 56 std::vector<RenderFrameHostImpl*>* child_frame_hosts); |
| 57 |
51 // Given a RenderFrameHostImpl, check the mapping table to see if it's | 58 // Given a RenderFrameHostImpl, check the mapping table to see if it's |
52 // the child of a node in some other frame. If so, return true and | 59 // the child of a node in some other frame. If so, return true and |
53 // set the parent frame and accessibility node id in the parent frame, | 60 // set the parent frame and accessibility node id in the parent frame, |
54 // otherwise return false. | 61 // otherwise return false. |
55 bool GetParent(RenderFrameHostImpl* child_frame_host, | 62 bool GetParent(RenderFrameHostImpl* child_frame_host, |
56 RenderFrameHostImpl** out_parent_frame_host, | 63 RenderFrameHostImpl** out_parent_frame_host, |
57 int* out_accessibility_node_id); | 64 int* out_accessibility_node_id); |
58 | 65 |
59 private: | 66 private: |
60 FrameAccessibility(); | 67 FrameAccessibility(); |
61 virtual ~FrameAccessibility(); | 68 virtual ~FrameAccessibility(); |
62 | 69 |
| 70 RenderFrameHostImpl* GetRFHIFromFrameTreeNodeId( |
| 71 RenderFrameHostImpl* parent_frame_host, |
| 72 int64 child_frame_tree_node_id); |
| 73 |
| 74 // This structure stores the parent-child relationship between an |
| 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 |
| 77 // plugin. It allows the accessibility code to walk both down and up |
| 78 // the "composed" accessibility tree. |
63 struct ChildFrameMapping { | 79 struct ChildFrameMapping { |
64 ChildFrameMapping(); | 80 ChildFrameMapping(); |
65 | 81 |
| 82 // The parent frame host. Required. |
66 RenderFrameHostImpl* parent_frame_host; | 83 RenderFrameHostImpl* parent_frame_host; |
| 84 |
| 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 |
| 87 // <embed> element. |
67 int accessibility_node_id; | 88 int accessibility_node_id; |
| 89 |
| 90 // If the child frame is an iframe, this is the iframe's FrameTreeNode id, |
| 91 // otherwise 0. |
68 int64 child_frame_tree_node_id; | 92 int64 child_frame_tree_node_id; |
| 93 |
| 94 // If the child frame is a browser plugin, this is its instance id, |
| 95 // otherwise 0. |
69 int browser_plugin_instance_id; | 96 int browser_plugin_instance_id; |
70 }; | 97 }; |
71 | 98 |
72 std::vector<ChildFrameMapping> mappings_; | 99 std::vector<ChildFrameMapping> mappings_; |
73 | 100 |
74 friend struct DefaultSingletonTraits<FrameAccessibility>; | 101 friend struct DefaultSingletonTraits<FrameAccessibility>; |
75 }; | 102 }; |
76 | 103 |
77 } // namespace content | 104 } // namespace content |
78 | 105 |
79 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_ACCESSIBILITY_H_ | 106 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_ACCESSIBILITY_H_ |
OLD | NEW |