Chromium Code Reviews| 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 if (navigation_request_->navigation_handle()) { |
| 507 net::ERR_ABORTED); | 507 navigation_request_->navigation_handle()->set_net_error_code( |
| 508 navigator_->DiscardPendingEntryIfNeeded( | 508 net::ERR_ABORTED); |
| 509 navigation_request_->navigation_handle()); | 509 } |
| 510 int expected_pending_nav_entry_id = | |
| 511 navigation_request_->navigation_handle() | |
| 512 ? navigation_request_->navigation_handle()->pending_nav_entry_id() | |
| 513 : navigation_request_->nav_entry_id(); | |
|
nasko
2017/05/24 14:20:03
nit: Can't we combine this with the previous if st
clamy
2017/05/24 18:34:38
Done.
| |
| 514 navigator_->DiscardPendingEntryIfNeeded(expected_pending_nav_entry_id); | |
| 510 } | 515 } |
| 511 ResetNavigationRequest(false, true); | 516 ResetNavigationRequest(false, true); |
| 512 } | 517 } |
| 513 | 518 |
| 514 // TODO(nasko): see if child frames should send IPCs in site-per-process | 519 // TODO(nasko): see if child frames should send IPCs in site-per-process |
| 515 // mode. | 520 // mode. |
| 516 if (!IsMainFrame()) | 521 if (!IsMainFrame()) |
| 517 return true; | 522 return true; |
| 518 | 523 |
| 519 render_manager_.Stop(); | 524 render_manager_.Stop(); |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 534 RenderFrameHostImpl* current_frame_host = | 539 RenderFrameHostImpl* current_frame_host = |
| 535 render_manager_.current_frame_host(); | 540 render_manager_.current_frame_host(); |
| 536 DCHECK(current_frame_host); | 541 DCHECK(current_frame_host); |
| 537 current_frame_host->ResetLoadingState(); | 542 current_frame_host->ResetLoadingState(); |
| 538 | 543 |
| 539 if (IsBrowserSideNavigationEnabled()) { | 544 if (IsBrowserSideNavigationEnabled()) { |
| 540 RenderFrameHostImpl* speculative_frame_host = | 545 RenderFrameHostImpl* speculative_frame_host = |
| 541 render_manager_.speculative_frame_host(); | 546 render_manager_.speculative_frame_host(); |
| 542 if (speculative_frame_host) | 547 if (speculative_frame_host) |
| 543 speculative_frame_host->ResetLoadingState(); | 548 speculative_frame_host->ResetLoadingState(); |
| 549 if (navigation_request_) | |
| 550 ResetNavigationRequest(false, true); | |
|
nasko
2017/05/24 14:20:03
nit: Add a comment why we don't need to set the er
clamy
2017/05/24 18:34:38
Done.
| |
| 544 } else { | 551 } else { |
| 545 RenderFrameHostImpl* pending_frame_host = | 552 RenderFrameHostImpl* pending_frame_host = |
| 546 render_manager_.pending_frame_host(); | 553 render_manager_.pending_frame_host(); |
| 547 if (pending_frame_host) | 554 if (pending_frame_host) |
| 548 pending_frame_host->ResetLoadingState(); | 555 pending_frame_host->ResetLoadingState(); |
| 549 } | 556 } |
| 550 } | 557 } |
| 551 | 558 |
| 552 void FrameTreeNode::OnSetHasReceivedUserGesture() { | 559 void FrameTreeNode::OnSetHasReceivedUserGesture() { |
| 553 render_manager_.OnSetHasReceivedUserGesture(); | 560 render_manager_.OnSetHasReceivedUserGesture(); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 566 } | 573 } |
| 567 return parent_->child_at(i + relative_offset); | 574 return parent_->child_at(i + relative_offset); |
| 568 } | 575 } |
| 569 } | 576 } |
| 570 | 577 |
| 571 NOTREACHED() << "FrameTreeNode not found in its parent's children."; | 578 NOTREACHED() << "FrameTreeNode not found in its parent's children."; |
| 572 return nullptr; | 579 return nullptr; |
| 573 } | 580 } |
| 574 | 581 |
| 575 } // namespace content | 582 } // namespace content |
| OLD | NEW |