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

Side by Side Diff: content/renderer/render_view_impl.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: 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/renderer/render_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after
1474 params.opener_security_origin = 1474 params.opener_security_origin =
1475 creator->document().securityOrigin().toString().utf8(); 1475 creator->document().securityOrigin().toString().utf8();
1476 params.opener_suppressed = creator->willSuppressOpenerInNewFrame(); 1476 params.opener_suppressed = creator->willSuppressOpenerInNewFrame();
1477 params.disposition = NavigationPolicyToDisposition(policy); 1477 params.disposition = NavigationPolicyToDisposition(policy);
1478 if (!request.isNull()) 1478 if (!request.isNull())
1479 params.target_url = request.url(); 1479 params.target_url = request.url();
1480 1480
1481 int32 routing_id = MSG_ROUTING_NONE; 1481 int32 routing_id = MSG_ROUTING_NONE;
1482 int32 surface_id = 0; 1482 int32 surface_id = 0;
1483 int64 cloned_session_storage_namespace_id; 1483 int64 cloned_session_storage_namespace_id;
1484 bool no_js_access;
1484 1485
1485 RenderThread::Get()->Send( 1486 RenderThread::Get()->Send(
1486 new ViewHostMsg_CreateWindow(params, 1487 new ViewHostMsg_CreateWindow(params,
1487 &routing_id, 1488 &routing_id,
1488 &surface_id, 1489 &surface_id,
1489 &cloned_session_storage_namespace_id)); 1490 &cloned_session_storage_namespace_id,
1491 &no_js_access));
1490 if (routing_id == MSG_ROUTING_NONE) 1492 if (routing_id == MSG_ROUTING_NONE)
1491 return NULL; 1493 return NULL;
1492 1494
1493 // TODO(fsamuel): The host renderer needs to be able to control whether 1495 // TODO(fsamuel): The host renderer needs to be able to control whether
Andrew T Wilson (Slow) 2012/03/26 15:28:10 Naive question - what happens if we don't do all o
Charlie Reis 2012/03/26 17:56:51 Wouldn't that mean that no WebKit Frame is created
Mihai Parparita -not on Chrome 2012/03/27 01:16:07 Thanks for the pointer to this. I've changed this
1494 // the guest renderer is allowed to do this or not. This current 1496 // the guest renderer is allowed to do this or not. This current
1495 // behavior is not well defined. 1497 // behavior is not well defined.
1496 RenderViewImpl* view = RenderViewImpl::Create( 1498 RenderViewImpl* view = RenderViewImpl::Create(
1497 0, 1499 0,
1498 routing_id_, 1500 routing_id_,
1499 renderer_preferences_, 1501 renderer_preferences_,
1500 webkit_preferences_, 1502 webkit_preferences_,
1501 shared_popup_counter_, 1503 shared_popup_counter_,
1502 routing_id, 1504 routing_id,
1503 surface_id, 1505 surface_id,
(...skipping 10 matching lines...) Expand all
1514 // Record the security origin of the creator. 1516 // Record the security origin of the creator.
1515 GURL creator_url(creator->document().securityOrigin().toString().utf8()); 1517 GURL creator_url(creator->document().securityOrigin().toString().utf8());
1516 if (!creator_url.is_valid() || !creator_url.IsStandard()) 1518 if (!creator_url.is_valid() || !creator_url.IsStandard())
1517 creator_url = GURL(); 1519 creator_url = GURL();
1518 view->creator_url_ = creator_url; 1520 view->creator_url_ = creator_url;
1519 1521
1520 // Copy over the alternate error page URL so we can have alt error pages in 1522 // Copy over the alternate error page URL so we can have alt error pages in
1521 // the new render view (we don't need the browser to send the URL back down). 1523 // the new render view (we don't need the browser to send the URL back down).
1522 view->alternate_error_page_url_ = alternate_error_page_url_; 1524 view->alternate_error_page_url_ = alternate_error_page_url_;
1523 1525
1524 return view->webview(); 1526 return no_js_access ? NULL : view->webview();
1525 } 1527 }
1526 1528
1527 WebWidget* RenderViewImpl::createPopupMenu(WebKit::WebPopupType popup_type) { 1529 WebWidget* RenderViewImpl::createPopupMenu(WebKit::WebPopupType popup_type) {
1528 RenderWidget* widget = 1530 RenderWidget* widget =
1529 RenderWidget::Create(routing_id_, popup_type, screen_info_); 1531 RenderWidget::Create(routing_id_, popup_type, screen_info_);
1530 return widget->webwidget(); 1532 return widget->webwidget();
1531 } 1533 }
1532 1534
1533 WebWidget* RenderViewImpl::createPopupMenu(const WebPopupMenuInfo& info) { 1535 WebWidget* RenderViewImpl::createPopupMenu(const WebPopupMenuInfo& info) {
1534 // TODO(jcivelli): Remove this deprecated method when its been removed from 1536 // TODO(jcivelli): Remove this deprecated method when its been removed from
(...skipping 3671 matching lines...) Expand 10 before | Expand all | Expand 10 after
5206 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { 5208 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const {
5207 return !!RenderThreadImpl::current()->compositor_thread(); 5209 return !!RenderThreadImpl::current()->compositor_thread();
5208 } 5210 }
5209 5211
5210 void RenderViewImpl::OnJavaBridgeInit() { 5212 void RenderViewImpl::OnJavaBridgeInit() {
5211 DCHECK(!java_bridge_dispatcher_.get()); 5213 DCHECK(!java_bridge_dispatcher_.get());
5212 #if defined(ENABLE_JAVA_BRIDGE) 5214 #if defined(ENABLE_JAVA_BRIDGE)
5213 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this)); 5215 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this));
5214 #endif 5216 #endif
5215 } 5217 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698