Design doc pointer: https://docs.google.com/document/d/1rEBpw5V-Nn1UIi8CIFa5ZZvwlR08SkY3CogvWE2UMFs/edit#bookmark=id.qwflbnad6ftv
NavigationHandle currently allows NavigationThrottles to cancel deferred requests with NavigationThrottle::CancelDeferredNavigation. For certificate errors, we want to cancel them asynchronously after deciding what type of error page to show -- but CancelDeferredNavigation isn't quite sufficient, because we need to provide a net error code (the certificate error code, that is) and the HTML to commit in the error page.
Add a new NavigationThrottle::CancelDeferredNavigationWithCustomError() method that takes a net error code and a data: URI as arguments, and a matching method on NavigationHandleImpl. The NavigationHandleImpl implementation should pass these arguments to the completion_callback_. (This might require expanding the signature of completion_callback_, or perhaps changing it to take a struct, which can optionally include a net error code and data: URI, instead of just a ThrottleCheckResult.)
A new method NavigationRequest::OnCertificateErrorChecksComplete() method will be the completion callback in this case. For now, this method should be similar to, e.g., OnRedirectChecksComplete, in that it should call OnRequestFailed() when the request is cancelled, except that it should pass the provided net error code as the error code argument instead of ERR_ABORTED. Later, we'll expand the OnRequestFailed() code path to contain the error page HTML to commit.
Comment 1 by est...@chromium.org
, Aug 4 2017