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

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 10873090: Consume user gestures when navigating in a new tab/window. This ensures that a site can not create … (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after
1620 return; 1620 return;
1621 1621
1622 Send(new ViewHostMsg_UpdateState( 1622 Send(new ViewHostMsg_UpdateState(
1623 routing_id_, page_id_, webkit_glue::HistoryItemToString(item))); 1623 routing_id_, page_id_, webkit_glue::HistoryItemToString(item)));
1624 } 1624 }
1625 1625
1626 void RenderViewImpl::OpenURL(WebFrame* frame, 1626 void RenderViewImpl::OpenURL(WebFrame* frame,
1627 const GURL& url, 1627 const GURL& url,
1628 const Referrer& referrer, 1628 const Referrer& referrer,
1629 WebNavigationPolicy policy) { 1629 WebNavigationPolicy policy) {
1630 if (frame->isProcessingUserGesture())
1631 frame->consumeUserGesture();
abarth-chromium 2012/08/27 19:46:05 Can we just call this unconditionally?
1632
1630 Send(new ViewHostMsg_OpenURL( 1633 Send(new ViewHostMsg_OpenURL(
1631 routing_id_, 1634 routing_id_,
1632 url, 1635 url,
1633 referrer, 1636 referrer,
1634 NavigationPolicyToDisposition(policy), 1637 NavigationPolicyToDisposition(policy),
1635 frame->identifier())); 1638 frame->identifier()));
1636 } 1639 }
1637 1640
1638 // WebViewDelegate ------------------------------------------------------------ 1641 // WebViewDelegate ------------------------------------------------------------
1639 1642
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1711 creator->document().securityOrigin().toString().utf8(); 1714 creator->document().securityOrigin().toString().utf8();
1712 params.opener_suppressed = creator->willSuppressOpenerInNewFrame(); 1715 params.opener_suppressed = creator->willSuppressOpenerInNewFrame();
1713 params.disposition = NavigationPolicyToDisposition(policy); 1716 params.disposition = NavigationPolicyToDisposition(policy);
1714 if (!request.isNull()) 1717 if (!request.isNull())
1715 params.target_url = request.url(); 1718 params.target_url = request.url();
1716 1719
1717 int32 routing_id = MSG_ROUTING_NONE; 1720 int32 routing_id = MSG_ROUTING_NONE;
1718 int32 surface_id = 0; 1721 int32 surface_id = 0;
1719 int64 cloned_session_storage_namespace_id; 1722 int64 cloned_session_storage_namespace_id;
1720 1723
1724 // Consume a user gesture if we have one.
1725 if (creator->isProcessingUserGesture())
1726 creator->consumeUserGesture();
abarth-chromium 2012/08/27 19:46:05 We need to do this both for OpenURL and createView
1727
1721 RenderThread::Get()->Send( 1728 RenderThread::Get()->Send(
1722 new ViewHostMsg_CreateWindow(params, 1729 new ViewHostMsg_CreateWindow(params,
1723 &routing_id, 1730 &routing_id,
1724 &surface_id, 1731 &surface_id,
1725 &cloned_session_storage_namespace_id)); 1732 &cloned_session_storage_namespace_id));
1726 if (routing_id == MSG_ROUTING_NONE) 1733 if (routing_id == MSG_ROUTING_NONE)
1727 return NULL; 1734 return NULL;
1728 1735
1729 // TODO(fsamuel): The host renderer needs to be able to control whether 1736 // TODO(fsamuel): The host renderer needs to be able to control whether
1730 // the guest renderer is allowed to do this or not. This current 1737 // the guest renderer is allowed to do this or not. This current
(...skipping 4154 matching lines...) Expand 10 before | Expand all | Expand 10 after
5885 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { 5892 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const {
5886 return !!RenderThreadImpl::current()->compositor_thread(); 5893 return !!RenderThreadImpl::current()->compositor_thread();
5887 } 5894 }
5888 5895
5889 void RenderViewImpl::OnJavaBridgeInit() { 5896 void RenderViewImpl::OnJavaBridgeInit() {
5890 DCHECK(!java_bridge_dispatcher_); 5897 DCHECK(!java_bridge_dispatcher_);
5891 #if defined(ENABLE_JAVA_BRIDGE) 5898 #if defined(ENABLE_JAVA_BRIDGE)
5892 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this); 5899 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this);
5893 #endif 5900 #endif
5894 } 5901 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698