| 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/frame_tree_node.h" | 5 #include "content/browser/frame_host/frame_tree_node.h" |
| 6 | 6 |
| 7 #include <queue> | 7 #include <queue> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 // notifications for Javascript URLS. | 393 // notifications for Javascript URLS. |
| 394 DCHECK(!navigation_request->common_params().url.SchemeIs( | 394 DCHECK(!navigation_request->common_params().url.SchemeIs( |
| 395 url::kJavaScriptScheme)); | 395 url::kJavaScriptScheme)); |
| 396 | 396 |
| 397 bool was_previously_loading = frame_tree()->IsLoading(); | 397 bool was_previously_loading = frame_tree()->IsLoading(); |
| 398 | 398 |
| 399 // There's no need to reset the state: there's still an ongoing load, and the | 399 // There's no need to reset the state: there's still an ongoing load, and the |
| 400 // RenderFrameHostManager will take care of updates to the speculative | 400 // RenderFrameHostManager will take care of updates to the speculative |
| 401 // RenderFrameHost in DidCreateNavigationRequest below. | 401 // RenderFrameHost in DidCreateNavigationRequest below. |
| 402 if (was_previously_loading) { | 402 if (was_previously_loading) { |
| 403 if (navigation_request_) { | 403 if (navigation_request_ && navigation_request_->navigation_handle()) { |
| 404 // Mark the old request as aborted. | 404 // Mark the old request as aborted. |
| 405 navigation_request_->navigation_handle()->set_net_error_code( | 405 navigation_request_->navigation_handle()->set_net_error_code( |
| 406 net::ERR_ABORTED); | 406 net::ERR_ABORTED); |
| 407 } | 407 } |
| 408 ResetNavigationRequest(true, true); | 408 ResetNavigationRequest(true, true); |
| 409 } | 409 } |
| 410 | 410 |
| 411 navigation_request_ = std::move(navigation_request); | 411 navigation_request_ = std::move(navigation_request); |
| 412 render_manager()->DidCreateNavigationRequest(navigation_request_.get()); | 412 render_manager()->DidCreateNavigationRequest(navigation_request_.get()); |
| 413 | 413 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 } | 496 } |
| 497 | 497 |
| 498 void FrameTreeNode::DidChangeLoadProgress(double load_progress) { | 498 void FrameTreeNode::DidChangeLoadProgress(double load_progress) { |
| 499 loading_progress_ = load_progress; | 499 loading_progress_ = load_progress; |
| 500 frame_tree_->UpdateLoadProgress(); | 500 frame_tree_->UpdateLoadProgress(); |
| 501 } | 501 } |
| 502 | 502 |
| 503 bool FrameTreeNode::StopLoading() { | 503 bool FrameTreeNode::StopLoading() { |
| 504 if (IsBrowserSideNavigationEnabled()) { | 504 if (IsBrowserSideNavigationEnabled()) { |
| 505 if (navigation_request_) { | 505 if (navigation_request_) { |
| 506 navigation_request_->navigation_handle()->set_net_error_code( | 506 int expected_pending_nav_entry_id = navigation_request_->nav_entry_id(); |
| 507 net::ERR_ABORTED); | 507 if (navigation_request_->navigation_handle()) { |
| 508 navigator_->DiscardPendingEntryIfNeeded( | 508 navigation_request_->navigation_handle()->set_net_error_code( |
| 509 navigation_request_->navigation_handle()); | 509 net::ERR_ABORTED); |
| 510 expected_pending_nav_entry_id = |
| 511 navigation_request_->navigation_handle()->pending_nav_entry_id(); |
| 512 } |
| 513 navigator_->DiscardPendingEntryIfNeeded(expected_pending_nav_entry_id); |
| 510 } | 514 } |
| 511 ResetNavigationRequest(false, true); | 515 ResetNavigationRequest(false, true); |
| 512 } | 516 } |
| 513 | 517 |
| 514 // TODO(nasko): see if child frames should send IPCs in site-per-process | 518 // TODO(nasko): see if child frames should send IPCs in site-per-process |
| 515 // mode. | 519 // mode. |
| 516 if (!IsMainFrame()) | 520 if (!IsMainFrame()) |
| 517 return true; | 521 return true; |
| 518 | 522 |
| 519 render_manager_.Stop(); | 523 render_manager_.Stop(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 534 RenderFrameHostImpl* current_frame_host = | 538 RenderFrameHostImpl* current_frame_host = |
| 535 render_manager_.current_frame_host(); | 539 render_manager_.current_frame_host(); |
| 536 DCHECK(current_frame_host); | 540 DCHECK(current_frame_host); |
| 537 current_frame_host->ResetLoadingState(); | 541 current_frame_host->ResetLoadingState(); |
| 538 | 542 |
| 539 if (IsBrowserSideNavigationEnabled()) { | 543 if (IsBrowserSideNavigationEnabled()) { |
| 540 RenderFrameHostImpl* speculative_frame_host = | 544 RenderFrameHostImpl* speculative_frame_host = |
| 541 render_manager_.speculative_frame_host(); | 545 render_manager_.speculative_frame_host(); |
| 542 if (speculative_frame_host) | 546 if (speculative_frame_host) |
| 543 speculative_frame_host->ResetLoadingState(); | 547 speculative_frame_host->ResetLoadingState(); |
| 548 // Note: there is no need to set an error code on the NavigationHandle here |
| 549 // as it has not been created yet. It is only created when the |
| 550 // BeforeUnloadACK is received. |
| 551 if (navigation_request_) |
| 552 ResetNavigationRequest(false, true); |
| 544 } else { | 553 } else { |
| 545 RenderFrameHostImpl* pending_frame_host = | 554 RenderFrameHostImpl* pending_frame_host = |
| 546 render_manager_.pending_frame_host(); | 555 render_manager_.pending_frame_host(); |
| 547 if (pending_frame_host) | 556 if (pending_frame_host) |
| 548 pending_frame_host->ResetLoadingState(); | 557 pending_frame_host->ResetLoadingState(); |
| 549 } | 558 } |
| 550 } | 559 } |
| 551 | 560 |
| 552 void FrameTreeNode::OnSetHasReceivedUserGesture() { | 561 void FrameTreeNode::OnSetHasReceivedUserGesture() { |
| 553 render_manager_.OnSetHasReceivedUserGesture(); | 562 render_manager_.OnSetHasReceivedUserGesture(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 566 } | 575 } |
| 567 return parent_->child_at(i + relative_offset); | 576 return parent_->child_at(i + relative_offset); |
| 568 } | 577 } |
| 569 } | 578 } |
| 570 | 579 |
| 571 NOTREACHED() << "FrameTreeNode not found in its parent's children."; | 580 NOTREACHED() << "FrameTreeNode not found in its parent's children."; |
| 572 return nullptr; | 581 return nullptr; |
| 573 } | 582 } |
| 574 | 583 |
| 575 } // namespace content | 584 } // namespace content |
| OLD | NEW |