| 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/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 return delegate_; | 132 return delegate_; |
| 133 } | 133 } |
| 134 | 134 |
| 135 NavigationController* NavigatorImpl::GetController() { | 135 NavigationController* NavigatorImpl::GetController() { |
| 136 return controller_; | 136 return controller_; |
| 137 } | 137 } |
| 138 | 138 |
| 139 void NavigatorImpl::DidStartProvisionalLoad( | 139 void NavigatorImpl::DidStartProvisionalLoad( |
| 140 RenderFrameHostImpl* render_frame_host, | 140 RenderFrameHostImpl* render_frame_host, |
| 141 const GURL& url, | 141 const GURL& url, |
| 142 const std::vector<GURL>& redirect_chain, |
| 142 const base::TimeTicks& navigation_start) { | 143 const base::TimeTicks& navigation_start) { |
| 143 bool is_main_frame = render_frame_host->frame_tree_node()->IsMainFrame(); | 144 bool is_main_frame = render_frame_host->frame_tree_node()->IsMainFrame(); |
| 144 bool is_error_page = (url.spec() == kUnreachableWebDataURL); | 145 bool is_error_page = (url.spec() == kUnreachableWebDataURL); |
| 145 GURL validated_url(url); | 146 GURL validated_url(url); |
| 146 RenderProcessHost* render_process_host = render_frame_host->GetProcess(); | 147 RenderProcessHost* render_process_host = render_frame_host->GetProcess(); |
| 147 render_process_host->FilterURL(false, &validated_url); | 148 render_process_host->FilterURL(false, &validated_url); |
| 148 | 149 |
| 149 // Do not allow browser plugin guests to navigate to non-web URLs, since they | 150 // Do not allow browser plugin guests to navigate to non-web URLs, since they |
| 150 // cannot swap processes or grant bindings. | 151 // cannot swap processes or grant bindings. |
| 151 ChildProcessSecurityPolicyImpl* policy = | 152 ChildProcessSecurityPolicyImpl* policy = |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 bool is_renderer_initiated = true; | 193 bool is_renderer_initiated = true; |
| 193 int pending_nav_entry_id = 0; | 194 int pending_nav_entry_id = 0; |
| 194 bool started_from_context_menu = false; | 195 bool started_from_context_menu = false; |
| 195 NavigationEntryImpl* pending_entry = controller_->GetPendingEntry(); | 196 NavigationEntryImpl* pending_entry = controller_->GetPendingEntry(); |
| 196 if (pending_entry) { | 197 if (pending_entry) { |
| 197 is_renderer_initiated = pending_entry->is_renderer_initiated(); | 198 is_renderer_initiated = pending_entry->is_renderer_initiated(); |
| 198 pending_nav_entry_id = pending_entry->GetUniqueID(); | 199 pending_nav_entry_id = pending_entry->GetUniqueID(); |
| 199 started_from_context_menu = pending_entry->has_started_from_context_menu(); | 200 started_from_context_menu = pending_entry->has_started_from_context_menu(); |
| 200 } | 201 } |
| 201 | 202 |
| 203 std::vector<GURL> validated_redirect_chain = redirect_chain; |
| 204 for (size_t i = 0; i < validated_redirect_chain.size(); ++i) |
| 205 render_process_host->FilterURL(false, &validated_redirect_chain[i]); |
| 202 render_frame_host->SetNavigationHandle(NavigationHandleImpl::Create( | 206 render_frame_host->SetNavigationHandle(NavigationHandleImpl::Create( |
| 203 validated_url, render_frame_host->frame_tree_node(), | 207 validated_url, validated_redirect_chain, |
| 204 is_renderer_initiated, | 208 render_frame_host->frame_tree_node(), is_renderer_initiated, |
| 205 false, // is_same_page | 209 false, // is_same_page |
| 206 navigation_start, pending_nav_entry_id, | 210 navigation_start, pending_nav_entry_id, started_from_context_menu)); |
| 207 started_from_context_menu)); | |
| 208 } | 211 } |
| 209 | 212 |
| 210 void NavigatorImpl::DidFailProvisionalLoadWithError( | 213 void NavigatorImpl::DidFailProvisionalLoadWithError( |
| 211 RenderFrameHostImpl* render_frame_host, | 214 RenderFrameHostImpl* render_frame_host, |
| 212 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { | 215 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { |
| 213 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() | 216 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() |
| 214 << ", error_code: " << params.error_code | 217 << ", error_code: " << params.error_code |
| 215 << ", error_description: " << params.error_description | 218 << ", error_description: " << params.error_description |
| 216 << ", showing_repost_interstitial: " << | 219 << ", showing_repost_interstitial: " << |
| 217 params.showing_repost_interstitial | 220 params.showing_repost_interstitial |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 if (did_navigate && | 666 if (did_navigate && |
| 664 (controller_->GetLastCommittedEntry()->GetTransitionType() & | 667 (controller_->GetLastCommittedEntry()->GetTransitionType() & |
| 665 ui::PAGE_TRANSITION_FORWARD_BACK)) { | 668 ui::PAGE_TRANSITION_FORWARD_BACK)) { |
| 666 transition_type = ui::PageTransitionFromInt( | 669 transition_type = ui::PageTransitionFromInt( |
| 667 params.transition | ui::PAGE_TRANSITION_FORWARD_BACK); | 670 params.transition | ui::PAGE_TRANSITION_FORWARD_BACK); |
| 668 } | 671 } |
| 669 | 672 |
| 670 delegate_->DidCommitProvisionalLoad(render_frame_host, | 673 delegate_->DidCommitProvisionalLoad(render_frame_host, |
| 671 params.url, | 674 params.url, |
| 672 transition_type); | 675 transition_type); |
| 673 navigation_handle->DidCommitNavigation(params, is_navigation_within_page, | 676 navigation_handle->DidCommitNavigation(params, details.did_replace_entry, |
| 674 render_frame_host); | 677 render_frame_host); |
| 675 navigation_handle.reset(); | 678 navigation_handle.reset(); |
| 676 } | 679 } |
| 677 | 680 |
| 678 if (!did_navigate) | 681 if (!did_navigate) |
| 679 return; // No navigation happened. | 682 return; // No navigation happened. |
| 680 | 683 |
| 681 // DO NOT ADD MORE STUFF TO THIS FUNCTION! Your component should either listen | 684 // DO NOT ADD MORE STUFF TO THIS FUNCTION! Your component should either listen |
| 682 // for the appropriate notification (best) or you can add it to | 685 // for the appropriate notification (best) or you can add it to |
| 683 // DidNavigateMainFramePostCommit / DidNavigateAnyFramePostCommit (only if | 686 // DidNavigateMainFramePostCommit / DidNavigateAnyFramePostCommit (only if |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1268 if (navigation_handle) | 1271 if (navigation_handle) |
| 1269 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); | 1272 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); |
| 1270 | 1273 |
| 1271 controller_->SetPendingEntry(std::move(entry)); | 1274 controller_->SetPendingEntry(std::move(entry)); |
| 1272 if (delegate_) | 1275 if (delegate_) |
| 1273 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); | 1276 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); |
| 1274 } | 1277 } |
| 1275 } | 1278 } |
| 1276 | 1279 |
| 1277 } // namespace content | 1280 } // namespace content |
| OLD | NEW |