| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 return delegate_; | 131 return delegate_; |
| 132 } | 132 } |
| 133 | 133 |
| 134 NavigationController* NavigatorImpl::GetController() { | 134 NavigationController* NavigatorImpl::GetController() { |
| 135 return controller_; | 135 return controller_; |
| 136 } | 136 } |
| 137 | 137 |
| 138 void NavigatorImpl::DidStartProvisionalLoad( | 138 void NavigatorImpl::DidStartProvisionalLoad( |
| 139 RenderFrameHostImpl* render_frame_host, | 139 RenderFrameHostImpl* render_frame_host, |
| 140 const GURL& url, | 140 const GURL& url, |
| 141 const std::vector<GURL>& redirect_chain, |
| 141 const base::TimeTicks& navigation_start) { | 142 const base::TimeTicks& navigation_start) { |
| 142 bool is_main_frame = render_frame_host->frame_tree_node()->IsMainFrame(); | 143 bool is_main_frame = render_frame_host->frame_tree_node()->IsMainFrame(); |
| 143 bool is_error_page = (url.spec() == kUnreachableWebDataURL); | 144 bool is_error_page = (url.spec() == kUnreachableWebDataURL); |
| 144 GURL validated_url(url); | 145 GURL validated_url(url); |
| 145 RenderProcessHost* render_process_host = render_frame_host->GetProcess(); | 146 RenderProcessHost* render_process_host = render_frame_host->GetProcess(); |
| 146 render_process_host->FilterURL(false, &validated_url); | 147 render_process_host->FilterURL(false, &validated_url); |
| 147 | 148 |
| 148 // Do not allow browser plugin guests to navigate to non-web URLs, since they | 149 // Do not allow browser plugin guests to navigate to non-web URLs, since they |
| 149 // cannot swap processes or grant bindings. | 150 // cannot swap processes or grant bindings. |
| 150 ChildProcessSecurityPolicyImpl* policy = | 151 ChildProcessSecurityPolicyImpl* policy = |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 bool is_renderer_initiated = true; | 192 bool is_renderer_initiated = true; |
| 192 int pending_nav_entry_id = 0; | 193 int pending_nav_entry_id = 0; |
| 193 bool started_from_context_menu = false; | 194 bool started_from_context_menu = false; |
| 194 NavigationEntryImpl* pending_entry = controller_->GetPendingEntry(); | 195 NavigationEntryImpl* pending_entry = controller_->GetPendingEntry(); |
| 195 if (pending_entry) { | 196 if (pending_entry) { |
| 196 is_renderer_initiated = pending_entry->is_renderer_initiated(); | 197 is_renderer_initiated = pending_entry->is_renderer_initiated(); |
| 197 pending_nav_entry_id = pending_entry->GetUniqueID(); | 198 pending_nav_entry_id = pending_entry->GetUniqueID(); |
| 198 started_from_context_menu = pending_entry->has_started_from_context_menu(); | 199 started_from_context_menu = pending_entry->has_started_from_context_menu(); |
| 199 } | 200 } |
| 200 | 201 |
| 202 std::vector<GURL> validated_redirect_chain = redirect_chain; |
| 203 for (size_t i = 0; i < validated_redirect_chain.size(); ++i) |
| 204 render_process_host->FilterURL(false, &validated_redirect_chain[i]); |
| 201 render_frame_host->SetNavigationHandle(NavigationHandleImpl::Create( | 205 render_frame_host->SetNavigationHandle(NavigationHandleImpl::Create( |
| 202 validated_url, render_frame_host->frame_tree_node(), | 206 validated_url, validated_redirect_chain, |
| 203 is_renderer_initiated, | 207 render_frame_host->frame_tree_node(), is_renderer_initiated, |
| 204 false, // is_same_page | 208 false, // is_same_page |
| 205 navigation_start, pending_nav_entry_id, | 209 navigation_start, pending_nav_entry_id, started_from_context_menu)); |
| 206 started_from_context_menu)); | |
| 207 } | 210 } |
| 208 | 211 |
| 209 void NavigatorImpl::DidFailProvisionalLoadWithError( | 212 void NavigatorImpl::DidFailProvisionalLoadWithError( |
| 210 RenderFrameHostImpl* render_frame_host, | 213 RenderFrameHostImpl* render_frame_host, |
| 211 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { | 214 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { |
| 212 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() | 215 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() |
| 213 << ", error_code: " << params.error_code | 216 << ", error_code: " << params.error_code |
| 214 << ", error_description: " << params.error_description | 217 << ", error_description: " << params.error_description |
| 215 << ", showing_repost_interstitial: " << | 218 << ", showing_repost_interstitial: " << |
| 216 params.showing_repost_interstitial | 219 params.showing_repost_interstitial |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 if (did_navigate && | 665 if (did_navigate && |
| 663 (controller_->GetLastCommittedEntry()->GetTransitionType() & | 666 (controller_->GetLastCommittedEntry()->GetTransitionType() & |
| 664 ui::PAGE_TRANSITION_FORWARD_BACK)) { | 667 ui::PAGE_TRANSITION_FORWARD_BACK)) { |
| 665 transition_type = ui::PageTransitionFromInt( | 668 transition_type = ui::PageTransitionFromInt( |
| 666 params.transition | ui::PAGE_TRANSITION_FORWARD_BACK); | 669 params.transition | ui::PAGE_TRANSITION_FORWARD_BACK); |
| 667 } | 670 } |
| 668 | 671 |
| 669 delegate_->DidCommitProvisionalLoad(render_frame_host, | 672 delegate_->DidCommitProvisionalLoad(render_frame_host, |
| 670 params.url, | 673 params.url, |
| 671 transition_type); | 674 transition_type); |
| 672 navigation_handle->DidCommitNavigation(params, is_navigation_within_page, | 675 navigation_handle->DidCommitNavigation(params, details.did_replace_entry, |
| 673 details.previous_url, | 676 details.previous_url, |
| 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 |
| (...skipping 585 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 |