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