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_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ |
6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 class ListValue; | 29 class ListValue; |
30 } | 30 } |
31 | 31 |
32 namespace content { | 32 namespace content { |
33 | 33 |
34 class CrossProcessFrameConnector; | 34 class CrossProcessFrameConnector; |
35 class CrossSiteTransferringRequest; | 35 class CrossSiteTransferringRequest; |
36 class FrameTree; | 36 class FrameTree; |
37 class FrameTreeNode; | 37 class FrameTreeNode; |
38 class RenderFrameHostDelegate; | 38 class RenderFrameHostDelegate; |
| 39 class RenderFrameProxyHost; |
39 class RenderProcessHost; | 40 class RenderProcessHost; |
40 class RenderViewHostImpl; | 41 class RenderViewHostImpl; |
41 struct ContextMenuParams; | 42 struct ContextMenuParams; |
42 struct GlobalRequestID; | 43 struct GlobalRequestID; |
43 struct Referrer; | 44 struct Referrer; |
44 struct ShowDesktopNotificationHostMsgParams; | 45 struct ShowDesktopNotificationHostMsgParams; |
45 | 46 |
46 class CONTENT_EXPORT RenderFrameHostImpl : public RenderFrameHost { | 47 class CONTENT_EXPORT RenderFrameHostImpl : public RenderFrameHost { |
47 public: | 48 public: |
48 static RenderFrameHostImpl* FromID(int process_id, int routing_id); | 49 static RenderFrameHostImpl* FromID(int process_id, int routing_id); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // |cross_process_frame_connector| allows the non-swapped-out | 86 // |cross_process_frame_connector| allows the non-swapped-out |
86 // RenderFrameHost for a frame to communicate with the parent process | 87 // RenderFrameHost for a frame to communicate with the parent process |
87 // so that it may composite drawing data. | 88 // so that it may composite drawing data. |
88 // | 89 // |
89 // Ownership is not transfered. | 90 // Ownership is not transfered. |
90 void set_cross_process_frame_connector( | 91 void set_cross_process_frame_connector( |
91 CrossProcessFrameConnector* cross_process_frame_connector) { | 92 CrossProcessFrameConnector* cross_process_frame_connector) { |
92 cross_process_frame_connector_ = cross_process_frame_connector; | 93 cross_process_frame_connector_ = cross_process_frame_connector; |
93 } | 94 } |
94 | 95 |
| 96 void set_render_frame_proxy_host(RenderFrameProxyHost* proxy) { |
| 97 render_frame_proxy_host_ = proxy; |
| 98 } |
| 99 |
95 // Returns a bitwise OR of bindings types that have been enabled for this | 100 // Returns a bitwise OR of bindings types that have been enabled for this |
96 // RenderFrameHostImpl's RenderView. See BindingsPolicy for details. | 101 // RenderFrameHostImpl's RenderView. See BindingsPolicy for details. |
97 // TODO(creis): Make bindings frame-specific, to support cases like <webview>. | 102 // TODO(creis): Make bindings frame-specific, to support cases like <webview>. |
98 int GetEnabledBindings(); | 103 int GetEnabledBindings(); |
99 | 104 |
100 // Called on the pending RenderFrameHost when the network response is ready to | 105 // Called on the pending RenderFrameHost when the network response is ready to |
101 // commit. We should ensure that the old RenderFrameHost runs its unload | 106 // commit. We should ensure that the old RenderFrameHost runs its unload |
102 // handler and determine whether a transfer to a different RenderFrameHost is | 107 // handler and determine whether a transfer to a different RenderFrameHost is |
103 // needed. | 108 // needed. |
104 void OnCrossSiteResponse( | 109 void OnCrossSiteResponse( |
105 const GlobalRequestID& global_request_id, | 110 const GlobalRequestID& global_request_id, |
106 scoped_ptr<CrossSiteTransferringRequest> cross_site_transferring_request, | 111 scoped_ptr<CrossSiteTransferringRequest> cross_site_transferring_request, |
107 const std::vector<GURL>& transfer_url_chain, | 112 const std::vector<GURL>& transfer_url_chain, |
108 const Referrer& referrer, | 113 const Referrer& referrer, |
109 PageTransition page_transition, | 114 PageTransition page_transition, |
110 bool should_replace_current_entry); | 115 bool should_replace_current_entry); |
111 | 116 |
112 // Tells the renderer that this RenderFrame is being swapped out for one in a | 117 // Tells the renderer that this RenderFrame is being swapped out for one in a |
113 // different renderer process. It should run its unload handler and move to | 118 // different renderer process. It should run its unload handler, move to |
114 // a blank document. The renderer should preserve the Frame object until it | 119 // a blank document and create a RenderFrameProxy to replace the RenderFrame. |
115 // exits, in case we come back. The renderer can exit if it has no other | 120 // The renderer should preserve the Proxy object until it exits, in case we |
116 // active RenderFrames, but not until WasSwappedOut is called (when it is no | 121 // come back. The renderer can exit if it has no other active RenderFrames, |
117 // longer visible). | 122 // but not until WasSwappedOut is called (when it is no longer visible). |
118 void SwapOut(); | 123 void SwapOut(RenderFrameProxyHost* proxy); |
119 | 124 |
120 void OnSwappedOut(bool timed_out); | 125 void OnSwappedOut(bool timed_out); |
121 bool is_swapped_out() { return is_swapped_out_; } | 126 bool is_swapped_out() { return is_swapped_out_; } |
122 void set_swapped_out(bool is_swapped_out) { | 127 void set_swapped_out(bool is_swapped_out) { |
123 is_swapped_out_ = is_swapped_out; | 128 is_swapped_out_ = is_swapped_out; |
124 } | 129 } |
125 | 130 |
126 // Sets the RVH for |this| as pending shutdown. |on_swap_out| will be called | 131 // Sets the RVH for |this| as pending shutdown. |on_swap_out| will be called |
127 // when the SwapOutACK is received. | 132 // when the SwapOutACK is received. |
128 void SetPendingShutdown(const base::Closure& on_swap_out); | 133 void SetPendingShutdown(const base::Closure& on_swap_out); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 // | 259 // |
255 // This is only non-NULL when this is the swapped out RenderFrameHost in | 260 // This is only non-NULL when this is the swapped out RenderFrameHost in |
256 // the same site instance as this frame's parent. | 261 // the same site instance as this frame's parent. |
257 // | 262 // |
258 // See the class comment above CrossProcessFrameConnector for more | 263 // See the class comment above CrossProcessFrameConnector for more |
259 // information. | 264 // information. |
260 // | 265 // |
261 // This will move to RenderFrameProxyHost when that class is created. | 266 // This will move to RenderFrameProxyHost when that class is created. |
262 CrossProcessFrameConnector* cross_process_frame_connector_; | 267 CrossProcessFrameConnector* cross_process_frame_connector_; |
263 | 268 |
| 269 // The proxy created for this RenderFrameHost. It is used to send and receive |
| 270 // IPC messages while in swapped out state. |
| 271 // TODO(nasko): This can be removed once we don't have a swapped out state on |
| 272 // RenderFrameHosts. See https://crbug.com/357747. |
| 273 RenderFrameProxyHost* render_frame_proxy_host_; |
| 274 |
264 // Reference to the whole frame tree that this RenderFrameHost belongs to. | 275 // Reference to the whole frame tree that this RenderFrameHost belongs to. |
265 // Allows this RenderFrameHost to add and remove nodes in response to | 276 // Allows this RenderFrameHost to add and remove nodes in response to |
266 // messages from the renderer requesting DOM manipulation. | 277 // messages from the renderer requesting DOM manipulation. |
267 FrameTree* frame_tree_; | 278 FrameTree* frame_tree_; |
268 | 279 |
269 // The FrameTreeNode which this RenderFrameHostImpl is hosted in. | 280 // The FrameTreeNode which this RenderFrameHostImpl is hosted in. |
270 FrameTreeNode* frame_tree_node_; | 281 FrameTreeNode* frame_tree_node_; |
271 | 282 |
272 // The mapping of pending JavaScript calls created by | 283 // The mapping of pending JavaScript calls created by |
273 // ExecuteJavaScript and their corresponding callbacks. | 284 // ExecuteJavaScript and their corresponding callbacks. |
274 std::map<int, JavaScriptResultCallback> javascript_callbacks_; | 285 std::map<int, JavaScriptResultCallback> javascript_callbacks_; |
275 | 286 |
276 // Map from notification_id to a callback to cancel them. | 287 // Map from notification_id to a callback to cancel them. |
277 std::map<int, base::Closure> cancel_notification_callbacks_; | 288 std::map<int, base::Closure> cancel_notification_callbacks_; |
278 | 289 |
279 int routing_id_; | 290 int routing_id_; |
280 bool is_swapped_out_; | 291 bool is_swapped_out_; |
281 | 292 |
282 // When the last BeforeUnload message was sent. | 293 // When the last BeforeUnload message was sent. |
283 base::TimeTicks send_before_unload_start_time_; | 294 base::TimeTicks send_before_unload_start_time_; |
284 | 295 |
285 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; | 296 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; |
286 | 297 |
287 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); | 298 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); |
288 }; | 299 }; |
289 | 300 |
290 } // namespace content | 301 } // namespace content |
291 | 302 |
292 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ | 303 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ |
OLD | NEW |