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