Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: content/browser/renderer_host/render_widget_helper.cc

Issue 9837074: Make it so that allow_js_access: false can be used with background pages created by window.open. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revised approach based on http://crrev.com/125180. Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 content::ContentBrowserClient::CanCreateWindowResult can_create_result,
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 bool no_js_access = can_create_result ==
221 // If the opener is supppressed, we should open the window in a new 222 content::ContentBrowserClient::CAN_CREATE_WINDOW_NO_JS_ACCESS;
222 // BrowsingInstance, and thus a new process. That means the current 223 if (params.opener_suppressed || no_js_access) {
223 // renderer process will not be able to route messages to it. Because of 224 // If the opener is supppressed or script access is disallowed, we should
224 // this, we will immediately show and navigate the window in 225 // open the window in a new BrowsingInstance, and thus a new process. That
225 // OnCreateWindowOnUI, using the params provided here. 226 // means the current renderer process will not be able to route messages to
227 // it. Because of this, we will immediately show and navigate the window
228 // in OnCreateWindowOnUI, using the params provided here.
226 *route_id = MSG_ROUTING_NONE; 229 *route_id = MSG_ROUTING_NONE;
227 *surface_id = 0; 230 *surface_id = 0;
228 } else { 231 } else {
229 *route_id = GetNextRoutingID(); 232 *route_id = GetNextRoutingID();
230 *surface_id = GpuSurfaceTracker::Get()->AddSurfaceForRenderer( 233 *surface_id = GpuSurfaceTracker::Get()->AddSurfaceForRenderer(
231 render_process_id_, *route_id); 234 render_process_id_, *route_id);
232 // Block resource requests until the view is created, since the HWND might 235 // Block resource requests until the view is created, since the HWND might
233 // be needed if a response ends up creating a plugin. 236 // be needed if a response ends up creating a plugin.
234 resource_dispatcher_host_->BlockRequestsForRoute( 237 resource_dispatcher_host_->BlockRequestsForRoute(
235 render_process_id_, *route_id); 238 render_process_id_, *route_id);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 void RenderWidgetHelper::ClearAllocatedDIBs() { 358 void RenderWidgetHelper::ClearAllocatedDIBs() {
356 for (std::map<TransportDIB::Id, int>::iterator 359 for (std::map<TransportDIB::Id, int>::iterator
357 i = allocated_dibs_.begin(); i != allocated_dibs_.end(); ++i) { 360 i = allocated_dibs_.begin(); i != allocated_dibs_.end(); ++i) {
358 if (HANDLE_EINTR(close(i->second)) < 0) 361 if (HANDLE_EINTR(close(i->second)) < 0)
359 PLOG(ERROR) << "close: " << i->first; 362 PLOG(ERROR) << "close: " << i->first;
360 } 363 }
361 364
362 allocated_dibs_.clear(); 365 allocated_dibs_.clear();
363 } 366 }
364 #endif 367 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698