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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 10350013: Don't allow targeted navigations across BrowsingInstances. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 2317 matching lines...) Expand 10 before | Expand all | Expand 10 after
2328 2328
2329 void WebContentsImpl::DocumentOnLoadCompletedInMainFrame( 2329 void WebContentsImpl::DocumentOnLoadCompletedInMainFrame(
2330 RenderViewHost* render_view_host, 2330 RenderViewHost* render_view_host,
2331 int32 page_id) { 2331 int32 page_id) {
2332 content::NotificationService::current()->Notify( 2332 content::NotificationService::current()->Notify(
2333 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, 2333 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
2334 content::Source<WebContents>(this), 2334 content::Source<WebContents>(this),
2335 content::Details<int>(&page_id)); 2335 content::Details<int>(&page_id));
2336 } 2336 }
2337 2337
2338 void WebContentsImpl::RequestOpenURL(const GURL& url, 2338 void WebContentsImpl::RequestOpenURL(RenderViewHost* rvh,
2339 const GURL& url,
2339 const content::Referrer& referrer, 2340 const content::Referrer& referrer,
2340 WindowOpenDisposition disposition, 2341 WindowOpenDisposition disposition,
2341 int64 source_frame_id) { 2342 int64 source_frame_id) {
2343 // If this came from a swapped out RenderViewHost, we only allow the request
2344 // if we are still in the same BrowsingInstance.
2345 if (static_cast<RenderViewHostImpl*>(rvh)->is_swapped_out() &&
2346 !rvh->GetSiteInstance()->IsRelatedSiteInstance(GetSiteInstance())) {
2347 return;
2348 }
2349
2342 // Delegate to RequestTransferURL because this is just the generic 2350 // Delegate to RequestTransferURL because this is just the generic
2343 // case where |old_request_id| is empty. 2351 // case where |old_request_id| is empty.
2344 RequestTransferURL(url, referrer, disposition, source_frame_id, 2352 RequestTransferURL(url, referrer, disposition, source_frame_id,
2345 GlobalRequestID()); 2353 GlobalRequestID());
2346 } 2354 }
2347 2355
2348 void WebContentsImpl::RequestTransferURL( 2356 void WebContentsImpl::RequestTransferURL(
2349 const GURL& url, 2357 const GURL& url,
2350 const content::Referrer& referrer, 2358 const content::Referrer& referrer,
2351 WindowOpenDisposition disposition, 2359 WindowOpenDisposition disposition,
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
2697 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { 2705 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) {
2698 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); 2706 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh);
2699 // Can be NULL during tests. 2707 // Can be NULL during tests.
2700 if (rwh_view) 2708 if (rwh_view)
2701 rwh_view->SetSize(GetView()->GetContainerSize()); 2709 rwh_view->SetSize(GetView()->GetContainerSize());
2702 } 2710 }
2703 2711
2704 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { 2712 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() {
2705 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); 2713 return static_cast<RenderViewHostImpl*>(GetRenderViewHost());
2706 } 2714 }
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/public/browser/render_view_host_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698