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