| 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/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "content/browser/frame_host/frame_tree.h" | 9 #include "content/browser/frame_host/frame_tree.h" |
| 10 #include "content/browser/frame_host/frame_tree_node.h" | 10 #include "content/browser/frame_host/frame_tree_node.h" |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 const GURL& url, | 286 const GURL& url, |
| 287 int error_code, | 287 int error_code, |
| 288 const base::string16& error_description) { | 288 const base::string16& error_description) { |
| 289 if (delegate_) { | 289 if (delegate_) { |
| 290 delegate_->DidFailLoadWithError( | 290 delegate_->DidFailLoadWithError( |
| 291 render_frame_host, url, error_code, | 291 render_frame_host, url, error_code, |
| 292 error_description); | 292 error_description); |
| 293 } | 293 } |
| 294 } | 294 } |
| 295 | 295 |
| 296 void NavigatorImpl::DidRedirectProvisionalLoad( | |
| 297 RenderFrameHostImpl* render_frame_host, | |
| 298 int32 page_id, | |
| 299 const GURL& source_url, | |
| 300 const GURL& target_url) { | |
| 301 // TODO(creis): Remove this method and have the pre-rendering code listen to | |
| 302 // WebContentsObserver::DidGetRedirectForResourceRequest instead. | |
| 303 // See http://crbug.com/78512. | |
| 304 GURL validated_source_url(source_url); | |
| 305 GURL validated_target_url(target_url); | |
| 306 RenderProcessHost* render_process_host = render_frame_host->GetProcess(); | |
| 307 render_process_host->FilterURL(false, &validated_source_url); | |
| 308 render_process_host->FilterURL(false, &validated_target_url); | |
| 309 NavigationEntry* entry; | |
| 310 if (page_id == -1) { | |
| 311 entry = controller_->GetPendingEntry(); | |
| 312 } else { | |
| 313 entry = controller_->GetEntryWithPageID( | |
| 314 render_frame_host->GetSiteInstance(), page_id); | |
| 315 } | |
| 316 if (!entry || entry->GetURL() != validated_source_url) | |
| 317 return; | |
| 318 | |
| 319 if (delegate_) { | |
| 320 delegate_->DidRedirectProvisionalLoad( | |
| 321 render_frame_host, validated_target_url); | |
| 322 } | |
| 323 } | |
| 324 | |
| 325 bool NavigatorImpl::NavigateToEntry( | 296 bool NavigatorImpl::NavigateToEntry( |
| 326 RenderFrameHostImpl* render_frame_host, | 297 RenderFrameHostImpl* render_frame_host, |
| 327 const NavigationEntryImpl& entry, | 298 const NavigationEntryImpl& entry, |
| 328 NavigationController::ReloadType reload_type) { | 299 NavigationController::ReloadType reload_type) { |
| 329 TRACE_EVENT0("browser,navigation", "NavigatorImpl::NavigateToEntry"); | 300 TRACE_EVENT0("browser,navigation", "NavigatorImpl::NavigateToEntry"); |
| 330 | 301 |
| 331 // The renderer will reject IPC messages with URLs longer than | 302 // The renderer will reject IPC messages with URLs longer than |
| 332 // this limit, so don't attempt to navigate with a longer URL. | 303 // this limit, so don't attempt to navigate with a longer URL. |
| 333 if (entry.GetURL().spec().size() > GetMaxURLChars()) { | 304 if (entry.GetURL().spec().size() > GetMaxURLChars()) { |
| 334 LOG(WARNING) << "Refusing to load URL as it exceeds " << GetMaxURLChars() | 305 LOG(WARNING) << "Refusing to load URL as it exceeds " << GetMaxURLChars() |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 controller_->GetBrowserContext(), url); | 653 controller_->GetBrowserContext(), url); |
| 683 if ((enabled_bindings & BINDINGS_POLICY_WEB_UI) && | 654 if ((enabled_bindings & BINDINGS_POLICY_WEB_UI) && |
| 684 !is_allowed_in_web_ui_renderer) { | 655 !is_allowed_in_web_ui_renderer) { |
| 685 // Log the URL to help us diagnose any future failures of this CHECK. | 656 // Log the URL to help us diagnose any future failures of this CHECK. |
| 686 GetContentClient()->SetActiveURL(url); | 657 GetContentClient()->SetActiveURL(url); |
| 687 CHECK(0); | 658 CHECK(0); |
| 688 } | 659 } |
| 689 } | 660 } |
| 690 | 661 |
| 691 } // namespace content | 662 } // namespace content |
| OLD | NEW |