Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1018)

Unified Diff: content/browser/frame_host/navigation_handle_impl.cc

Issue 2867833002: NavigationThrottle: allow customization of net::Error when blocking
Patch Set: Rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/navigation_handle_impl.cc
diff --git a/content/browser/frame_host/navigation_handle_impl.cc b/content/browser/frame_host/navigation_handle_impl.cc
index c4524a8a7c3e821dcff3c9d33ec625071afdc5bc..7bb4f472155681a50d8631465ab58a66b233b94c 100644
--- a/content/browser/frame_host/navigation_handle_impl.cc
+++ b/content/browser/frame_host/navigation_handle_impl.cc
@@ -354,11 +354,12 @@ void NavigationHandleImpl::Resume() {
// redirects).
// Note: if MaybeTransferAndProceed returns false, this means that this
// NavigationHandle was deleted, so return immediately.
- if (result == NavigationThrottle::PROCEED && !MaybeTransferAndProceed())
+ if (result.action() == NavigationThrottle::PROCEED &&
+ !MaybeTransferAndProceed())
return;
}
- if (result != NavigationThrottle::DEFER) {
+ if (result.action() != NavigationThrottle::DEFER) {
TRACE_EVENT_ASYNC_STEP_INTO0("navigation", "NavigationHandle", this,
"Resuming");
RunCompleteCallback(result);
@@ -370,8 +371,8 @@ void NavigationHandleImpl::CancelDeferredNavigation(
DCHECK(state_ == DEFERRING_START ||
state_ == DEFERRING_REDIRECT ||
state_ == DEFERRING_RESPONSE);
- DCHECK(result == NavigationThrottle::CANCEL_AND_IGNORE ||
- result == NavigationThrottle::CANCEL);
+ DCHECK(result.action() == NavigationThrottle::CANCEL_AND_IGNORE ||
+ result.action() == NavigationThrottle::CANCEL);
TRACE_EVENT_ASYNC_STEP_INTO0("navigation", "NavigationHandle", this,
"CancelDeferredNavigation");
state_ = CANCELING;
@@ -569,9 +570,9 @@ void NavigationHandleImpl::WillStartRequest(
NavigationThrottle::ThrottleCheckResult result = CheckWillStartRequest();
// If the navigation is not deferred, run the callback.
- if (result != NavigationThrottle::DEFER) {
+ if (result.action() != NavigationThrottle::DEFER) {
TRACE_EVENT_ASYNC_STEP_INTO1("navigation", "NavigationHandle", this,
- "StartRequest", "result", result);
+ "StartRequest", "result", result.action());
RunCompleteCallback(result);
}
}
@@ -619,9 +620,9 @@ void NavigationHandleImpl::WillRedirectRequest(
NavigationThrottle::ThrottleCheckResult result = CheckWillRedirectRequest();
// If the navigation is not deferred, run the callback.
- if (result != NavigationThrottle::DEFER) {
+ if (result.action() != NavigationThrottle::DEFER) {
TRACE_EVENT_ASYNC_STEP_INTO1("navigation", "NavigationHandle", this,
- "RedirectRequest", "result", result);
+ "RedirectRequest", "result", result.action());
RunCompleteCallback(result);
}
}
@@ -661,13 +662,14 @@ void NavigationHandleImpl::WillProcessResponse(
// on its site (after any redirects).
// Note: if MaybeTransferAndProceed returns false, this means that this
// NavigationHandle was deleted, so return immediately.
- if (result == NavigationThrottle::PROCEED && !MaybeTransferAndProceed())
+ if (result.action() == NavigationThrottle::PROCEED &&
+ !MaybeTransferAndProceed())
return;
// If the navigation is not deferred, run the callback.
- if (result != NavigationThrottle::DEFER) {
+ if (result.action() != NavigationThrottle::DEFER) {
TRACE_EVENT_ASYNC_STEP_INTO1("navigation", "NavigationHandle", this,
- "ProcessResponse", "result", result);
+ "ProcessResponse", "result", result.action());
RunCompleteCallback(result);
}
}
@@ -750,8 +752,9 @@ NavigationHandleImpl::CheckWillStartRequest() {
TRACE_EVENT_ASYNC_STEP_INTO0(
"navigation", "NavigationHandle", this,
base::StringPrintf("CheckWillStartRequest: %s: %d",
- throttles_[i]->GetNameForLogging(), result));
- switch (result) {
+ throttles_[i]->GetNameForLogging(),
+ result.action()));
+ switch (result.action()) {
case NavigationThrottle::PROCEED:
continue;
@@ -788,8 +791,9 @@ NavigationHandleImpl::CheckWillRedirectRequest() {
TRACE_EVENT_ASYNC_STEP_INTO0(
"navigation", "NavigationHandle", this,
base::StringPrintf("CheckWillRedirectRequest: %s: %d",
- throttles_[i]->GetNameForLogging(), result));
- switch (result) {
+ throttles_[i]->GetNameForLogging(),
+ result.action()));
+ switch (result.action()) {
case NavigationThrottle::PROCEED:
continue;
@@ -832,8 +836,9 @@ NavigationHandleImpl::CheckWillProcessResponse() {
TRACE_EVENT_ASYNC_STEP_INTO0(
"navigation", "NavigationHandle", this,
base::StringPrintf("CheckWillProcessResponse: %s: %d",
- throttles_[i]->GetNameForLogging(), result));
- switch (result) {
+ throttles_[i]->GetNameForLogging(),
+ result.action()));
+ switch (result.action()) {
case NavigationThrottle::PROCEED:
continue;
@@ -953,7 +958,7 @@ bool NavigationHandleImpl::MaybeTransferAndProceedInternal() {
void NavigationHandleImpl::RunCompleteCallback(
NavigationThrottle::ThrottleCheckResult result) {
- DCHECK(result != NavigationThrottle::DEFER);
+ DCHECK(result.action() != NavigationThrottle::DEFER);
ThrottleChecksFinishedCallback callback = complete_callback_;
complete_callback_.Reset();

Powered by Google App Engine
This is Rietveld 408576698