| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/navigation_handle_impl.h" | 5 #include "content/browser/frame_host/navigation_handle_impl.h" |
| 6 | 6 |
| 7 #include "base/debug/dump_without_crashing.h" | 7 #include "base/debug/dump_without_crashing.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "content/browser/appcache/appcache_navigation_handle.h" | 9 #include "content/browser/appcache/appcache_navigation_handle.h" |
| 10 #include "content/browser/appcache/appcache_service_impl.h" | 10 #include "content/browser/appcache/appcache_service_impl.h" |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 transition_ = params.transition; | 551 transition_ = params.transition; |
| 552 render_frame_host_ = render_frame_host; | 552 render_frame_host_ = render_frame_host; |
| 553 | 553 |
| 554 // If an error page reloads, net_error_code might be 200 but we still want to | 554 // If an error page reloads, net_error_code might be 200 but we still want to |
| 555 // count it as an error page. | 555 // count it as an error page. |
| 556 if (params.base_url.spec() == kUnreachableWebDataURL || | 556 if (params.base_url.spec() == kUnreachableWebDataURL || |
| 557 net_error_code_ != net::OK) { | 557 net_error_code_ != net::OK) { |
| 558 state_ = DID_COMMIT_ERROR_PAGE; | 558 state_ = DID_COMMIT_ERROR_PAGE; |
| 559 } else { | 559 } else { |
| 560 state_ = DID_COMMIT; | 560 state_ = DID_COMMIT; |
| 561 |
| 562 // Getting this far means that the navigation was not blocked, and neither |
| 563 // is this the error page navigation following a blocked navigation. Ensure |
| 564 // the frame owner element is no longer collapsed as a result of a prior |
| 565 // navigation having been blocked with BLOCK_REQUEST_AND_COLLAPSE. |
| 566 if (!frame_tree_node()->IsMainFrame()) |
| 567 frame_tree_node()->SetFrameOwnerCollapsedState(false); |
| 561 } | 568 } |
| 562 } | 569 } |
| 563 | 570 |
| 564 void NavigationHandleImpl::Transfer() { | 571 void NavigationHandleImpl::Transfer() { |
| 565 DCHECK(!IsBrowserSideNavigationEnabled()); | 572 DCHECK(!IsBrowserSideNavigationEnabled()); |
| 566 // This is an actual transfer. Inform the NavigationResourceThrottle. This | 573 // This is an actual transfer. Inform the NavigationResourceThrottle. This |
| 567 // will allow to mark the URLRequest as transferring. When it is marked as | 574 // will allow to mark the URLRequest as transferring. When it is marked as |
| 568 // transferring, the URLRequest can no longer be cancelled by its original | 575 // transferring, the URLRequest can no longer be cancelled by its original |
| 569 // RenderFrame. Instead it will persist until being picked up by the transfer | 576 // RenderFrame. Instead it will persist until being picked up by the transfer |
| 570 // RenderFrame, even if the original RenderFrame is destroyed. | 577 // RenderFrame, even if the original RenderFrame is destroyed. |
| 571 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, transfer_callback_); | 578 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, transfer_callback_); |
| 572 transfer_callback_.Reset(); | 579 transfer_callback_.Reset(); |
| 573 } | 580 } |
| 574 | 581 |
| 575 NavigationThrottle::ThrottleCheckResult | 582 NavigationThrottle::ThrottleCheckResult |
| 576 NavigationHandleImpl::CheckWillStartRequest() { | 583 NavigationHandleImpl::CheckWillStartRequest() { |
| 577 DCHECK(state_ == WILL_SEND_REQUEST || state_ == DEFERRING_START); | 584 DCHECK(state_ == WILL_SEND_REQUEST || state_ == DEFERRING_START); |
| 578 DCHECK(state_ != WILL_SEND_REQUEST || next_index_ == 0); | 585 DCHECK(state_ != WILL_SEND_REQUEST || next_index_ == 0); |
| 579 DCHECK(state_ != DEFERRING_START || next_index_ != 0); | 586 DCHECK(state_ != DEFERRING_START || next_index_ != 0); |
| 580 for (size_t i = next_index_; i < throttles_.size(); ++i) { | 587 for (size_t i = next_index_; i < throttles_.size(); ++i) { |
| 581 NavigationThrottle::ThrottleCheckResult result = | 588 NavigationThrottle::ThrottleCheckResult result = |
| 582 throttles_[i]->WillStartRequest(); | 589 throttles_[i]->WillStartRequest(); |
| 583 switch (result) { | 590 switch (result) { |
| 584 case NavigationThrottle::PROCEED: | 591 case NavigationThrottle::PROCEED: |
| 585 continue; | 592 continue; |
| 586 | 593 |
| 587 case NavigationThrottle::CANCEL: | 594 case NavigationThrottle::CANCEL: |
| 588 case NavigationThrottle::CANCEL_AND_IGNORE: | 595 case NavigationThrottle::CANCEL_AND_IGNORE: |
| 589 case NavigationThrottle::BLOCK_REQUEST: | 596 case NavigationThrottle::BLOCK_REQUEST: |
| 597 case NavigationThrottle::BLOCK_REQUEST_AND_COLLAPSE: |
| 590 state_ = CANCELING; | 598 state_ = CANCELING; |
| 591 return result; | 599 return result; |
| 592 | 600 |
| 593 case NavigationThrottle::DEFER: | 601 case NavigationThrottle::DEFER: |
| 594 state_ = DEFERRING_START; | 602 state_ = DEFERRING_START; |
| 595 next_index_ = i + 1; | 603 next_index_ = i + 1; |
| 596 return result; | 604 return result; |
| 597 | 605 |
| 598 case NavigationThrottle::BLOCK_RESPONSE: | 606 case NavigationThrottle::BLOCK_RESPONSE: |
| 599 NOTREACHED(); | 607 NOTREACHED(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 611 DCHECK(state_ != DEFERRING_REDIRECT || next_index_ != 0); | 619 DCHECK(state_ != DEFERRING_REDIRECT || next_index_ != 0); |
| 612 for (size_t i = next_index_; i < throttles_.size(); ++i) { | 620 for (size_t i = next_index_; i < throttles_.size(); ++i) { |
| 613 NavigationThrottle::ThrottleCheckResult result = | 621 NavigationThrottle::ThrottleCheckResult result = |
| 614 throttles_[i]->WillRedirectRequest(); | 622 throttles_[i]->WillRedirectRequest(); |
| 615 switch (result) { | 623 switch (result) { |
| 616 case NavigationThrottle::PROCEED: | 624 case NavigationThrottle::PROCEED: |
| 617 continue; | 625 continue; |
| 618 | 626 |
| 619 case NavigationThrottle::CANCEL: | 627 case NavigationThrottle::CANCEL: |
| 620 case NavigationThrottle::CANCEL_AND_IGNORE: | 628 case NavigationThrottle::CANCEL_AND_IGNORE: |
| 629 case NavigationThrottle::BLOCK_REQUEST_AND_COLLAPSE: |
| 621 state_ = CANCELING; | 630 state_ = CANCELING; |
| 622 return result; | 631 return result; |
| 623 | 632 |
| 624 case NavigationThrottle::DEFER: | 633 case NavigationThrottle::DEFER: |
| 625 state_ = DEFERRING_REDIRECT; | 634 state_ = DEFERRING_REDIRECT; |
| 626 next_index_ = i + 1; | 635 next_index_ = i + 1; |
| 627 return result; | 636 return result; |
| 628 | 637 |
| 629 case NavigationThrottle::BLOCK_REQUEST: | 638 case NavigationThrottle::BLOCK_REQUEST: |
| 630 case NavigationThrottle::BLOCK_RESPONSE: | 639 case NavigationThrottle::BLOCK_RESPONSE: |
| (...skipping 27 matching lines...) Expand all Loading... |
| 658 case NavigationThrottle::BLOCK_RESPONSE: | 667 case NavigationThrottle::BLOCK_RESPONSE: |
| 659 state_ = CANCELING; | 668 state_ = CANCELING; |
| 660 return result; | 669 return result; |
| 661 | 670 |
| 662 case NavigationThrottle::DEFER: | 671 case NavigationThrottle::DEFER: |
| 663 state_ = DEFERRING_RESPONSE; | 672 state_ = DEFERRING_RESPONSE; |
| 664 next_index_ = i + 1; | 673 next_index_ = i + 1; |
| 665 return result; | 674 return result; |
| 666 | 675 |
| 667 case NavigationThrottle::BLOCK_REQUEST: | 676 case NavigationThrottle::BLOCK_REQUEST: |
| 677 case NavigationThrottle::BLOCK_REQUEST_AND_COLLAPSE: |
| 668 NOTREACHED(); | 678 NOTREACHED(); |
| 669 } | 679 } |
| 670 } | 680 } |
| 671 next_index_ = 0; | 681 next_index_ = 0; |
| 672 state_ = WILL_PROCESS_RESPONSE; | 682 state_ = WILL_PROCESS_RESPONSE; |
| 673 return NavigationThrottle::PROCEED; | 683 return NavigationThrottle::PROCEED; |
| 674 } | 684 } |
| 675 | 685 |
| 676 bool NavigationHandleImpl::MaybeTransferAndProceed() { | 686 bool NavigationHandleImpl::MaybeTransferAndProceed() { |
| 677 DCHECK_EQ(WILL_PROCESS_RESPONSE, state_); | 687 DCHECK_EQ(WILL_PROCESS_RESPONSE, state_); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 throttles_.push_back(std::move(ancestor_throttle)); | 816 throttles_.push_back(std::move(ancestor_throttle)); |
| 807 | 817 |
| 808 if (throttles_to_register.size() > 0) { | 818 if (throttles_to_register.size() > 0) { |
| 809 throttles_.insert(throttles_.begin(), throttles_to_register.begin(), | 819 throttles_.insert(throttles_.begin(), throttles_to_register.begin(), |
| 810 throttles_to_register.end()); | 820 throttles_to_register.end()); |
| 811 throttles_to_register.weak_clear(); | 821 throttles_to_register.weak_clear(); |
| 812 } | 822 } |
| 813 } | 823 } |
| 814 | 824 |
| 815 } // namespace content | 825 } // namespace content |
| OLD | NEW |