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

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

Issue 13846007: Allow showing pending URL for new tab navigations, but only if safe. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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_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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 bool swapped_out, 162 bool swapped_out,
163 SessionStorageNamespace* session_storage) 163 SessionStorageNamespace* session_storage)
164 : RenderWidgetHostImpl(widget_delegate, instance->GetProcess(), routing_id), 164 : RenderWidgetHostImpl(widget_delegate, instance->GetProcess(), routing_id),
165 delegate_(delegate), 165 delegate_(delegate),
166 instance_(static_cast<SiteInstanceImpl*>(instance)), 166 instance_(static_cast<SiteInstanceImpl*>(instance)),
167 waiting_for_drag_context_response_(false), 167 waiting_for_drag_context_response_(false),
168 enabled_bindings_(0), 168 enabled_bindings_(0),
169 pending_request_id_(-1), 169 pending_request_id_(-1),
170 navigations_suspended_(false), 170 navigations_suspended_(false),
171 suspended_nav_params_(NULL), 171 suspended_nav_params_(NULL),
172 has_accessed_initial_document_(false),
172 is_swapped_out_(swapped_out), 173 is_swapped_out_(swapped_out),
173 is_subframe_(false), 174 is_subframe_(false),
174 run_modal_reply_msg_(NULL), 175 run_modal_reply_msg_(NULL),
175 run_modal_opener_id_(MSG_ROUTING_NONE), 176 run_modal_opener_id_(MSG_ROUTING_NONE),
176 is_waiting_for_beforeunload_ack_(false), 177 is_waiting_for_beforeunload_ack_(false),
177 is_waiting_for_unload_ack_(false), 178 is_waiting_for_unload_ack_(false),
178 has_timed_out_on_unload_(false), 179 has_timed_out_on_unload_(false),
179 unload_ack_is_for_cross_site_transition_(false), 180 unload_ack_is_for_cross_site_transition_(false),
180 are_javascript_messages_suppressed_(false), 181 are_javascript_messages_suppressed_(false),
181 accessibility_layout_callback_(base::Bind(&base::DoNothing)), 182 accessibility_layout_callback_(base::Bind(&base::DoNothing)),
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_RequestPermission, 983 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_RequestPermission,
983 OnRequestDesktopNotificationPermission) 984 OnRequestDesktopNotificationPermission)
984 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Show, 985 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Show,
985 OnShowDesktopNotification) 986 OnShowDesktopNotification)
986 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Cancel, 987 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Cancel,
987 OnCancelDesktopNotification) 988 OnCancelDesktopNotification)
988 #if defined(OS_MACOSX) || defined(OS_ANDROID) 989 #if defined(OS_MACOSX) || defined(OS_ANDROID)
989 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowPopup, OnShowPopup) 990 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowPopup, OnShowPopup)
990 #endif 991 #endif
991 IPC_MESSAGE_HANDLER(ViewHostMsg_RunFileChooser, OnRunFileChooser) 992 IPC_MESSAGE_HANDLER(ViewHostMsg_RunFileChooser, OnRunFileChooser)
993 IPC_MESSAGE_HANDLER(ViewHostMsg_DidAccessInitialDocument,
994 OnDidAccessInitialDocument)
992 IPC_MESSAGE_HANDLER(ViewHostMsg_DomOperationResponse, 995 IPC_MESSAGE_HANDLER(ViewHostMsg_DomOperationResponse,
993 OnDomOperationResponse) 996 OnDomOperationResponse)
994 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Notifications, 997 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Notifications,
995 OnAccessibilityNotifications) 998 OnAccessibilityNotifications)
996 IPC_MESSAGE_HANDLER(ViewHostMsg_FrameTreeUpdated, OnFrameTreeUpdated) 999 IPC_MESSAGE_HANDLER(ViewHostMsg_FrameTreeUpdated, OnFrameTreeUpdated)
997 // Have the super handle all other messages. 1000 // Have the super handle all other messages.
998 IPC_MESSAGE_UNHANDLED( 1001 IPC_MESSAGE_UNHANDLED(
999 handled = RenderWidgetHostImpl::OnMessageReceived(msg)) 1002 handled = RenderWidgetHostImpl::OnMessageReceived(msg))
1000 IPC_END_MESSAGE_MAP_EX() 1003 IPC_END_MESSAGE_MAP_EX()
1001 1004
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1199 if (!SiteInstance::IsSameWebSite(GetSiteInstance()->GetBrowserContext(), 1202 if (!SiteInstance::IsSameWebSite(GetSiteInstance()->GetBrowserContext(),
1200 GetSiteInstance()->GetSiteURL(), 1203 GetSiteInstance()->GetSiteURL(),
1201 validated_params.url) || 1204 validated_params.url) ||
1202 static_cast<SiteInstanceImpl*>(GetSiteInstance())-> 1205 static_cast<SiteInstanceImpl*>(GetSiteInstance())->
1203 HasWrongProcessForURL(validated_params.url)) { 1206 HasWrongProcessForURL(validated_params.url)) {
1204 // TODO(nasko): Removed the actual kill process call until out-of-process 1207 // TODO(nasko): Removed the actual kill process call until out-of-process
1205 // iframes is ready to go. 1208 // iframes is ready to go.
1206 } 1209 }
1207 } 1210 }
1208 1211
1212 // Now that something has committed, we don't need to track whether the
1213 // initial page has been accessed.
1214 has_accessed_initial_document_ = false;
1215
1209 ChildProcessSecurityPolicyImpl* policy = 1216 ChildProcessSecurityPolicyImpl* policy =
1210 ChildProcessSecurityPolicyImpl::GetInstance(); 1217 ChildProcessSecurityPolicyImpl::GetInstance();
1211 // Without this check, an evil renderer can trick the browser into creating 1218 // Without this check, an evil renderer can trick the browser into creating
1212 // a navigation entry for a banned URL. If the user clicks the back button 1219 // a navigation entry for a banned URL. If the user clicks the back button
1213 // followed by the forward button (or clicks reload, or round-trips through 1220 // followed by the forward button (or clicks reload, or round-trips through
1214 // session restore, etc), we'll think that the browser commanded the 1221 // session restore, etc), we'll think that the browser commanded the
1215 // renderer to load the URL and grant the renderer the privileges to request 1222 // renderer to load the URL and grant the renderer the privileges to request
1216 // the URL. To prevent this attack, we block the renderer from inserting 1223 // the URL. To prevent this attack, we block the renderer from inserting
1217 // banned URLs into the navigation controller in the first place. 1224 // banned URLs into the navigation controller in the first place.
1218 FilterURL(policy, process, false, &validated_params.url); 1225 FilterURL(policy, process, false, &validated_params.url);
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
1991 1998
1992 void RenderViewHostImpl::OnCancelDesktopNotification(int notification_id) { 1999 void RenderViewHostImpl::OnCancelDesktopNotification(int notification_id) {
1993 GetContentClient()->browser()->CancelDesktopNotification( 2000 GetContentClient()->browser()->CancelDesktopNotification(
1994 GetProcess()->GetID(), GetRoutingID(), notification_id); 2001 GetProcess()->GetID(), GetRoutingID(), notification_id);
1995 } 2002 }
1996 2003
1997 void RenderViewHostImpl::OnRunFileChooser(const FileChooserParams& params) { 2004 void RenderViewHostImpl::OnRunFileChooser(const FileChooserParams& params) {
1998 delegate_->RunFileChooser(this, params); 2005 delegate_->RunFileChooser(this, params);
1999 } 2006 }
2000 2007
2008 void RenderViewHostImpl::OnDidAccessInitialDocument() {
2009 has_accessed_initial_document_ = true;
2010 delegate_->DidAccessInitialDocument();
2011 }
2012
2001 void RenderViewHostImpl::OnDomOperationResponse( 2013 void RenderViewHostImpl::OnDomOperationResponse(
2002 const std::string& json_string, int automation_id) { 2014 const std::string& json_string, int automation_id) {
2003 DomOperationNotificationDetails details(json_string, automation_id); 2015 DomOperationNotificationDetails details(json_string, automation_id);
2004 NotificationService::current()->Notify( 2016 NotificationService::current()->Notify(
2005 NOTIFICATION_DOM_OPERATION_RESPONSE, 2017 NOTIFICATION_DOM_OPERATION_RESPONSE,
2006 Source<RenderViewHost>(this), 2018 Source<RenderViewHost>(this),
2007 Details<DomOperationNotificationDetails>(&details)); 2019 Details<DomOperationNotificationDetails>(&details));
2008 } 2020 }
2009 2021
2010 void RenderViewHostImpl::OnFrameTreeUpdated(const std::string& frame_tree) { 2022 void RenderViewHostImpl::OnFrameTreeUpdated(const std::string& frame_tree) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
2062 is_waiting_for_beforeunload_ack_ = false; 2074 is_waiting_for_beforeunload_ack_ = false;
2063 is_waiting_for_unload_ack_ = false; 2075 is_waiting_for_unload_ack_ = false;
2064 has_timed_out_on_unload_ = false; 2076 has_timed_out_on_unload_ = false;
2065 } 2077 }
2066 2078
2067 void RenderViewHostImpl::ClearPowerSaveBlockers() { 2079 void RenderViewHostImpl::ClearPowerSaveBlockers() {
2068 STLDeleteValues(&power_save_blockers_); 2080 STLDeleteValues(&power_save_blockers_);
2069 } 2081 }
2070 2082
2071 } // namespace content 2083 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698