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

Unified Diff: content/browser/frame_host/frame_accessibility.h

Issue 558073002: Hook up guest browser plugins to the accessibility tree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cross_process_iframes_plugins_3
Patch Set: Rebase Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/frame_accessibility.h
diff --git a/content/browser/frame_host/frame_accessibility.h b/content/browser/frame_host/frame_accessibility.h
new file mode 100644
index 0000000000000000000000000000000000000000..253ba19b0544fa04058e9324de1f2269af445568
--- /dev/null
+++ b/content/browser/frame_host/frame_accessibility.h
@@ -0,0 +1,79 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_FRAME_HOST_FRAME_ACCESSIBILITY_H_
+#define CONTENT_BROWSER_FRAME_HOST_FRAME_ACCESSIBILITY_H_
+
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/memory/singleton.h"
+#include "content/common/content_export.h"
+
+namespace content {
+
+class RenderFrameHostImpl;
+
+// This singleton class maintains the mappings necessary to link child frames
+// and guest frames into a single tree for accessibility. This class is only
+// used if accessibility is enabled.
+class CONTENT_EXPORT FrameAccessibility {
+ public:
+ static FrameAccessibility* GetInstance();
+
+ // Add a mapping between an accessibility node of |parent_frame_host|
+ // and the child frame with the given frame tree node id, in the same
+ // frame tree.
+ void AddChildFrame(RenderFrameHostImpl* parent_frame_host,
+ int accessibility_node_id,
+ int64 child_frame_tree_node_id);
+
+ // Add a mapping between an accessibility node of |parent_frame_host|
+ // and the main frame of the guest Webcontents with the given
+ // browser plugin instance id.
+ void AddGuestWebContents(RenderFrameHostImpl* parent_frame_host,
+ int accessibility_node_id,
+ int browser_plugin_instance_id);
+
+ // This is called when a RenderFrameHostImpl is deleted, so invalid
+ // mappings can be removed from this data structure.
+ void OnRenderFrameHostDestroyed(RenderFrameHostImpl* render_frame_host);
+
+ // Given a parent RenderFrameHostImpl and an accessibility node id, look up
+ // a child frame or guest frame that was previously associated with this
+ // frame and node id. If a mapping exists, return the resulting frame if
+ // it's valid. If it doesn't resolve to a valid RenderFrameHostImpl,
+ // returns NULL.
+ RenderFrameHostImpl* GetChild(RenderFrameHostImpl* parent_frame_host,
+ int accessibility_node_id);
+
+ // Given a RenderFrameHostImpl, check the mapping table to see if it's
+ // the child of a node in some other frame. If so, return true and
+ // set the parent frame and accessibility node id in the parent frame,
+ // otherwise return false.
+ bool GetParent(RenderFrameHostImpl* child_frame_host,
+ RenderFrameHostImpl** out_parent_frame_host,
+ int* out_accessibility_node_id);
+
+ private:
+ FrameAccessibility();
+ virtual ~FrameAccessibility();
+
+ struct ChildFrameMapping {
+ ChildFrameMapping();
+
+ RenderFrameHostImpl* parent_frame_host;
+ int accessibility_node_id;
+ int64 child_frame_tree_node_id;
+ int browser_plugin_instance_id;
+ };
+
+ std::vector<ChildFrameMapping> mappings_;
+
+ friend struct DefaultSingletonTraits<FrameAccessibility>;
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_FRAME_HOST_FRAME_ACCESSIBILITY_H_

Powered by Google App Engine
This is Rietveld 408576698