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_widget_helper.h" | 5 #include "content/browser/renderer_host/render_widget_helper.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/eintr_wrapper.h" | 9 #include "base/eintr_wrapper.h" |
10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 render_process_id_, render_widget_id); | 207 render_process_id_, render_widget_id); |
208 } | 208 } |
209 | 209 |
210 void RenderWidgetHelper::OnCrossSiteSwapOutACK( | 210 void RenderWidgetHelper::OnCrossSiteSwapOutACK( |
211 const ViewMsg_SwapOut_Params& params) { | 211 const ViewMsg_SwapOut_Params& params) { |
212 resource_dispatcher_host_->OnSwapOutACK(params); | 212 resource_dispatcher_host_->OnSwapOutACK(params); |
213 } | 213 } |
214 | 214 |
215 void RenderWidgetHelper::CreateNewWindow( | 215 void RenderWidgetHelper::CreateNewWindow( |
216 const ViewHostMsg_CreateWindow_Params& params, | 216 const ViewHostMsg_CreateWindow_Params& params, |
| 217 bool no_javascript_access, |
217 base::ProcessHandle render_process, | 218 base::ProcessHandle render_process, |
218 int* route_id, | 219 int* route_id, |
219 int* surface_id) { | 220 int* surface_id) { |
220 if (params.opener_suppressed) { | 221 if (params.opener_suppressed || no_javascript_access) { |
221 // If the opener is supppressed, we should open the window in a new | 222 // If the opener is supppressed or script access is disallowed, we should |
222 // BrowsingInstance, and thus a new process. That means the current | 223 // open the window in a new BrowsingInstance, and thus a new process. That |
223 // renderer process will not be able to route messages to it. Because of | 224 // means the current renderer process will not be able to route messages to |
224 // this, we will immediately show and navigate the window in | 225 // it. Because of this, we will immediately show and navigate the window |
225 // OnCreateWindowOnUI, using the params provided here. | 226 // in OnCreateWindowOnUI, using the params provided here. |
226 *route_id = MSG_ROUTING_NONE; | 227 *route_id = MSG_ROUTING_NONE; |
227 *surface_id = 0; | 228 *surface_id = 0; |
228 } else { | 229 } else { |
229 *route_id = GetNextRoutingID(); | 230 *route_id = GetNextRoutingID(); |
230 *surface_id = GpuSurfaceTracker::Get()->AddSurfaceForRenderer( | 231 *surface_id = GpuSurfaceTracker::Get()->AddSurfaceForRenderer( |
231 render_process_id_, *route_id); | 232 render_process_id_, *route_id); |
232 // Block resource requests until the view is created, since the HWND might | 233 // Block resource requests until the view is created, since the HWND might |
233 // be needed if a response ends up creating a plugin. | 234 // be needed if a response ends up creating a plugin. |
234 resource_dispatcher_host_->BlockRequestsForRoute( | 235 resource_dispatcher_host_->BlockRequestsForRoute( |
235 render_process_id_, *route_id); | 236 render_process_id_, *route_id); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 void RenderWidgetHelper::ClearAllocatedDIBs() { | 356 void RenderWidgetHelper::ClearAllocatedDIBs() { |
356 for (std::map<TransportDIB::Id, int>::iterator | 357 for (std::map<TransportDIB::Id, int>::iterator |
357 i = allocated_dibs_.begin(); i != allocated_dibs_.end(); ++i) { | 358 i = allocated_dibs_.begin(); i != allocated_dibs_.end(); ++i) { |
358 if (HANDLE_EINTR(close(i->second)) < 0) | 359 if (HANDLE_EINTR(close(i->second)) < 0) |
359 PLOG(ERROR) << "close: " << i->first; | 360 PLOG(ERROR) << "close: " << i->first; |
360 } | 361 } |
361 | 362 |
362 allocated_dibs_.clear(); | 363 allocated_dibs_.clear(); |
363 } | 364 } |
364 #endif | 365 #endif |
OLD | NEW |