Chromium Code Reviews| 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 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 813 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( | 813 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 814 switches::kEnableBrowserSideNavigation)); | 814 switches::kEnableBrowserSideNavigation)); |
| 815 DCHECK(frame_tree_node); | 815 DCHECK(frame_tree_node); |
| 816 FrameMsg_Navigate_Type::Value navigation_type = | 816 FrameMsg_Navigate_Type::Value navigation_type = |
| 817 GetNavigationType(controller_->GetBrowserContext(), entry, reload_type); | 817 GetNavigationType(controller_->GetBrowserContext(), entry, reload_type); |
| 818 scoped_ptr<NavigationRequest> navigation_request = | 818 scoped_ptr<NavigationRequest> navigation_request = |
| 819 NavigationRequest::CreateBrowserInitiated(frame_tree_node, entry, | 819 NavigationRequest::CreateBrowserInitiated(frame_tree_node, entry, |
| 820 navigation_type, | 820 navigation_type, |
| 821 navigation_start, controller_); | 821 navigation_start, controller_); |
| 822 frame_tree_node->SetNavigationRequest(navigation_request.Pass()); | 822 frame_tree_node->SetNavigationRequest(navigation_request.Pass()); |
| 823 | 823 |
|
Fabrice (no longer in Chrome)
2015/05/29 12:37:08
nit: empty line here
clamy
2015/05/29 16:02:06
Done.
| |
| 824 frame_tree_node->navigation_request()->SetWaitingForRendererResponse(); | |
| 825 | |
| 824 // Have the current renderer execute its beforeUnload event if needed. If it | 826 // Have the current renderer execute its beforeUnload event if needed. If it |
| 825 // is not needed (eg. the renderer is not live), BeginNavigation should get | 827 // is not needed (eg. the renderer is not live), BeginNavigation should get |
| 826 // called. | 828 // called. If the navigation does not need to make a network request, then |
| 827 frame_tree_node->navigation_request()->SetWaitingForRendererResponse(); | 829 // start it synchronously. This is needed for Javascript urls. |
| 830 if (NavigationRequest::ShouldMakeNetworkRequest( | |
|
nasko
2015/05/29 14:17:46
In this particular codepath, it isn't really about
clamy
2015/05/29 16:02:06
Updated the comment.
| |
| 831 frame_tree_node->navigation_request()->common_params().url)) { | |
| 828 frame_tree_node->current_frame_host()->DispatchBeforeUnload(true); | 832 frame_tree_node->current_frame_host()->DispatchBeforeUnload(true); |
|
Fabrice (no longer in Chrome)
2015/05/29 12:37:08
nit: indent is wrong.
clamy
2015/05/29 16:02:06
Done.
| |
| 833 } else { | |
| 834 BeginNavigation(frame_tree_node); | |
|
nasko
2015/05/29 14:17:46
Why did data URLs work without this?
clamy
2015/05/29 16:02:06
Apparently no test tries to do a browser-intiated
nasko
2015/06/01 20:38:22
Maybe we should add one : ). I don't see a reason
clamy
2015/06/02 12:28:16
So after further investigation, it appears that we
| |
| 835 } | |
| 829 } | 836 } |
| 830 | 837 |
| 831 void NavigatorImpl::BeginNavigation(FrameTreeNode* frame_tree_node) { | 838 void NavigatorImpl::BeginNavigation(FrameTreeNode* frame_tree_node) { |
| 832 NavigationRequest* navigation_request = frame_tree_node->navigation_request(); | 839 NavigationRequest* navigation_request = frame_tree_node->navigation_request(); |
| 833 | 840 |
| 834 // A browser-initiated navigation could have been cancelled while it was | 841 // A browser-initiated navigation could have been cancelled while it was |
| 835 // waiting for the BeforeUnload event to execute. | 842 // waiting for the BeforeUnload event to execute. |
| 836 if (!navigation_request) | 843 if (!navigation_request) |
| 837 return; | 844 return; |
| 838 | 845 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 893 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted", | 900 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted", |
| 894 time_to_commit); | 901 time_to_commit); |
| 895 UMA_HISTOGRAM_TIMES( | 902 UMA_HISTOGRAM_TIMES( |
| 896 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted", | 903 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted", |
| 897 time_to_network); | 904 time_to_network); |
| 898 } | 905 } |
| 899 navigation_data_.reset(); | 906 navigation_data_.reset(); |
| 900 } | 907 } |
| 901 | 908 |
| 902 } // namespace content | 909 } // namespace content |
| OLD | NEW |