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 1426403006: Reland #1 of: Move WebUI ownership from the RenderFrameHostManager to the RenderFrameHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re-add the pending WebUI to RFHI. Created 5 years, 1 month 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 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 const GURL& url, 569 const GURL& url,
570 SiteInstance* source_site_instance, 570 SiteInstance* source_site_instance,
571 const std::vector<GURL>& redirect_chain, 571 const std::vector<GURL>& redirect_chain,
572 const Referrer& referrer, 572 const Referrer& referrer,
573 ui::PageTransition page_transition, 573 ui::PageTransition page_transition,
574 WindowOpenDisposition disposition, 574 WindowOpenDisposition disposition,
575 const GlobalRequestID& transferred_global_request_id, 575 const GlobalRequestID& transferred_global_request_id,
576 bool should_replace_current_entry, 576 bool should_replace_current_entry,
577 bool user_gesture) { 577 bool user_gesture) {
578 GURL dest_url(url); 578 GURL dest_url(url);
579 RenderFrameHostImpl* current_render_frame_host =
580 GetRenderManager(render_frame_host)->current_frame_host();
579 SiteInstance* current_site_instance = 581 SiteInstance* current_site_instance =
580 GetRenderManager(render_frame_host)->current_frame_host()-> 582 current_render_frame_host->GetSiteInstance();
581 GetSiteInstance();
582 if (!GetContentClient()->browser()->ShouldAllowOpenURL( 583 if (!GetContentClient()->browser()->ShouldAllowOpenURL(
583 current_site_instance, url)) { 584 current_site_instance, url)) {
584 dest_url = GURL(url::kAboutBlankURL); 585 dest_url = GURL(url::kAboutBlankURL);
585 } 586 }
586 587
587 int frame_tree_node_id = -1; 588 int frame_tree_node_id = -1;
588 589
589 // Send the navigation to the current FrameTreeNode if it's destined for a 590 // Send the navigation to the current FrameTreeNode if it's destined for a
590 // subframe in the current tab. We'll assume it's for the main frame 591 // subframe in the current tab. We'll assume it's for the main frame
591 // (possibly of a new or different WebContents) otherwise. 592 // (possibly of a new or different WebContents) otherwise.
592 if (SiteIsolationPolicy::AreCrossProcessFramesPossible() && 593 if (SiteIsolationPolicy::AreCrossProcessFramesPossible() &&
593 disposition == CURRENT_TAB && render_frame_host->GetParent()) { 594 disposition == CURRENT_TAB && render_frame_host->GetParent()) {
594 frame_tree_node_id = 595 frame_tree_node_id =
595 render_frame_host->frame_tree_node()->frame_tree_node_id(); 596 render_frame_host->frame_tree_node()->frame_tree_node_id();
596 } 597 }
597 598
598 OpenURLParams params( 599 OpenURLParams params(
599 dest_url, referrer, frame_tree_node_id, disposition, page_transition, 600 dest_url, referrer, frame_tree_node_id, disposition, page_transition,
600 true /* is_renderer_initiated */); 601 true /* is_renderer_initiated */);
601 params.source_site_instance = source_site_instance; 602 params.source_site_instance = source_site_instance;
602 if (redirect_chain.size() > 0) 603 if (redirect_chain.size() > 0)
603 params.redirect_chain = redirect_chain; 604 params.redirect_chain = redirect_chain;
604 params.transferred_global_request_id = transferred_global_request_id; 605 params.transferred_global_request_id = transferred_global_request_id;
605 params.should_replace_current_entry = should_replace_current_entry; 606 params.should_replace_current_entry = should_replace_current_entry;
606 params.user_gesture = user_gesture; 607 params.user_gesture = user_gesture;
607 608
608 if (GetRenderManager(render_frame_host)->web_ui()) { 609 if (current_render_frame_host->web_ui()) {
609 // Web UI pages sometimes want to override the page transition type for 610 // Web UI pages sometimes want to override the page transition type for
610 // link clicks (e.g., so the new tab page can specify AUTO_BOOKMARK for 611 // link clicks (e.g., so the new tab page can specify AUTO_BOOKMARK for
611 // automatically generated suggestions). We don't override other types 612 // automatically generated suggestions). We don't override other types
612 // like TYPED because they have different implications (e.g., autocomplete). 613 // like TYPED because they have different implications (e.g., autocomplete).
613 if (ui::PageTransitionCoreTypeIs( 614 if (ui::PageTransitionCoreTypeIs(
614 params.transition, ui::PAGE_TRANSITION_LINK)) 615 params.transition, ui::PAGE_TRANSITION_LINK))
615 params.transition = 616 params.transition =
616 GetRenderManager(render_frame_host)->web_ui()-> 617 current_render_frame_host->web_ui()->GetLinkTransitionType();
617 GetLinkTransitionType();
618 618
619 // Note also that we hide the referrer for Web UI pages. We don't really 619 // Note also that we hide the referrer for Web UI pages. We don't really
620 // want web sites to see a referrer of "chrome://blah" (and some 620 // want web sites to see a referrer of "chrome://blah" (and some
621 // chrome: URLs might have search terms or other stuff we don't want to 621 // chrome: URLs might have search terms or other stuff we don't want to
622 // send to the site), so we send no referrer. 622 // send to the site), so we send no referrer.
623 params.referrer = Referrer(); 623 params.referrer = Referrer();
624 624
625 // Navigations in Web UI pages count as browser-initiated navigations. 625 // Navigations in Web UI pages count as browser-initiated navigations.
626 params.is_renderer_initiated = false; 626 params.is_renderer_initiated = false;
627 } 627 }
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 entry->set_should_replace_entry(pending_entry->should_replace_entry()); 954 entry->set_should_replace_entry(pending_entry->should_replace_entry());
955 entry->SetRedirectChain(pending_entry->GetRedirectChain()); 955 entry->SetRedirectChain(pending_entry->GetRedirectChain());
956 } 956 }
957 controller_->SetPendingEntry(entry.Pass()); 957 controller_->SetPendingEntry(entry.Pass());
958 if (delegate_) 958 if (delegate_)
959 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); 959 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL);
960 } 960 }
961 } 961 }
962 962
963 } // namespace content 963 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698