| 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 RenderFrameHostImpl* render_frame_host, | 184 RenderFrameHostImpl* render_frame_host, |
| 185 const GURL& url, | 185 const GURL& url, |
| 186 bool is_transition_navigation) { | 186 bool is_transition_navigation) { |
| 187 bool is_error_page = (url.spec() == kUnreachableWebDataURL); | 187 bool is_error_page = (url.spec() == kUnreachableWebDataURL); |
| 188 bool is_iframe_srcdoc = (url.spec() == kAboutSrcDocURL); | 188 bool is_iframe_srcdoc = (url.spec() == kAboutSrcDocURL); |
| 189 GURL validated_url(url); | 189 GURL validated_url(url); |
| 190 RenderProcessHost* render_process_host = render_frame_host->GetProcess(); | 190 RenderProcessHost* render_process_host = render_frame_host->GetProcess(); |
| 191 render_process_host->FilterURL(false, &validated_url); | 191 render_process_host->FilterURL(false, &validated_url); |
| 192 | 192 |
| 193 bool is_main_frame = render_frame_host->frame_tree_node()->IsMainFrame(); | 193 bool is_main_frame = render_frame_host->frame_tree_node()->IsMainFrame(); |
| 194 NavigationEntryImpl* pending_entry = | 194 NavigationEntryImpl* pending_entry = controller_->GetPendingEntry(); |
| 195 NavigationEntryImpl::FromNavigationEntry(controller_->GetPendingEntry()); | |
| 196 if (is_main_frame) { | 195 if (is_main_frame) { |
| 197 // If there is no browser-initiated pending entry for this navigation and it | 196 // If there is no browser-initiated pending entry for this navigation and it |
| 198 // is not for the error URL, create a pending entry using the current | 197 // is not for the error URL, create a pending entry using the current |
| 199 // SiteInstance, and ensure the address bar updates accordingly. We don't | 198 // SiteInstance, and ensure the address bar updates accordingly. We don't |
| 200 // know the referrer or extra headers at this point, but the referrer will | 199 // know the referrer or extra headers at this point, but the referrer will |
| 201 // be set properly upon commit. | 200 // be set properly upon commit. |
| 202 bool has_browser_initiated_pending_entry = pending_entry && | 201 bool has_browser_initiated_pending_entry = pending_entry && |
| 203 !pending_entry->is_renderer_initiated(); | 202 !pending_entry->is_renderer_initiated(); |
| 204 if (!has_browser_initiated_pending_entry && !is_error_page) { | 203 if (!has_browser_initiated_pending_entry && !is_error_page) { |
| 205 NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry( | 204 NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry( |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 entry.GetURL(), | 413 entry.GetURL(), |
| 415 reload_type); | 414 reload_type); |
| 416 } | 415 } |
| 417 | 416 |
| 418 return true; | 417 return true; |
| 419 } | 418 } |
| 420 | 419 |
| 421 bool NavigatorImpl::NavigateToPendingEntry( | 420 bool NavigatorImpl::NavigateToPendingEntry( |
| 422 FrameTreeNode* frame_tree_node, | 421 FrameTreeNode* frame_tree_node, |
| 423 NavigationController::ReloadType reload_type) { | 422 NavigationController::ReloadType reload_type) { |
| 424 return NavigateToEntry( | 423 return NavigateToEntry(frame_tree_node, *controller_->GetPendingEntry(), |
| 425 frame_tree_node, | 424 reload_type); |
| 426 *NavigationEntryImpl::FromNavigationEntry(controller_->GetPendingEntry()), | |
| 427 reload_type); | |
| 428 } | 425 } |
| 429 | 426 |
| 430 void NavigatorImpl::DidNavigate( | 427 void NavigatorImpl::DidNavigate( |
| 431 RenderFrameHostImpl* render_frame_host, | 428 RenderFrameHostImpl* render_frame_host, |
| 432 const FrameHostMsg_DidCommitProvisionalLoad_Params& input_params) { | 429 const FrameHostMsg_DidCommitProvisionalLoad_Params& input_params) { |
| 433 // PlzNavigate | 430 // PlzNavigate |
| 434 // The navigation request has been committed so the browser process doesn't | 431 // The navigation request has been committed so the browser process doesn't |
| 435 // need to care about it anymore. | 432 // need to care about it anymore. |
| 436 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 433 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 437 switches::kEnableBrowserSideNavigation)) { | 434 switches::kEnableBrowserSideNavigation)) { |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted", | 923 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted", |
| 927 time_to_commit); | 924 time_to_commit); |
| 928 UMA_HISTOGRAM_TIMES( | 925 UMA_HISTOGRAM_TIMES( |
| 929 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted", | 926 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted", |
| 930 time_to_network); | 927 time_to_network); |
| 931 } | 928 } |
| 932 navigation_data_.reset(); | 929 navigation_data_.reset(); |
| 933 } | 930 } |
| 934 | 931 |
| 935 } // namespace content | 932 } // namespace content |
| OLD | NEW |