| 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/test/test_render_frame_host.h" | 5 #include "content/test/test_render_frame_host.h" |
| 6 | 6 |
| 7 #include "base/guid.h" | 7 #include "base/guid.h" |
| 8 #include "content/browser/frame_host/frame_tree.h" | 8 #include "content/browser/frame_host/frame_tree.h" |
| 9 #include "content/browser/frame_host/navigation_handle_impl.h" | 9 #include "content/browser/frame_host/navigation_handle_impl.h" |
| 10 #include "content/browser/frame_host/navigation_request.h" | 10 #include "content/browser/frame_host/navigation_request.h" |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 if (!IsBrowserSideNavigationEnabled()) { | 425 if (!IsBrowserSideNavigationEnabled()) { |
| 426 // Non PlzNavigate | 426 // Non PlzNavigate |
| 427 if (is_waiting_for_beforeunload_ack()) | 427 if (is_waiting_for_beforeunload_ack()) |
| 428 SendBeforeUnloadACK(true); | 428 SendBeforeUnloadACK(true); |
| 429 return; | 429 return; |
| 430 } | 430 } |
| 431 | 431 |
| 432 // PlzNavigate | 432 // PlzNavigate |
| 433 NavigationRequest* request = frame_tree_node_->navigation_request(); | 433 NavigationRequest* request = frame_tree_node_->navigation_request(); |
| 434 CHECK(request); | 434 CHECK(request); |
| 435 bool have_to_make_network_request = ShouldMakeNetworkRequestForURL( | 435 bool have_to_make_network_request = |
| 436 request->common_params().url); | 436 ShouldMakeNetworkRequestForURL(request->common_params().url) && |
| 437 !request->request_params().is_same_document_navigation; |
| 437 | 438 |
| 438 // Simulate a beforeUnload ACK from the renderer if the browser is waiting for | 439 // Simulate a beforeUnload ACK from the renderer if the browser is waiting for |
| 439 // it. If it runs it will update the request state. | 440 // it. If it runs it will update the request state. |
| 440 if (request->state() == NavigationRequest::WAITING_FOR_RENDERER_RESPONSE) { | 441 if (request->state() == NavigationRequest::WAITING_FOR_RENDERER_RESPONSE) { |
| 441 static_cast<TestRenderFrameHost*>(frame_tree_node()->current_frame_host()) | 442 static_cast<TestRenderFrameHost*>(frame_tree_node()->current_frame_host()) |
| 442 ->SendBeforeUnloadACK(true); | 443 ->SendBeforeUnloadACK(true); |
| 443 } | 444 } |
| 444 | 445 |
| 445 if (!have_to_make_network_request) | 446 if (!have_to_make_network_request) |
| 446 return; // |request| is destructed by now. | 447 return; // |request| is destructed by now. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 // PlzNavigate: NavigationHandle::WillStartRequest has already been called at | 483 // PlzNavigate: NavigationHandle::WillStartRequest has already been called at |
| 483 // this point. | 484 // this point. |
| 484 if (!navigation_handle() || IsBrowserSideNavigationEnabled()) | 485 if (!navigation_handle() || IsBrowserSideNavigationEnabled()) |
| 485 return; | 486 return; |
| 486 navigation_handle()->CallWillStartRequestForTesting( | 487 navigation_handle()->CallWillStartRequestForTesting( |
| 487 false /* is_post */, Referrer(GURL(), blink::WebReferrerPolicyDefault), | 488 false /* is_post */, Referrer(GURL(), blink::WebReferrerPolicyDefault), |
| 488 true /* user_gesture */, transition, false /* is_external_protocol */); | 489 true /* user_gesture */, transition, false /* is_external_protocol */); |
| 489 } | 490 } |
| 490 | 491 |
| 491 } // namespace content | 492 } // namespace content |
| OLD | NEW |