OLD | NEW |
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 19 matching lines...) Expand all Loading... |
30 class SiteInstance; | 30 class SiteInstance; |
31 | 31 |
32 // The interface provides a communication conduit with a frame in the renderer. | 32 // The interface provides a communication conduit with a frame in the renderer. |
33 class CONTENT_EXPORT RenderFrameHost : public IPC::Listener, | 33 class CONTENT_EXPORT RenderFrameHost : public IPC::Listener, |
34 public IPC::Sender { | 34 public IPC::Sender { |
35 public: | 35 public: |
36 // Returns the RenderFrameHost given its ID and the ID of its render process. | 36 // Returns the RenderFrameHost given its ID and the ID of its render process. |
37 // Returns nullptr if the IDs do not correspond to a live RenderFrameHost. | 37 // Returns nullptr if the IDs do not correspond to a live RenderFrameHost. |
38 static RenderFrameHost* FromID(int render_process_id, int render_frame_id); | 38 static RenderFrameHost* FromID(int render_process_id, int render_frame_id); |
39 | 39 |
| 40 // Returns the current RenderFrameHost associated with the frame identified by |
| 41 // the given FrameTreeNode ID, in any WebContents. The frame may change its |
| 42 // current RenderFrameHost over time, so the returned RenderFrameHost can be |
| 43 // different from the RenderFrameHost that returned the ID via |
| 44 // GetFrameTreeNodeId(). See GetFrameTreeNodeId for more details. |
| 45 // Use WebContents::FindFrameByFrameTreeNodeId to find a RenderFrameHost in |
| 46 // a specific WebContents. |
| 47 // Returns nullptr if the frame does not exist. |
| 48 static RenderFrameHost* FromFrameTreeNodeId(int frame_tree_node_id); |
| 49 |
40 #if defined(OS_ANDROID) | 50 #if defined(OS_ANDROID) |
41 // Globally allows for injecting JavaScript into the main world. This feature | 51 // Globally allows for injecting JavaScript into the main world. This feature |
42 // is present only to support Android WebView and must not be used in other | 52 // is present only to support Android WebView and must not be used in other |
43 // configurations. | 53 // configurations. |
44 static void AllowInjectingJavaScriptForAndroidWebView(); | 54 static void AllowInjectingJavaScriptForAndroidWebView(); |
45 #endif | 55 #endif |
46 | 56 |
47 // Returns a RenderFrameHost given its accessibility tree ID. | 57 // Returns a RenderFrameHost given its accessibility tree ID. |
48 static RenderFrameHost* FromAXTreeID(int ax_tree_id); | 58 static RenderFrameHost* FromAXTreeID(int ax_tree_id); |
49 | 59 |
(...skipping 11 matching lines...) Expand all Loading... |
61 virtual SiteInstance* GetSiteInstance() = 0; | 71 virtual SiteInstance* GetSiteInstance() = 0; |
62 | 72 |
63 // Returns the process for this frame. | 73 // Returns the process for this frame. |
64 virtual RenderProcessHost* GetProcess() = 0; | 74 virtual RenderProcessHost* GetProcess() = 0; |
65 | 75 |
66 // Returns the current RenderFrameHost of the parent frame, or nullptr if | 76 // Returns the current RenderFrameHost of the parent frame, or nullptr if |
67 // there is no parent. The result may be in a different process than the | 77 // there is no parent. The result may be in a different process than the |
68 // current RenderFrameHost. | 78 // current RenderFrameHost. |
69 virtual RenderFrameHost* GetParent() = 0; | 79 virtual RenderFrameHost* GetParent() = 0; |
70 | 80 |
| 81 // Returns the FrameTreeNode ID for this frame. This ID is browser-global and |
| 82 // uniquely identifies a frame that hosts content. The identifier is fixed at |
| 83 // the creation of the frame and stays constant for the lifetime of the frame. |
| 84 // When the frame is removed, the ID is not used again. |
| 85 // |
| 86 // A RenderFrameHost is tied to a process. Due to cross-process navigations, |
| 87 // the RenderFrameHost may have a shorter lifetime than a frame. Consequently, |
| 88 // the same FrameTreeNode ID may refer to a different RenderFrameHost after a |
| 89 // navigation. |
| 90 virtual int GetFrameTreeNodeId() = 0; |
| 91 |
71 // Returns the assigned name of the frame, the name of the iframe tag | 92 // Returns the assigned name of the frame, the name of the iframe tag |
72 // declaring it. For example, <iframe name="framename">[...]</iframe>. It is | 93 // declaring it. For example, <iframe name="framename">[...]</iframe>. It is |
73 // quite possible for a frame to have no name, in which case GetFrameName will | 94 // quite possible for a frame to have no name, in which case GetFrameName will |
74 // return an empty string. | 95 // return an empty string. |
75 virtual const std::string& GetFrameName() = 0; | 96 virtual const std::string& GetFrameName() = 0; |
76 | 97 |
77 // Returns true if the frame is out of process. | 98 // Returns true if the frame is out of process. |
78 virtual bool IsCrossProcessSubframe() = 0; | 99 virtual bool IsCrossProcessSubframe() = 0; |
79 | 100 |
80 // Returns the last committed URL of the frame. | 101 // Returns the last committed URL of the frame. |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 190 |
170 private: | 191 private: |
171 // This interface should only be implemented inside content. | 192 // This interface should only be implemented inside content. |
172 friend class RenderFrameHostImpl; | 193 friend class RenderFrameHostImpl; |
173 RenderFrameHost() {} | 194 RenderFrameHost() {} |
174 }; | 195 }; |
175 | 196 |
176 } // namespace content | 197 } // namespace content |
177 | 198 |
178 #endif // CONTENT_PUBLIC_BROWSER_RENDER_FRAME_HOST_H_ | 199 #endif // CONTENT_PUBLIC_BROWSER_RENDER_FRAME_HOST_H_ |
OLD | NEW |