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

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

Issue 743773003: OOPIF: Data URLs are now rendered in the renderer that initiated the navigation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixing android compile Created 6 years 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
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 "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "content/browser/frame_host/frame_tree.h" 10 #include "content/browser/frame_host/frame_tree.h"
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 // about:blank should not "use up" a new SiteInstance. The SiteInstance can 619 // about:blank should not "use up" a new SiteInstance. The SiteInstance can
620 // still be used for a normal web site. 620 // still be used for a normal web site.
621 if (url == GURL(url::kAboutBlankURL)) 621 if (url == GURL(url::kAboutBlankURL))
622 return false; 622 return false;
623 623
624 // The embedder will then have the opportunity to determine if the URL 624 // The embedder will then have the opportunity to determine if the URL
625 // should "use up" the SiteInstance. 625 // should "use up" the SiteInstance.
626 return GetContentClient()->browser()->ShouldAssignSiteForURL(url); 626 return GetContentClient()->browser()->ShouldAssignSiteForURL(url);
627 } 627 }
628 628
629 void NavigatorImpl::RequestOpenURL( 629 void NavigatorImpl::RequestOpenURL(RenderFrameHostImpl* render_frame_host,
630 RenderFrameHostImpl* render_frame_host, 630 const GURL& url,
631 const GURL& url, 631 SiteInstance* source_site_instance,
632 const Referrer& referrer, 632 const Referrer& referrer,
633 WindowOpenDisposition disposition, 633 WindowOpenDisposition disposition,
634 bool should_replace_current_entry, 634 bool should_replace_current_entry,
635 bool user_gesture) { 635 bool user_gesture) {
636 SiteInstance* current_site_instance = 636 SiteInstance* current_site_instance =
637 GetRenderManager(render_frame_host)->current_frame_host()-> 637 GetRenderManager(render_frame_host)->current_frame_host()->
638 GetSiteInstance(); 638 GetSiteInstance();
639 // If this came from a swapped out RenderFrameHost, we only allow the request 639 // If this came from a swapped out RenderFrameHost, we only allow the request
640 // if we are still in the same BrowsingInstance. 640 // if we are still in the same BrowsingInstance.
641 // TODO(creis): Move this to RenderFrameProxyHost::OpenURL. 641 // TODO(creis): Move this to RenderFrameProxyHost::OpenURL.
642 if (render_frame_host->is_swapped_out() && 642 if (render_frame_host->is_swapped_out() &&
643 !render_frame_host->GetSiteInstance()->IsRelatedSiteInstance( 643 !render_frame_host->GetSiteInstance()->IsRelatedSiteInstance(
644 current_site_instance)) { 644 current_site_instance)) {
645 return; 645 return;
646 } 646 }
647 647
648 // Delegate to RequestTransferURL because this is just the generic 648 // Delegate to RequestTransferURL because this is just the generic
649 // case where |old_request_id| is empty. 649 // case where |old_request_id| is empty.
650 // TODO(creis): Pass the redirect_chain into this method to support client 650 // TODO(creis): Pass the redirect_chain into this method to support client
651 // redirects. http://crbug.com/311721. 651 // redirects. http://crbug.com/311721.
652 std::vector<GURL> redirect_chain; 652 std::vector<GURL> redirect_chain;
653 RequestTransferURL(render_frame_host, 653 RequestTransferURL(render_frame_host, url, source_site_instance,
654 url, 654 redirect_chain, referrer, ui::PAGE_TRANSITION_LINK,
655 redirect_chain, 655 disposition, GlobalRequestID(),
656 referrer, 656 should_replace_current_entry, user_gesture);
657 ui::PAGE_TRANSITION_LINK,
658 disposition,
659 GlobalRequestID(),
660 should_replace_current_entry,
661 user_gesture);
662 } 657 }
663 658
664 void NavigatorImpl::RequestTransferURL( 659 void NavigatorImpl::RequestTransferURL(
665 RenderFrameHostImpl* render_frame_host, 660 RenderFrameHostImpl* render_frame_host,
666 const GURL& url, 661 const GURL& url,
662 SiteInstance* source_site_instance,
667 const std::vector<GURL>& redirect_chain, 663 const std::vector<GURL>& redirect_chain,
668 const Referrer& referrer, 664 const Referrer& referrer,
669 ui::PageTransition page_transition, 665 ui::PageTransition page_transition,
670 WindowOpenDisposition disposition, 666 WindowOpenDisposition disposition,
671 const GlobalRequestID& transferred_global_request_id, 667 const GlobalRequestID& transferred_global_request_id,
672 bool should_replace_current_entry, 668 bool should_replace_current_entry,
673 bool user_gesture) { 669 bool user_gesture) {
674 GURL dest_url(url); 670 GURL dest_url(url);
675 SiteInstance* current_site_instance = 671 SiteInstance* current_site_instance =
676 GetRenderManager(render_frame_host)->current_frame_host()-> 672 GetRenderManager(render_frame_host)->current_frame_host()->
677 GetSiteInstance(); 673 GetSiteInstance();
678 if (!GetContentClient()->browser()->ShouldAllowOpenURL( 674 if (!GetContentClient()->browser()->ShouldAllowOpenURL(
679 current_site_instance, url)) { 675 current_site_instance, url)) {
680 dest_url = GURL(url::kAboutBlankURL); 676 dest_url = GURL(url::kAboutBlankURL);
681 } 677 }
682 678
683 int64 frame_tree_node_id = -1; 679 int64 frame_tree_node_id = -1;
684 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 680 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
685 switches::kSitePerProcess)) { 681 switches::kSitePerProcess)) {
686 frame_tree_node_id = 682 frame_tree_node_id =
687 render_frame_host->frame_tree_node()->frame_tree_node_id(); 683 render_frame_host->frame_tree_node()->frame_tree_node_id();
688 } 684 }
689 OpenURLParams params( 685 OpenURLParams params(
690 dest_url, referrer, frame_tree_node_id, disposition, page_transition, 686 dest_url, referrer, frame_tree_node_id, disposition, page_transition,
691 true /* is_renderer_initiated */); 687 true /* is_renderer_initiated */);
688 params.source_site_instance = source_site_instance;
692 if (redirect_chain.size() > 0) 689 if (redirect_chain.size() > 0)
693 params.redirect_chain = redirect_chain; 690 params.redirect_chain = redirect_chain;
694 params.transferred_global_request_id = transferred_global_request_id; 691 params.transferred_global_request_id = transferred_global_request_id;
695 params.should_replace_current_entry = should_replace_current_entry; 692 params.should_replace_current_entry = should_replace_current_entry;
696 params.user_gesture = user_gesture; 693 params.user_gesture = user_gesture;
697 694
698 if (GetRenderManager(render_frame_host)->web_ui()) { 695 if (GetRenderManager(render_frame_host)->web_ui()) {
699 // Web UI pages sometimes want to override the page transition type for 696 // Web UI pages sometimes want to override the page transition type for
700 // link clicks (e.g., so the new tab page can specify AUTO_BOOKMARK for 697 // link clicks (e.g., so the new tab page can specify AUTO_BOOKMARK for
701 // automatically generated suggestions). We don't override other types 698 // automatically generated suggestions). We don't override other types
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted", 945 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted",
949 time_to_commit); 946 time_to_commit);
950 UMA_HISTOGRAM_TIMES( 947 UMA_HISTOGRAM_TIMES(
951 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted", 948 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted",
952 time_to_network); 949 time_to_network);
953 } 950 }
954 navigation_data_.reset(); 951 navigation_data_.reset();
955 } 952 }
956 953
957 } // namespace content 954 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigator_impl.h ('k') | content/browser/frame_host/render_frame_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698