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

Unified Diff: content/public/browser/render_frame_host.h

Issue 1413543005: Use FrameTreeNode ID as frameId in extension APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/:/ / Created 4 years, 11 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
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | content/public/browser/resource_request_info.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/browser/render_frame_host.h
diff --git a/content/public/browser/render_frame_host.h b/content/public/browser/render_frame_host.h
index a5c04244ddfcf3d881101acc66ba694e0a9e907a..4a45df26931abb1ed27289a49b4ede523d5b266c 100644
--- a/content/public/browser/render_frame_host.h
+++ b/content/public/browser/render_frame_host.h
@@ -37,6 +37,16 @@ class CONTENT_EXPORT RenderFrameHost : public IPC::Listener,
// Returns nullptr if the IDs do not correspond to a live RenderFrameHost.
static RenderFrameHost* FromID(int render_process_id, int render_frame_id);
+ // Returns the current RenderFrameHost associated with the frame identified by
+ // the given FrameTreeNode ID, in any WebContents. The frame may change its
+ // current RenderFrameHost over time, so the returned RenderFrameHost can be
+ // different from the RenderFrameHost that returned the ID via
+ // GetFrameTreeNodeId(). See GetFrameTreeNodeId for more details.
+ // Use WebContents::FindFrameByFrameTreeNodeId to find a RenderFrameHost in
+ // a specific WebContents.
+ // Returns nullptr if the frame does not exist.
+ static RenderFrameHost* FromFrameTreeNodeId(int frame_tree_node_id);
avallee 2016/04/11 18:13:19 No implementation nor calls...
Charlie Reis 2016/04/11 20:41:27 Thanks for noticing, avallee@. Can you send a CL
+
#if defined(OS_ANDROID)
// Globally allows for injecting JavaScript into the main world. This feature
// is present only to support Android WebView and must not be used in other
@@ -68,6 +78,17 @@ class CONTENT_EXPORT RenderFrameHost : public IPC::Listener,
// current RenderFrameHost.
virtual RenderFrameHost* GetParent() = 0;
+ // Returns the FrameTreeNode ID for this frame. This ID is browser-global and
+ // uniquely identifies a frame that hosts content. The identifier is fixed at
+ // the creation of the frame and stays constant for the lifetime of the frame.
+ // When the frame is removed, the ID is not used again.
+ //
+ // A RenderFrameHost is tied to a process. Due to cross-process navigations,
+ // the RenderFrameHost may have a shorter lifetime than a frame. Consequently,
+ // the same FrameTreeNode ID may refer to a different RenderFrameHost after a
+ // navigation.
+ virtual int GetFrameTreeNodeId() = 0;
+
// Returns the assigned name of the frame, the name of the iframe tag
// declaring it. For example, <iframe name="framename">[...]</iframe>. It is
// quite possible for a frame to have no name, in which case GetFrameName will
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | content/public/browser/resource_request_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698