| 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 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 scoped_ptr<NavigationRequestInfo> info(new NavigationRequestInfo(params)); | 747 scoped_ptr<NavigationRequestInfo> info(new NavigationRequestInfo(params)); |
| 748 | 748 |
| 749 info->first_party_for_cookies = | 749 info->first_party_for_cookies = |
| 750 frame_tree_node->IsMainFrame() | 750 frame_tree_node->IsMainFrame() |
| 751 ? navigation_request->common_params().url | 751 ? navigation_request->common_params().url |
| 752 : frame_tree_node->frame_tree()->root()->current_url(); | 752 : frame_tree_node->frame_tree()->root()->current_url(); |
| 753 info->is_main_frame = frame_tree_node->IsMainFrame(); | 753 info->is_main_frame = frame_tree_node->IsMainFrame(); |
| 754 info->parent_is_main_frame = !frame_tree_node->parent() ? | 754 info->parent_is_main_frame = !frame_tree_node->parent() ? |
| 755 false : frame_tree_node->parent()->IsMainFrame(); | 755 false : frame_tree_node->parent()->IsMainFrame(); |
| 756 | 756 |
| 757 // TODO(clamy): Inform the RenderFrameHostManager that a navigation is about | 757 navigation_request->BeginNavigation(info.Pass(), params.request_body); |
| 758 // to begin, so that it can speculatively spawn a new renderer if needed. | |
| 759 | 758 |
| 760 navigation_request->BeginNavigation(info.Pass(), params.request_body); | 759 frame_tree_node->render_manager()->BeginNavigation(params, common_params); |
| 761 } | 760 } |
| 762 | 761 |
| 763 // PlzNavigate | 762 // PlzNavigate |
| 764 void NavigatorImpl::CommitNavigation(FrameTreeNode* frame_tree_node, | 763 void NavigatorImpl::CommitNavigation(FrameTreeNode* frame_tree_node, |
| 765 ResourceResponse* response, | 764 ResourceResponse* response, |
| 766 scoped_ptr<StreamHandle> body) { | 765 scoped_ptr<StreamHandle> body) { |
| 767 CHECK(CommandLine::ForCurrentProcess()->HasSwitch( | 766 CHECK(CommandLine::ForCurrentProcess()->HasSwitch( |
| 768 switches::kEnableBrowserSideNavigation)); | 767 switches::kEnableBrowserSideNavigation)); |
| 769 | 768 |
| 770 // HTTP 204 (No Content) and HTTP 205 (Reset Content) responses should not | 769 // HTTP 204 (No Content) and HTTP 205 (Reset Content) responses should not |
| (...skipping 20 matching lines...) Expand all Loading... |
| 791 render_frame_host->CommitNavigation(response, body.Pass(), | 790 render_frame_host->CommitNavigation(response, body.Pass(), |
| 792 navigation_request->common_params(), | 791 navigation_request->common_params(), |
| 793 navigation_request->commit_params()); | 792 navigation_request->commit_params()); |
| 794 } | 793 } |
| 795 | 794 |
| 796 // PlzNavigate | 795 // PlzNavigate |
| 797 void NavigatorImpl::CancelNavigation(FrameTreeNode* frame_tree_node) { | 796 void NavigatorImpl::CancelNavigation(FrameTreeNode* frame_tree_node) { |
| 798 CHECK(CommandLine::ForCurrentProcess()->HasSwitch( | 797 CHECK(CommandLine::ForCurrentProcess()->HasSwitch( |
| 799 switches::kEnableBrowserSideNavigation)); | 798 switches::kEnableBrowserSideNavigation)); |
| 800 navigation_request_map_.erase(frame_tree_node->frame_tree_node_id()); | 799 navigation_request_map_.erase(frame_tree_node->frame_tree_node_id()); |
| 800 frame_tree_node->render_manager()->CleanUpNavigation(); |
| 801 } | 801 } |
| 802 | 802 |
| 803 // PlzNavigate | 803 // PlzNavigate |
| 804 NavigationRequest* NavigatorImpl::GetNavigationRequestForNodeForTesting( | 804 NavigationRequest* NavigatorImpl::GetNavigationRequestForNodeForTesting( |
| 805 FrameTreeNode* frame_tree_node) { | 805 FrameTreeNode* frame_tree_node) { |
| 806 return navigation_request_map_.get(frame_tree_node->frame_tree_node_id()); | 806 return navigation_request_map_.get(frame_tree_node->frame_tree_node_id()); |
| 807 } | 807 } |
| 808 | 808 |
| 809 void NavigatorImpl::LogResourceRequestTime( | 809 void NavigatorImpl::LogResourceRequestTime( |
| 810 base::TimeTicks timestamp, const GURL& url) { | 810 base::TimeTicks timestamp, const GURL& url) { |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 938 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted", | 938 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted", |
| 939 time_to_commit); | 939 time_to_commit); |
| 940 UMA_HISTOGRAM_TIMES( | 940 UMA_HISTOGRAM_TIMES( |
| 941 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted", | 941 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted", |
| 942 time_to_network); | 942 time_to_network); |
| 943 } | 943 } |
| 944 navigation_data_.reset(); | 944 navigation_data_.reset(); |
| 945 } | 945 } |
| 946 | 946 |
| 947 } // namespace content | 947 } // namespace content |
| OLD | NEW |