| 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 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(); | |
| 581 SiteInstance* current_site_instance = | 579 SiteInstance* current_site_instance = |
| 582 current_render_frame_host->GetSiteInstance(); | 580 GetRenderManager(render_frame_host)->current_frame_host()-> |
| 581 GetSiteInstance(); |
| 583 if (!GetContentClient()->browser()->ShouldAllowOpenURL( | 582 if (!GetContentClient()->browser()->ShouldAllowOpenURL( |
| 584 current_site_instance, url)) { | 583 current_site_instance, url)) { |
| 585 dest_url = GURL(url::kAboutBlankURL); | 584 dest_url = GURL(url::kAboutBlankURL); |
| 586 } | 585 } |
| 587 | 586 |
| 588 int frame_tree_node_id = -1; | 587 int frame_tree_node_id = -1; |
| 589 | 588 |
| 590 // 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 |
| 591 // 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 |
| 592 // (possibly of a new or different WebContents) otherwise. | 591 // (possibly of a new or different WebContents) otherwise. |
| 593 if (SiteIsolationPolicy::AreCrossProcessFramesPossible() && | 592 if (SiteIsolationPolicy::AreCrossProcessFramesPossible() && |
| 594 disposition == CURRENT_TAB && render_frame_host->GetParent()) { | 593 disposition == CURRENT_TAB && render_frame_host->GetParent()) { |
| 595 frame_tree_node_id = | 594 frame_tree_node_id = |
| 596 render_frame_host->frame_tree_node()->frame_tree_node_id(); | 595 render_frame_host->frame_tree_node()->frame_tree_node_id(); |
| 597 } | 596 } |
| 598 | 597 |
| 599 OpenURLParams params( | 598 OpenURLParams params( |
| 600 dest_url, referrer, frame_tree_node_id, disposition, page_transition, | 599 dest_url, referrer, frame_tree_node_id, disposition, page_transition, |
| 601 true /* is_renderer_initiated */); | 600 true /* is_renderer_initiated */); |
| 602 params.source_site_instance = source_site_instance; | 601 params.source_site_instance = source_site_instance; |
| 603 if (redirect_chain.size() > 0) | 602 if (redirect_chain.size() > 0) |
| 604 params.redirect_chain = redirect_chain; | 603 params.redirect_chain = redirect_chain; |
| 605 params.transferred_global_request_id = transferred_global_request_id; | 604 params.transferred_global_request_id = transferred_global_request_id; |
| 606 params.should_replace_current_entry = should_replace_current_entry; | 605 params.should_replace_current_entry = should_replace_current_entry; |
| 607 params.user_gesture = user_gesture; | 606 params.user_gesture = user_gesture; |
| 608 | 607 |
| 609 if (current_render_frame_host->web_ui()) { | 608 if (GetRenderManager(render_frame_host)->web_ui()) { |
| 610 // 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 |
| 611 // 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 |
| 612 // automatically generated suggestions). We don't override other types | 611 // automatically generated suggestions). We don't override other types |
| 613 // like TYPED because they have different implications (e.g., autocomplete). | 612 // like TYPED because they have different implications (e.g., autocomplete). |
| 614 if (ui::PageTransitionCoreTypeIs( | 613 if (ui::PageTransitionCoreTypeIs( |
| 615 params.transition, ui::PAGE_TRANSITION_LINK)) | 614 params.transition, ui::PAGE_TRANSITION_LINK)) |
| 616 params.transition = | 615 params.transition = |
| 617 current_render_frame_host->web_ui()->GetLinkTransitionType(); | 616 GetRenderManager(render_frame_host)->web_ui()-> |
| 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 Loading... |
| 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 |
| OLD | NEW |