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

Side by Side 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: Improve port lifetime management, add tests Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_PUBLIC_BROWSER_RENDER_FRAME_HOST_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_RENDER_FRAME_HOST_H_
6 #define CONTENT_PUBLIC_BROWSER_RENDER_FRAME_HOST_H_ 6 #define CONTENT_PUBLIC_BROWSER_RENDER_FRAME_HOST_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
(...skipping 17 matching lines...) Expand all
28 class SiteInstance; 28 class SiteInstance;
29 29
30 // The interface provides a communication conduit with a frame in the renderer. 30 // The interface provides a communication conduit with a frame in the renderer.
31 class CONTENT_EXPORT RenderFrameHost : public IPC::Listener, 31 class CONTENT_EXPORT RenderFrameHost : public IPC::Listener,
32 public IPC::Sender { 32 public IPC::Sender {
33 public: 33 public:
34 // Returns the RenderFrameHost given its ID and the ID of its render process. 34 // Returns the RenderFrameHost given its ID and the ID of its render process.
35 // Returns nullptr if the IDs do not correspond to a live RenderFrameHost. 35 // Returns nullptr if the IDs do not correspond to a live RenderFrameHost.
36 static RenderFrameHost* FromID(int render_process_id, int render_frame_id); 36 static RenderFrameHost* FromID(int render_process_id, int render_frame_id);
37 37
38 // Returns the RenderFrameHost that hosts the frame identified by the given
39 // FrameTreeNode ID. Returns nullptr if not found.
40 static RenderFrameHost* FromFrameTreeNodeID(int frame_tree_node_id);
41
38 // Globally allows for injecting JavaScript into the main world. This feature 42 // Globally allows for injecting JavaScript into the main world. This feature
39 // is present only to support Android WebView and must not be used in other 43 // is present only to support Android WebView and must not be used in other
40 // configurations. 44 // configurations.
41 static void AllowInjectingJavaScriptForAndroidWebView(); 45 static void AllowInjectingJavaScriptForAndroidWebView();
42 46
43 // Returns a RenderFrameHost given its accessibility tree ID. 47 // Returns a RenderFrameHost given its accessibility tree ID.
44 static RenderFrameHost* FromAXTreeID(int ax_tree_id); 48 static RenderFrameHost* FromAXTreeID(int ax_tree_id);
45 49
46 ~RenderFrameHost() override {} 50 ~RenderFrameHost() override {}
47 51
48 // Returns the route id for this frame. 52 // Returns the route id for this frame.
49 virtual int GetRoutingID() = 0; 53 virtual int GetRoutingID() = 0;
50 54
51 // Returns the accessibility tree ID for this RenderFrameHost. 55 // Returns the accessibility tree ID for this RenderFrameHost.
52 virtual int GetAXTreeID() = 0; 56 virtual int GetAXTreeID() = 0;
53 57
54 // Returns the SiteInstance grouping all RenderFrameHosts that have script 58 // Returns the SiteInstance grouping all RenderFrameHosts that have script
55 // access to this RenderFrameHost, and must therefore live in the same 59 // access to this RenderFrameHost, and must therefore live in the same
56 // process. 60 // process.
57 virtual SiteInstance* GetSiteInstance() = 0; 61 virtual SiteInstance* GetSiteInstance() = 0;
58 62
59 // Returns the process for this frame. 63 // Returns the process for this frame.
60 virtual RenderProcessHost* GetProcess() = 0; 64 virtual RenderProcessHost* GetProcess() = 0;
61 65
62 // Returns the current RenderFrameHost of the parent frame, or nullptr if 66 // Returns the current RenderFrameHost of the parent frame, or nullptr if
63 // there is no parent. The result may be in a different process than the 67 // there is no parent. The result may be in a different process than the
64 // current RenderFrameHost. 68 // current RenderFrameHost.
65 virtual RenderFrameHost* GetParent() = 0; 69 virtual RenderFrameHost* GetParent() = 0;
66 70
71 // Returns the RenderFrameHost for the given FrameTreeNode ID if it is the
Charlie Reis 2015/10/30 23:25:09 nit: the current RenderFrameHost (The same FrameTr
robwu 2015/11/02 19:08:34 Done.
72 // frame itself or a child of this frame.
Charlie Reis 2015/10/30 23:25:09 nit: or an immediate child (Is this what you inte
robwu 2015/10/31 00:10:45 My use case is finding a frame within a given tab,
robwu 2015/11/02 19:08:34 Done.
73 virtual RenderFrameHost* FindByFrameTreeNodeID(int frame_tree_node_id) = 0;
74
75 // Returns the FrameTreeNode ID for this frame.
76 virtual int GetFrameTreeNodeID() = 0;
77
67 // Returns the assigned name of the frame, the name of the iframe tag 78 // Returns the assigned name of the frame, the name of the iframe tag
68 // declaring it. For example, <iframe name="framename">[...]</iframe>. It is 79 // declaring it. For example, <iframe name="framename">[...]</iframe>. It is
69 // quite possible for a frame to have no name, in which case GetFrameName will 80 // quite possible for a frame to have no name, in which case GetFrameName will
70 // return an empty string. 81 // return an empty string.
71 virtual const std::string& GetFrameName() = 0; 82 virtual const std::string& GetFrameName() = 0;
72 83
73 // Returns true if the frame is out of process. 84 // Returns true if the frame is out of process.
74 virtual bool IsCrossProcessSubframe() = 0; 85 virtual bool IsCrossProcessSubframe() = 0;
75 86
76 // Returns the last committed URL of the frame. 87 // Returns the last committed URL of the frame.
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 161
151 private: 162 private:
152 // This interface should only be implemented inside content. 163 // This interface should only be implemented inside content.
153 friend class RenderFrameHostImpl; 164 friend class RenderFrameHostImpl;
154 RenderFrameHost() {} 165 RenderFrameHost() {}
155 }; 166 };
156 167
157 } // namespace content 168 } // namespace content
158 169
159 #endif // CONTENT_PUBLIC_BROWSER_RENDER_FRAME_HOST_H_ 170 #endif // CONTENT_PUBLIC_BROWSER_RENDER_FRAME_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698