| 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 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 | 507 |
| 508 // The embedder will then have the opportunity to determine if the URL | 508 // The embedder will then have the opportunity to determine if the URL |
| 509 // should "use up" the SiteInstance. | 509 // should "use up" the SiteInstance. |
| 510 return GetContentClient()->browser()->ShouldAssignSiteForURL(url); | 510 return GetContentClient()->browser()->ShouldAssignSiteForURL(url); |
| 511 } | 511 } |
| 512 | 512 |
| 513 void NavigatorImpl::RequestOpenURL(RenderFrameHostImpl* render_frame_host, | 513 void NavigatorImpl::RequestOpenURL(RenderFrameHostImpl* render_frame_host, |
| 514 const GURL& url, | 514 const GURL& url, |
| 515 SiteInstance* source_site_instance, | 515 SiteInstance* source_site_instance, |
| 516 const Referrer& referrer, | 516 const Referrer& referrer, |
| 517 ui::PageTransition page_transition, |
| 517 WindowOpenDisposition disposition, | 518 WindowOpenDisposition disposition, |
| 518 bool should_replace_current_entry, | 519 bool should_replace_current_entry, |
| 519 bool user_gesture) { | 520 bool user_gesture) { |
| 520 SiteInstance* current_site_instance = | 521 SiteInstance* current_site_instance = |
| 521 GetRenderManager(render_frame_host)->current_frame_host()-> | 522 GetRenderManager(render_frame_host)->current_frame_host()-> |
| 522 GetSiteInstance(); | 523 GetSiteInstance(); |
| 523 // If this came from a swapped out RenderFrameHost, we only allow the request | 524 // If this came from a swapped out RenderFrameHost, we only allow the request |
| 524 // if we are still in the same BrowsingInstance. | 525 // if we are still in the same BrowsingInstance. |
| 525 // TODO(creis): Move this to RenderFrameProxyHost::OpenURL. | 526 // TODO(creis): Move this to RenderFrameProxyHost::OpenURL. |
| 526 if (render_frame_host->is_swapped_out() && | 527 if (render_frame_host->is_swapped_out() && |
| 527 !render_frame_host->GetSiteInstance()->IsRelatedSiteInstance( | 528 !render_frame_host->GetSiteInstance()->IsRelatedSiteInstance( |
| 528 current_site_instance)) { | 529 current_site_instance)) { |
| 529 return; | 530 return; |
| 530 } | 531 } |
| 531 | 532 |
| 532 // Delegate to RequestTransferURL because this is just the generic | 533 // Delegate to RequestTransferURL because this is just the generic |
| 533 // case where |old_request_id| is empty. | 534 // case where |old_request_id| is empty. |
| 534 // TODO(creis): Pass the redirect_chain into this method to support client | 535 // TODO(creis): Pass the redirect_chain into this method to support client |
| 535 // redirects. http://crbug.com/311721. | 536 // redirects. http://crbug.com/311721. |
| 536 std::vector<GURL> redirect_chain; | 537 std::vector<GURL> redirect_chain; |
| 537 RequestTransferURL(render_frame_host, url, source_site_instance, | 538 RequestTransferURL(render_frame_host, url, source_site_instance, |
| 538 redirect_chain, referrer, ui::PAGE_TRANSITION_LINK, | 539 redirect_chain, referrer, page_transition, |
| 539 disposition, GlobalRequestID(), | 540 disposition, GlobalRequestID(), |
| 540 should_replace_current_entry, user_gesture); | 541 should_replace_current_entry, user_gesture); |
| 541 } | 542 } |
| 542 | 543 |
| 543 void NavigatorImpl::RequestTransferURL( | 544 void NavigatorImpl::RequestTransferURL( |
| 544 RenderFrameHostImpl* render_frame_host, | 545 RenderFrameHostImpl* render_frame_host, |
| 545 const GURL& url, | 546 const GURL& url, |
| 546 SiteInstance* source_site_instance, | 547 SiteInstance* source_site_instance, |
| 547 const std::vector<GURL>& redirect_chain, | 548 const std::vector<GURL>& redirect_chain, |
| 548 const Referrer& referrer, | 549 const Referrer& referrer, |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted", | 915 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted", |
| 915 time_to_commit); | 916 time_to_commit); |
| 916 UMA_HISTOGRAM_TIMES( | 917 UMA_HISTOGRAM_TIMES( |
| 917 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted", | 918 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted", |
| 918 time_to_network); | 919 time_to_network); |
| 919 } | 920 } |
| 920 navigation_data_.reset(); | 921 navigation_data_.reset(); |
| 921 } | 922 } |
| 922 | 923 |
| 923 } // namespace content | 924 } // namespace content |
| OLD | NEW |