Chromium Code Reviews| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "content/browser/browsing_data/clear_site_data_throttle.h" | 10 #include "content/browser/browsing_data/clear_site_data_throttle.h" |
| 11 #include "content/browser/devtools/render_frame_devtools_agent_host.h" | 11 #include "content/browser/devtools/render_frame_devtools_agent_host.h" |
| 12 #include "content/browser/frame_host/frame_tree_node.h" | 12 #include "content/browser/frame_host/frame_tree_node.h" |
| 13 #include "content/browser/frame_host/navigator.h" | 13 #include "content/browser/frame_host/navigator.h" |
| 14 #include "content/browser/frame_host/navigator_delegate.h" | 14 #include "content/browser/frame_host/navigator_delegate.h" |
| 15 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 15 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
| 16 #include "content/common/frame_messages.h" | 16 #include "content/common/frame_messages.h" |
| 17 #include "content/common/resource_request_body_impl.h" | 17 #include "content/common/resource_request_body_impl.h" |
| 18 #include "content/public/browser/content_browser_client.h" | 18 #include "content/public/browser/content_browser_client.h" |
| 19 #include "content/public/common/browser_side_navigation_policy.h" | 19 #include "content/public/common/browser_side_navigation_policy.h" |
| 20 #include "content/public/common/content_client.h" | 20 #include "content/public/common/content_client.h" |
| 21 #include "content/public/common/url_constants.h" | |
| 21 #include "net/url_request/redirect_info.h" | 22 #include "net/url_request/redirect_info.h" |
| 22 #include "url/gurl.h" | 23 #include "url/gurl.h" |
| 23 #include "url/url_constants.h" | 24 #include "url/url_constants.h" |
| 24 | 25 |
| 25 namespace content { | 26 namespace content { |
| 26 | 27 |
| 27 namespace { | 28 namespace { |
| 28 | 29 |
| 29 void UpdateThrottleCheckResult( | 30 void UpdateThrottleCheckResult( |
| 30 NavigationThrottle::ThrottleCheckResult* to_update, | 31 NavigationThrottle::ThrottleCheckResult* to_update, |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 454 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); | 455 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); |
| 455 DCHECK_EQ(frame_tree_node_, render_frame_host->frame_tree_node()); | 456 DCHECK_EQ(frame_tree_node_, render_frame_host->frame_tree_node()); |
| 456 CHECK_EQ(url_, params.url); | 457 CHECK_EQ(url_, params.url); |
| 457 | 458 |
| 458 method_ = params.method; | 459 method_ = params.method; |
| 459 has_user_gesture_ = (params.gesture == NavigationGestureUser); | 460 has_user_gesture_ = (params.gesture == NavigationGestureUser); |
| 460 transition_ = params.transition; | 461 transition_ = params.transition; |
| 461 render_frame_host_ = render_frame_host; | 462 render_frame_host_ = render_frame_host; |
| 462 is_same_page_ = same_page; | 463 is_same_page_ = same_page; |
| 463 | 464 |
| 464 state_ = net_error_code_ == net::OK ? DID_COMMIT : DID_COMMIT_ERROR_PAGE; | 465 // If an error page reloads, net_error_code might be 200 but we still want to |
|
clamy
2016/09/19 11:46:44
nit: no "we" in comments?
jam
2016/09/19 14:19:40
I realize some people think it's unambiguous in so
clamy
2016/09/19 15:27:11
Acknowledged.
| |
| 466 // count it as an error page. | |
| 467 if (params.base_url.spec() == kUnreachableWebDataURL || | |
|
clamy
2016/09/19 11:46:44
When we reload the error page, do we know at the s
jam
2016/09/19 14:19:40
It's not known at the start (because the url is th
clamy
2016/09/19 15:27:11
Acknowledged.
| |
| 468 net_error_code_ != net::OK) { | |
| 469 state_ = DID_COMMIT_ERROR_PAGE; | |
| 470 } else { | |
| 471 state_ = DID_COMMIT; | |
| 472 } | |
| 465 } | 473 } |
| 466 | 474 |
| 467 NavigationThrottle::ThrottleCheckResult | 475 NavigationThrottle::ThrottleCheckResult |
| 468 NavigationHandleImpl::CheckWillStartRequest() { | 476 NavigationHandleImpl::CheckWillStartRequest() { |
| 469 DCHECK(state_ == WILL_SEND_REQUEST || state_ == DEFERRING_START); | 477 DCHECK(state_ == WILL_SEND_REQUEST || state_ == DEFERRING_START); |
| 470 DCHECK(state_ != WILL_SEND_REQUEST || next_index_ == 0); | 478 DCHECK(state_ != WILL_SEND_REQUEST || next_index_ == 0); |
| 471 DCHECK(state_ != DEFERRING_START || next_index_ != 0); | 479 DCHECK(state_ != DEFERRING_START || next_index_ != 0); |
| 472 for (size_t i = next_index_; i < throttles_.size(); ++i) { | 480 for (size_t i = next_index_; i < throttles_.size(); ++i) { |
| 473 NavigationThrottle::ThrottleCheckResult result = | 481 NavigationThrottle::ThrottleCheckResult result = |
| 474 throttles_[i]->WillStartRequest(); | 482 throttles_[i]->WillStartRequest(); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 592 throttles_to_register.push_back(std::move(clear_site_data_throttle)); | 600 throttles_to_register.push_back(std::move(clear_site_data_throttle)); |
| 593 | 601 |
| 594 if (throttles_to_register.size() > 0) { | 602 if (throttles_to_register.size() > 0) { |
| 595 throttles_.insert(throttles_.begin(), throttles_to_register.begin(), | 603 throttles_.insert(throttles_.begin(), throttles_to_register.begin(), |
| 596 throttles_to_register.end()); | 604 throttles_to_register.end()); |
| 597 throttles_to_register.weak_clear(); | 605 throttles_to_register.weak_clear(); |
| 598 } | 606 } |
| 599 } | 607 } |
| 600 | 608 |
| 601 } // namespace content | 609 } // namespace content |
| OLD | NEW |