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