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

Side by Side Diff: content/browser/frame_host/navigator_impl.cc

Issue 187843005: Remove stale frame ID references for RequestTransferURL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove incorrect check. Created 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/frame_host/navigator_impl.h" 5 #include "content/browser/frame_host/navigator_impl.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "content/browser/frame_host/frame_tree.h" 8 #include "content/browser/frame_host/frame_tree.h"
9 #include "content/browser/frame_host/frame_tree_node.h" 9 #include "content/browser/frame_host/frame_tree_node.h"
10 #include "content/browser/frame_host/navigation_controller_impl.h" 10 #include "content/browser/frame_host/navigation_controller_impl.h"
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 // The embedder will then have the opportunity to determine if the URL 536 // The embedder will then have the opportunity to determine if the URL
537 // should "use up" the SiteInstance. 537 // should "use up" the SiteInstance.
538 return GetContentClient()->browser()->ShouldAssignSiteForURL(url); 538 return GetContentClient()->browser()->ShouldAssignSiteForURL(url);
539 } 539 }
540 540
541 void NavigatorImpl::RequestOpenURL( 541 void NavigatorImpl::RequestOpenURL(
542 RenderFrameHostImpl* render_frame_host, 542 RenderFrameHostImpl* render_frame_host,
543 const GURL& url, 543 const GURL& url,
544 const Referrer& referrer, 544 const Referrer& referrer,
545 WindowOpenDisposition disposition, 545 WindowOpenDisposition disposition,
546 int64 source_frame_id,
547 bool should_replace_current_entry, 546 bool should_replace_current_entry,
548 bool user_gesture) { 547 bool user_gesture) {
549 SiteInstance* current_site_instance = 548 SiteInstance* current_site_instance =
550 GetRenderManager(render_frame_host)->current_frame_host()-> 549 GetRenderManager(render_frame_host)->current_frame_host()->
551 GetSiteInstance(); 550 GetSiteInstance();
552 // If this came from a swapped out RenderViewHost, we only allow the request 551 // If this came from a swapped out RenderViewHost, we only allow the request
553 // if we are still in the same BrowsingInstance. 552 // if we are still in the same BrowsingInstance.
554 if (render_frame_host->render_view_host()->IsSwappedOut() && 553 if (render_frame_host->render_view_host()->IsSwappedOut() &&
555 !render_frame_host->GetSiteInstance()->IsRelatedSiteInstance( 554 !render_frame_host->GetSiteInstance()->IsRelatedSiteInstance(
556 current_site_instance)) { 555 current_site_instance)) {
557 return; 556 return;
558 } 557 }
559 558
560 // Delegate to RequestTransferURL because this is just the generic 559 // Delegate to RequestTransferURL because this is just the generic
561 // case where |old_request_id| is empty. 560 // case where |old_request_id| is empty.
562 // TODO(creis): Pass the redirect_chain into this method to support client 561 // TODO(creis): Pass the redirect_chain into this method to support client
563 // redirects. http://crbug.com/311721. 562 // redirects. http://crbug.com/311721.
564 std::vector<GURL> redirect_chain; 563 std::vector<GURL> redirect_chain;
565 RequestTransferURL( 564 RequestTransferURL(
566 render_frame_host, url, redirect_chain, referrer, PAGE_TRANSITION_LINK, 565 render_frame_host, url, redirect_chain, referrer, PAGE_TRANSITION_LINK,
567 disposition, source_frame_id, GlobalRequestID(), 566 disposition, GlobalRequestID(),
568 should_replace_current_entry, user_gesture); 567 should_replace_current_entry, user_gesture);
569 } 568 }
570 569
571 void NavigatorImpl::RequestTransferURL( 570 void NavigatorImpl::RequestTransferURL(
572 RenderFrameHostImpl* render_frame_host, 571 RenderFrameHostImpl* render_frame_host,
573 const GURL& url, 572 const GURL& url,
574 const std::vector<GURL>& redirect_chain, 573 const std::vector<GURL>& redirect_chain,
575 const Referrer& referrer, 574 const Referrer& referrer,
576 PageTransition page_transition, 575 PageTransition page_transition,
577 WindowOpenDisposition disposition, 576 WindowOpenDisposition disposition,
578 int64 source_frame_id,
579 const GlobalRequestID& transferred_global_request_id, 577 const GlobalRequestID& transferred_global_request_id,
580 bool should_replace_current_entry, 578 bool should_replace_current_entry,
581 bool user_gesture) { 579 bool user_gesture) {
582 GURL dest_url(url); 580 GURL dest_url(url);
583 SiteInstance* current_site_instance = 581 SiteInstance* current_site_instance =
584 GetRenderManager(render_frame_host)->current_frame_host()-> 582 GetRenderManager(render_frame_host)->current_frame_host()->
585 GetSiteInstance(); 583 GetSiteInstance();
586 if (!GetContentClient()->browser()->ShouldAllowOpenURL( 584 if (!GetContentClient()->browser()->ShouldAllowOpenURL(
587 current_site_instance, url)) { 585 current_site_instance, url)) {
588 dest_url = GURL(kAboutBlankURL); 586 dest_url = GURL(kAboutBlankURL);
589 } 587 }
590 588
591 // Look up the FrameTreeNode ID corresponding to source_frame_id.
592 int64 frame_tree_node_id = -1; 589 int64 frame_tree_node_id = -1;
593 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess) && 590 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess)) {
594 source_frame_id != -1) { 591 frame_tree_node_id =
595 FrameTreeNode* source_node = 592 render_frame_host->frame_tree_node()->frame_tree_node_id();
596 render_frame_host->frame_tree_node()->frame_tree()->FindByRoutingID(
597 source_frame_id, transferred_global_request_id.child_id);
598 if (source_node)
599 frame_tree_node_id = source_node->frame_tree_node_id();
600 } 593 }
601 OpenURLParams params( 594 OpenURLParams params(
602 dest_url, referrer, source_frame_id, frame_tree_node_id, disposition, 595 dest_url, referrer, frame_tree_node_id, disposition, page_transition,
603 page_transition, true /* is_renderer_initiated */); 596 true /* is_renderer_initiated */);
604 if (redirect_chain.size() > 0) 597 if (redirect_chain.size() > 0)
605 params.redirect_chain = redirect_chain; 598 params.redirect_chain = redirect_chain;
606 params.transferred_global_request_id = transferred_global_request_id; 599 params.transferred_global_request_id = transferred_global_request_id;
607 params.should_replace_current_entry = should_replace_current_entry; 600 params.should_replace_current_entry = should_replace_current_entry;
608 params.user_gesture = user_gesture; 601 params.user_gesture = user_gesture;
609 602
610 if (GetRenderManager(render_frame_host)->web_ui()) { 603 if (GetRenderManager(render_frame_host)->web_ui()) {
611 // Web UI pages sometimes want to override the page transition type for 604 // Web UI pages sometimes want to override the page transition type for
612 // link clicks (e.g., so the new tab page can specify AUTO_BOOKMARK for 605 // link clicks (e.g., so the new tab page can specify AUTO_BOOKMARK for
613 // automatically generated suggestions). We don't override other types 606 // automatically generated suggestions). We don't override other types
614 // like TYPED because they have different implications (e.g., autocomplete). 607 // like TYPED because they have different implications (e.g., autocomplete).
615 if (PageTransitionCoreTypeIs(params.transition, PAGE_TRANSITION_LINK)) 608 if (PageTransitionCoreTypeIs(params.transition, PAGE_TRANSITION_LINK))
616 params.transition = 609 params.transition =
617 GetRenderManager(render_frame_host)->web_ui()-> 610 GetRenderManager(render_frame_host)->web_ui()->
618 GetLinkTransitionType(); 611 GetLinkTransitionType();
619 612
620 // Note also that we hide the referrer for Web UI pages. We don't really 613 // Note also that we hide the referrer for Web UI pages. We don't really
621 // want web sites to see a referrer of "chrome://blah" (and some 614 // want web sites to see a referrer of "chrome://blah" (and some
622 // chrome: URLs might have search terms or other stuff we don't want to 615 // chrome: URLs might have search terms or other stuff we don't want to
623 // send to the site), so we send no referrer. 616 // send to the site), so we send no referrer.
624 params.referrer = Referrer(); 617 params.referrer = Referrer();
625 618
626 // Navigations in Web UI pages count as browser-initiated navigations. 619 // Navigations in Web UI pages count as browser-initiated navigations.
627 params.is_renderer_initiated = false; 620 params.is_renderer_initiated = false;
628 } 621 }
629 622
630 if (delegate_) 623 if (delegate_)
631 delegate_->RequestOpenURL(params); 624 delegate_->RequestOpenURL(render_frame_host, params);
632 } 625 }
633 626
634 } // namespace content 627 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698