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

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

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

Powered by Google App Engine
This is Rietveld 408576698