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

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: Vend frameIds at 1 location; minimize thread hops for webRequest Created 5 years 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/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 0fcb180954337def1462781c229008164f893aa7..6d5e9ae2dd505a8a5d22744759db9c1916b5ccb2 100644
--- a/content/public/browser/render_frame_host.h
+++ b/content/public/browser/render_frame_host.h
@@ -36,6 +36,15 @@ 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 RenderFrameHost that is hosted by the frame identified by the
nasko 2015/12/09 23:06:09 nit: s/hosted/associated/
robwu 2015/12/10 00:00:51 Done.
+ // given FrameTreeNode ID. The returned RenderFrameHost can be different from
+ // the RenderFrameHost that returned the ID via GetFrameTreeNodeID(); see the
+ // documentation at GetFrameTreeNodeID for more details.
+ // Use WebContents::FindFrameByFrameTreeNodeID to find a RenderFrameHost in
+ // a specific WebContents.
+ // Returns nullptr if the frame does not exist (any more).
nasko 2015/12/09 23:06:09 nit: You can drop the "(any more)".
robwu 2015/12/10 00:00:51 Done.
+ static RenderFrameHost* FromFrameTreeNodeID(int frame_tree_node_id);
nasko 2015/12/09 23:06:09 The conclusion on capitalization is using Id inste
robwu 2015/12/10 00:00:51 Done.
+
#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
@@ -67,6 +76,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 (including main frames) that hosts content. The
nasko 2015/12/09 23:06:09 nit: Drop the "(including main frames)" as this is
robwu 2015/12/10 00:00:51 Done.
+ // 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 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

Powered by Google App Engine
This is Rietveld 408576698