| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 112 NavigatorDelegate* NavigatorImpl::GetDelegate() { | 112 NavigatorDelegate* NavigatorImpl::GetDelegate() { | 
| 113   return delegate_; | 113   return delegate_; | 
| 114 } | 114 } | 
| 115 | 115 | 
| 116 NavigationController* NavigatorImpl::GetController() { | 116 NavigationController* NavigatorImpl::GetController() { | 
| 117   return controller_; | 117   return controller_; | 
| 118 } | 118 } | 
| 119 | 119 | 
| 120 void NavigatorImpl::DidStartProvisionalLoad( | 120 void NavigatorImpl::DidStartProvisionalLoad( | 
| 121     RenderFrameHostImpl* render_frame_host, | 121     RenderFrameHostImpl* render_frame_host, | 
| 122     const GURL& url) { | 122     const GURL& url, | 
|  | 123     const base::TimeTicks& navigation_start) { | 
| 123   bool is_main_frame = render_frame_host->frame_tree_node()->IsMainFrame(); | 124   bool is_main_frame = render_frame_host->frame_tree_node()->IsMainFrame(); | 
| 124   bool is_error_page = (url.spec() == kUnreachableWebDataURL); | 125   bool is_error_page = (url.spec() == kUnreachableWebDataURL); | 
| 125   bool is_iframe_srcdoc = (url.spec() == kAboutSrcDocURL); | 126   bool is_iframe_srcdoc = (url.spec() == kAboutSrcDocURL); | 
| 126   GURL validated_url(url); | 127   GURL validated_url(url); | 
| 127   RenderProcessHost* render_process_host = render_frame_host->GetProcess(); | 128   RenderProcessHost* render_process_host = render_frame_host->GetProcess(); | 
| 128   render_process_host->FilterURL(false, &validated_url); | 129   render_process_host->FilterURL(false, &validated_url); | 
| 129 | 130 | 
| 130   if (is_main_frame && !is_error_page) { | 131   if (is_main_frame && !is_error_page) { | 
| 131     DidStartMainFrameNavigation(validated_url, | 132     DidStartMainFrameNavigation(validated_url, | 
| 132                                 render_frame_host->GetSiteInstance()); | 133                                 render_frame_host->GetSiteInstance()); | 
| (...skipping 20 matching lines...) Expand all  Loading... | 
| 153       return; | 154       return; | 
| 154     } | 155     } | 
| 155 | 156 | 
| 156     // This ensures that notifications about the end of the previous | 157     // This ensures that notifications about the end of the previous | 
| 157     // navigation are sent before notifications about the start of the | 158     // navigation are sent before notifications about the start of the | 
| 158     // new navigation. | 159     // new navigation. | 
| 159     render_frame_host->SetNavigationHandle(scoped_ptr<NavigationHandleImpl>()); | 160     render_frame_host->SetNavigationHandle(scoped_ptr<NavigationHandleImpl>()); | 
| 160   } | 161   } | 
| 161 | 162 | 
| 162   render_frame_host->SetNavigationHandle(NavigationHandleImpl::Create( | 163   render_frame_host->SetNavigationHandle(NavigationHandleImpl::Create( | 
| 163       validated_url, render_frame_host->frame_tree_node())); | 164       validated_url, render_frame_host->frame_tree_node(), navigation_start)); | 
| 164 } | 165 } | 
| 165 | 166 | 
| 166 void NavigatorImpl::DidFailProvisionalLoadWithError( | 167 void NavigatorImpl::DidFailProvisionalLoadWithError( | 
| 167     RenderFrameHostImpl* render_frame_host, | 168     RenderFrameHostImpl* render_frame_host, | 
| 168     const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { | 169     const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { | 
| 169   VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() | 170   VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() | 
| 170           << ", error_code: " << params.error_code | 171           << ", error_code: " << params.error_code | 
| 171           << ", error_description: " << params.error_description | 172           << ", error_description: " << params.error_description | 
| 172           << ", showing_repost_interstitial: " << | 173           << ", showing_repost_interstitial: " << | 
| 173             params.showing_repost_interstitial | 174             params.showing_repost_interstitial | 
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 334                                                      entry.restore_type())); | 335                                                      entry.restore_type())); | 
| 335     // Create the navigation parameters. | 336     // Create the navigation parameters. | 
| 336     FrameMsg_Navigate_Type::Value navigation_type = | 337     FrameMsg_Navigate_Type::Value navigation_type = | 
| 337         GetNavigationType(controller_->GetBrowserContext(), entry, reload_type); | 338         GetNavigationType(controller_->GetBrowserContext(), entry, reload_type); | 
| 338     LoFiState lofi_state = | 339     LoFiState lofi_state = | 
| 339         (reload_type == | 340         (reload_type == | 
| 340                  NavigationController::ReloadType::RELOAD_DISABLE_LOFI_MODE | 341                  NavigationController::ReloadType::RELOAD_DISABLE_LOFI_MODE | 
| 341              ? LOFI_OFF | 342              ? LOFI_OFF | 
| 342              : LOFI_UNSPECIFIED); | 343              : LOFI_UNSPECIFIED); | 
| 343     dest_render_frame_host->Navigate( | 344     dest_render_frame_host->Navigate( | 
| 344         entry.ConstructCommonNavigationParams( | 345         entry.ConstructCommonNavigationParams(dest_url, dest_referrer, | 
| 345             dest_url, dest_referrer, frame_entry, navigation_type, lofi_state), | 346                                               frame_entry, navigation_type, | 
|  | 347                                               lofi_state, navigation_start), | 
| 346         entry.ConstructStartNavigationParams(), | 348         entry.ConstructStartNavigationParams(), | 
| 347         entry.ConstructRequestNavigationParams( | 349         entry.ConstructRequestNavigationParams( | 
| 348             frame_entry, navigation_start, is_same_document_history_load, | 350             frame_entry, is_same_document_history_load, | 
| 349             frame_tree_node->has_committed_real_load(), | 351             frame_tree_node->has_committed_real_load(), | 
| 350             controller_->GetPendingEntryIndex() == -1, | 352             controller_->GetPendingEntryIndex() == -1, | 
| 351             controller_->GetIndexOfEntry(&entry), | 353             controller_->GetIndexOfEntry(&entry), | 
| 352             controller_->GetLastCommittedEntryIndex(), | 354             controller_->GetLastCommittedEntryIndex(), | 
| 353             controller_->GetEntryCount())); | 355             controller_->GetEntryCount())); | 
| 354   } else { | 356   } else { | 
| 355     // No need to navigate again.  Just resume the deferred request. | 357     // No need to navigate again.  Just resume the deferred request. | 
| 356     dest_render_frame_host->GetProcess()->ResumeDeferredNavigation( | 358     dest_render_frame_host->GetProcess()->ResumeDeferredNavigation( | 
| 357         entry.transferred_global_request_id()); | 359         entry.transferred_global_request_id()); | 
| 358   } | 360   } | 
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 952       entry->set_should_replace_entry(pending_entry->should_replace_entry()); | 954       entry->set_should_replace_entry(pending_entry->should_replace_entry()); | 
| 953       entry->SetRedirectChain(pending_entry->GetRedirectChain()); | 955       entry->SetRedirectChain(pending_entry->GetRedirectChain()); | 
| 954     } | 956     } | 
| 955     controller_->SetPendingEntry(entry.Pass()); | 957     controller_->SetPendingEntry(entry.Pass()); | 
| 956     if (delegate_) | 958     if (delegate_) | 
| 957       delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); | 959       delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); | 
| 958   } | 960   } | 
| 959 } | 961 } | 
| 960 | 962 | 
| 961 }  // namespace content | 963 }  // namespace content | 
| OLD | NEW | 
|---|