OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "content/browser/renderer_host/render_view_host_impl.h" | 5 #include "content/browser/renderer_host/render_view_host_impl.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 // static | 128 // static |
129 RenderViewHostImpl* RenderViewHostImpl::FromID(int render_process_id, | 129 RenderViewHostImpl* RenderViewHostImpl::FromID(int render_process_id, |
130 int render_view_id) { | 130 int render_view_id) { |
131 return static_cast<RenderViewHostImpl*>( | 131 return static_cast<RenderViewHostImpl*>( |
132 RenderViewHost::FromID(render_process_id, render_view_id)); | 132 RenderViewHost::FromID(render_process_id, render_view_id)); |
133 } | 133 } |
134 | 134 |
135 RenderViewHostImpl::RenderViewHostImpl(SiteInstance* instance, | 135 RenderViewHostImpl::RenderViewHostImpl(SiteInstance* instance, |
136 RenderViewHostDelegate* delegate, | 136 RenderViewHostDelegate* delegate, |
137 int routing_id, | 137 int routing_id, |
| 138 bool swapped_out, |
138 SessionStorageNamespace* session_storage) | 139 SessionStorageNamespace* session_storage) |
139 : RenderWidgetHostImpl(instance->GetProcess(), routing_id), | 140 : RenderWidgetHostImpl(instance->GetProcess(), routing_id), |
140 delegate_(delegate), | 141 delegate_(delegate), |
141 instance_(static_cast<SiteInstanceImpl*>(instance)), | 142 instance_(static_cast<SiteInstanceImpl*>(instance)), |
142 waiting_for_drag_context_response_(false), | 143 waiting_for_drag_context_response_(false), |
143 enabled_bindings_(0), | 144 enabled_bindings_(0), |
144 guest_(false), | 145 guest_(false), |
145 pending_request_id_(-1), | 146 pending_request_id_(-1), |
146 navigations_suspended_(false), | 147 navigations_suspended_(false), |
147 suspended_nav_message_(NULL), | 148 suspended_nav_message_(NULL), |
148 is_swapped_out_(false), | 149 is_swapped_out_(swapped_out), |
149 run_modal_reply_msg_(NULL), | 150 run_modal_reply_msg_(NULL), |
150 is_waiting_for_beforeunload_ack_(false), | 151 is_waiting_for_beforeunload_ack_(false), |
151 is_waiting_for_unload_ack_(false), | 152 is_waiting_for_unload_ack_(false), |
152 has_timed_out_on_unload_(false), | 153 has_timed_out_on_unload_(false), |
153 unload_ack_is_for_cross_site_transition_(false), | 154 unload_ack_is_for_cross_site_transition_(false), |
154 are_javascript_messages_suppressed_(false), | 155 are_javascript_messages_suppressed_(false), |
155 sudden_termination_allowed_(false), | 156 sudden_termination_allowed_(false), |
156 session_storage_namespace_( | 157 session_storage_namespace_( |
157 static_cast<SessionStorageNamespaceImpl*>(session_storage)), | 158 static_cast<SessionStorageNamespaceImpl*>(session_storage)), |
158 save_accessibility_tree_for_testing_(false), | 159 save_accessibility_tree_for_testing_(false), |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 | 199 |
199 content::RenderViewHostDelegate* RenderViewHostImpl::GetDelegate() const { | 200 content::RenderViewHostDelegate* RenderViewHostImpl::GetDelegate() const { |
200 return delegate_; | 201 return delegate_; |
201 } | 202 } |
202 | 203 |
203 content::SiteInstance* RenderViewHostImpl::GetSiteInstance() const { | 204 content::SiteInstance* RenderViewHostImpl::GetSiteInstance() const { |
204 return instance_; | 205 return instance_; |
205 } | 206 } |
206 | 207 |
207 bool RenderViewHostImpl::CreateRenderView(const string16& frame_name, | 208 bool RenderViewHostImpl::CreateRenderView(const string16& frame_name, |
| 209 int opener_route_id, |
208 int32 max_page_id) { | 210 int32 max_page_id) { |
209 DCHECK(!IsRenderViewLive()) << "Creating view twice"; | 211 DCHECK(!IsRenderViewLive()) << "Creating view twice"; |
210 | 212 |
211 // The process may (if we're sharing a process with another host that already | 213 // The process may (if we're sharing a process with another host that already |
212 // initialized it) or may not (we have our own process or the old process | 214 // initialized it) or may not (we have our own process or the old process |
213 // crashed) have been initialized. Calling Init multiple times will be | 215 // crashed) have been initialized. Calling Init multiple times will be |
214 // ignored, so this is safe. | 216 // ignored, so this is safe. |
215 if (!GetProcess()->Init()) | 217 if (!GetProcess()->Init()) |
216 return false; | 218 return false; |
217 DCHECK(GetProcess()->HasConnection()); | 219 DCHECK(GetProcess()->HasConnection()); |
(...skipping 12 matching lines...) Expand all Loading... |
230 | 232 |
231 ViewMsg_New_Params params; | 233 ViewMsg_New_Params params; |
232 params.parent_window = GetNativeViewId(); | 234 params.parent_window = GetNativeViewId(); |
233 params.renderer_preferences = | 235 params.renderer_preferences = |
234 delegate_->GetRendererPrefs(GetProcess()->GetBrowserContext()); | 236 delegate_->GetRendererPrefs(GetProcess()->GetBrowserContext()); |
235 params.web_preferences = delegate_->GetWebkitPrefs(); | 237 params.web_preferences = delegate_->GetWebkitPrefs(); |
236 params.view_id = GetRoutingID(); | 238 params.view_id = GetRoutingID(); |
237 params.surface_id = surface_id(); | 239 params.surface_id = surface_id(); |
238 params.session_storage_namespace_id = session_storage_namespace_->id(); | 240 params.session_storage_namespace_id = session_storage_namespace_->id(); |
239 params.frame_name = frame_name; | 241 params.frame_name = frame_name; |
| 242 // Ensure the RenderView sets its opener correctly. |
| 243 params.opener_route_id = opener_route_id; |
| 244 params.swapped_out = is_swapped_out_; |
240 params.next_page_id = next_page_id; | 245 params.next_page_id = next_page_id; |
241 #if defined(OS_POSIX) || defined(USE_AURA) | 246 #if defined(OS_POSIX) || defined(USE_AURA) |
242 if (GetView()) { | 247 if (GetView()) { |
243 static_cast<content::RenderWidgetHostViewPort*>( | 248 static_cast<content::RenderWidgetHostViewPort*>( |
244 GetView())->GetScreenInfo(¶ms.screen_info); | 249 GetView())->GetScreenInfo(¶ms.screen_info); |
245 } else { | 250 } else { |
246 content::RenderWidgetHostViewPort::GetDefaultScreenInfo( | 251 content::RenderWidgetHostViewPort::GetDefaultScreenInfo( |
247 ¶ms.screen_info); | 252 ¶ms.screen_info); |
248 } | 253 } |
249 #else | 254 #else |
(...skipping 1569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1819 is_waiting_for_beforeunload_ack_ = false; | 1824 is_waiting_for_beforeunload_ack_ = false; |
1820 is_waiting_for_unload_ack_ = false; | 1825 is_waiting_for_unload_ack_ = false; |
1821 has_timed_out_on_unload_ = false; | 1826 has_timed_out_on_unload_ = false; |
1822 } | 1827 } |
1823 | 1828 |
1824 void RenderViewHostImpl::ClearPowerSaveBlockers() { | 1829 void RenderViewHostImpl::ClearPowerSaveBlockers() { |
1825 STLDeleteValues(&power_save_blockers_); | 1830 STLDeleteValues(&power_save_blockers_); |
1826 } | 1831 } |
1827 | 1832 |
1828 } // namespace content | 1833 } // namespace content |
OLD | NEW |