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