| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 return; | 170 return; |
| 171 } | 171 } |
| 172 | 172 |
| 173 // This ensures that notifications about the end of the previous | 173 // This ensures that notifications about the end of the previous |
| 174 // navigation are sent before notifications about the start of the | 174 // navigation are sent before notifications about the start of the |
| 175 // new navigation. | 175 // new navigation. |
| 176 render_frame_host->SetNavigationHandle( | 176 render_frame_host->SetNavigationHandle( |
| 177 std::unique_ptr<NavigationHandleImpl>()); | 177 std::unique_ptr<NavigationHandleImpl>()); |
| 178 } | 178 } |
| 179 | 179 |
| 180 NavigationEntry* pending_entry = controller_->GetPendingEntry(); | 180 // It is safer to assume navigations are renderer-initiated unless shown |
| 181 // otherwise. Browser navigations generally have more privileges, and they |
| 182 // should always have a pending NavigationEntry to distinguish them. |
| 183 bool is_renderer_initiated = true; |
| 184 int pending_nav_entry_id = 0; |
| 185 NavigationEntryImpl* pending_entry = controller_->GetPendingEntry(); |
| 186 if (pending_entry) { |
| 187 is_renderer_initiated = pending_entry->is_renderer_initiated(); |
| 188 pending_nav_entry_id = pending_entry->GetUniqueID(); |
| 189 } |
| 181 render_frame_host->SetNavigationHandle(NavigationHandleImpl::Create( | 190 render_frame_host->SetNavigationHandle(NavigationHandleImpl::Create( |
| 182 validated_url, render_frame_host->frame_tree_node(), | 191 validated_url, render_frame_host->frame_tree_node(), |
| 192 is_renderer_initiated, |
| 183 false, // is_synchronous | 193 false, // is_synchronous |
| 184 is_iframe_srcdoc, // is_srcdoc | 194 is_iframe_srcdoc, // is_srcdoc |
| 185 navigation_start, pending_entry ? pending_entry->GetUniqueID() : 0)); | 195 navigation_start, pending_nav_entry_id)); |
| 186 } | 196 } |
| 187 | 197 |
| 188 void NavigatorImpl::DidFailProvisionalLoadWithError( | 198 void NavigatorImpl::DidFailProvisionalLoadWithError( |
| 189 RenderFrameHostImpl* render_frame_host, | 199 RenderFrameHostImpl* render_frame_host, |
| 190 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { | 200 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { |
| 191 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() | 201 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() |
| 192 << ", error_code: " << params.error_code | 202 << ", error_code: " << params.error_code |
| 193 << ", error_description: " << params.error_description | 203 << ", error_description: " << params.error_description |
| 194 << ", showing_repost_interstitial: " << | 204 << ", showing_repost_interstitial: " << |
| 195 params.showing_repost_interstitial | 205 params.showing_repost_interstitial |
| (...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1154 if (pending_entry != controller_->GetVisibleEntry() || | 1164 if (pending_entry != controller_->GetVisibleEntry() || |
| 1155 !should_preserve_entry) { | 1165 !should_preserve_entry) { |
| 1156 controller_->DiscardPendingEntry(true); | 1166 controller_->DiscardPendingEntry(true); |
| 1157 | 1167 |
| 1158 // Also force the UI to refresh. | 1168 // Also force the UI to refresh. |
| 1159 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); | 1169 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); |
| 1160 } | 1170 } |
| 1161 } | 1171 } |
| 1162 | 1172 |
| 1163 } // namespace content | 1173 } // namespace content |
| OLD | NEW |