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

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

Issue 1540463002: Remove old GetRenderManager call from NavigatorImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "content/browser/frame_host/frame_tree.h" 9 #include "content/browser/frame_host/frame_tree.h"
10 #include "content/browser/frame_host/frame_tree_node.h" 10 #include "content/browser/frame_host/frame_tree_node.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 if (entry.restore_type() == 65 if (entry.restore_type() ==
66 NavigationEntryImpl::RESTORE_LAST_SESSION_EXITED_CLEANLY) { 66 NavigationEntryImpl::RESTORE_LAST_SESSION_EXITED_CLEANLY) {
67 if (entry.GetHasPostData()) 67 if (entry.GetHasPostData())
68 return FrameMsg_Navigate_Type::RESTORE_WITH_POST; 68 return FrameMsg_Navigate_Type::RESTORE_WITH_POST;
69 return FrameMsg_Navigate_Type::RESTORE; 69 return FrameMsg_Navigate_Type::RESTORE;
70 } 70 }
71 71
72 return FrameMsg_Navigate_Type::NORMAL; 72 return FrameMsg_Navigate_Type::NORMAL;
73 } 73 }
74 74
75 RenderFrameHostManager* GetRenderManager(RenderFrameHostImpl* rfh) {
76 if (SiteIsolationPolicy::AreCrossProcessFramesPossible())
77 return rfh->frame_tree_node()->render_manager();
78
79 return rfh->frame_tree_node()->frame_tree()->root()->render_manager();
80 }
81
82 } // namespace 75 } // namespace
83 76
84 struct NavigatorImpl::NavigationMetricsData { 77 struct NavigatorImpl::NavigationMetricsData {
85 NavigationMetricsData(base::TimeTicks start_time, 78 NavigationMetricsData(base::TimeTicks start_time,
86 GURL url, 79 GURL url,
87 NavigationEntryImpl::RestoreType restore_type) 80 NavigationEntryImpl::RestoreType restore_type)
88 : start_time_(start_time), url_(url) { 81 : start_time_(start_time), url_(url) {
89 is_restoring_from_last_session_ = 82 is_restoring_from_last_session_ =
90 (restore_type == 83 (restore_type ==
91 NavigationEntryImpl::RESTORE_LAST_SESSION_EXITED_CLEANLY || 84 NavigationEntryImpl::RESTORE_LAST_SESSION_EXITED_CLEANLY ||
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 return GetContentClient()->browser()->ShouldAssignSiteForURL(url); 548 return GetContentClient()->browser()->ShouldAssignSiteForURL(url);
556 } 549 }
557 550
558 void NavigatorImpl::RequestOpenURL(RenderFrameHostImpl* render_frame_host, 551 void NavigatorImpl::RequestOpenURL(RenderFrameHostImpl* render_frame_host,
559 const GURL& url, 552 const GURL& url,
560 SiteInstance* source_site_instance, 553 SiteInstance* source_site_instance,
561 const Referrer& referrer, 554 const Referrer& referrer,
562 WindowOpenDisposition disposition, 555 WindowOpenDisposition disposition,
563 bool should_replace_current_entry, 556 bool should_replace_current_entry,
564 bool user_gesture) { 557 bool user_gesture) {
565 SiteInstance* current_site_instance = 558 // This call only makes sense for subframes if OOPIFs are possible.
566 GetRenderManager(render_frame_host)->current_frame_host()-> 559 DCHECK(!render_frame_host->GetParent() ||
567 GetSiteInstance(); 560 SiteIsolationPolicy::AreCrossProcessFramesPossible());
561
568 // If this came from a swapped out RenderFrameHost, we only allow the request 562 // If this came from a swapped out RenderFrameHost, we only allow the request
569 // if we are still in the same BrowsingInstance. 563 // if we are still in the same BrowsingInstance.
570 // TODO(creis): Move this to RenderFrameProxyHost::OpenURL. 564 // TODO(creis): Move this to RenderFrameProxyHost::OpenURL.
565 SiteInstance* current_site_instance = render_frame_host->frame_tree_node()
566 ->current_frame_host()
567 ->GetSiteInstance();
571 if (render_frame_host->is_swapped_out() && 568 if (render_frame_host->is_swapped_out() &&
572 !render_frame_host->GetSiteInstance()->IsRelatedSiteInstance( 569 !render_frame_host->GetSiteInstance()->IsRelatedSiteInstance(
573 current_site_instance)) { 570 current_site_instance)) {
574 return; 571 return;
575 } 572 }
576 573
577 // TODO(creis): Pass the redirect_chain into this method to support client 574 // TODO(creis): Pass the redirect_chain into this method to support client
578 // redirects. http://crbug.com/311721. 575 // redirects. http://crbug.com/311721.
579 std::vector<GURL> redirect_chain; 576 std::vector<GURL> redirect_chain;
580 577
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 void NavigatorImpl::RequestTransferURL( 630 void NavigatorImpl::RequestTransferURL(
634 RenderFrameHostImpl* render_frame_host, 631 RenderFrameHostImpl* render_frame_host,
635 const GURL& url, 632 const GURL& url,
636 SiteInstance* source_site_instance, 633 SiteInstance* source_site_instance,
637 const std::vector<GURL>& redirect_chain, 634 const std::vector<GURL>& redirect_chain,
638 const Referrer& referrer, 635 const Referrer& referrer,
639 ui::PageTransition page_transition, 636 ui::PageTransition page_transition,
640 WindowOpenDisposition disposition, 637 WindowOpenDisposition disposition,
641 const GlobalRequestID& transferred_global_request_id, 638 const GlobalRequestID& transferred_global_request_id,
642 bool should_replace_current_entry) { 639 bool should_replace_current_entry) {
640 // This call only makes sense for subframes if OOPIFs are possible.
641 DCHECK(!render_frame_host->GetParent() ||
642 SiteIsolationPolicy::AreCrossProcessFramesPossible());
643
643 // Allow the delegate to cancel the transfer. 644 // Allow the delegate to cancel the transfer.
644 if (!delegate_->ShouldTransferNavigation()) 645 if (!delegate_->ShouldTransferNavigation())
645 return; 646 return;
646 647
647 GURL dest_url(url); 648 GURL dest_url(url);
648 Referrer referrer_to_use(referrer); 649 Referrer referrer_to_use(referrer);
649 FrameTreeNode* node = render_frame_host->frame_tree_node(); 650 FrameTreeNode* node = render_frame_host->frame_tree_node();
650 SiteInstance* current_site_instance = render_frame_host->GetSiteInstance(); 651 SiteInstance* current_site_instance = render_frame_host->GetSiteInstance();
651 if (!GetContentClient()->browser()->ShouldAllowOpenURL(current_site_instance, 652 if (!GetContentClient()->browser()->ShouldAllowOpenURL(current_site_instance,
652 url)) { 653 url)) {
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 entry->set_should_replace_entry(pending_entry->should_replace_entry()); 1012 entry->set_should_replace_entry(pending_entry->should_replace_entry());
1012 entry->SetRedirectChain(pending_entry->GetRedirectChain()); 1013 entry->SetRedirectChain(pending_entry->GetRedirectChain());
1013 } 1014 }
1014 controller_->SetPendingEntry(entry.Pass()); 1015 controller_->SetPendingEntry(entry.Pass());
1015 if (delegate_) 1016 if (delegate_)
1016 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); 1017 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL);
1017 } 1018 }
1018 } 1019 }
1019 1020
1020 } // namespace content 1021 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698