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

Unified Diff: content/browser/ssl/ssl_policy.cc

Issue 2220603003: Remove unnecessary |result| argument from AllowCertificateError() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove unnecessary include Created 4 years, 4 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
« no previous file with comments | « content/browser/ssl/ssl_policy.h ('k') | content/public/browser/content_browser_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/ssl/ssl_policy.cc
diff --git a/content/browser/ssl/ssl_policy.cc b/content/browser/ssl/ssl_policy.cc
index a45e135d16c87e446221d4b35343abb796b75d01..69dd380eb60e8f27283dd98a9043b9c8300d6d4c 100644
--- a/content/browser/ssl/ssl_policy.cc
+++ b/content/browser/ssl/ssl_policy.cc
@@ -195,26 +195,31 @@ SecurityStyle SSLPolicy::GetSecurityStyleForResource(
}
void SSLPolicy::OnAllowCertificate(scoped_refptr<SSLCertErrorHandler> handler,
- bool allow) {
+ CertificateRequestResultType decision) {
DCHECK(handler->ssl_info().is_valid());
- if (allow) {
- // Default behavior for accepting a certificate.
- // Note that we should not call SetMaxSecurityStyle here, because the active
- // NavigationEntry has just been deleted (in HideInterstitialPage) and the
- // new NavigationEntry will not be set until DidNavigate. This is ok,
- // because the new NavigationEntry will have its max security style set
- // within DidNavigate.
- //
- // While AllowCertForHost() executes synchronously on this thread,
- // ContinueRequest() gets posted to a different thread. Calling
- // AllowCertForHost() first ensures deterministic ordering.
- backend_->AllowCertForHost(*handler->ssl_info().cert.get(),
- handler->request_url().host(),
- handler->cert_error());
- handler->ContinueRequest();
- } else {
- // Default behavior for rejecting a certificate.
- handler->CancelRequest();
+ switch (decision) {
+ case CERTIFICATE_REQUEST_RESULT_TYPE_CONTINUE:
+ // Note that we should not call SetMaxSecurityStyle here, because the
+ // active
+ // NavigationEntry has just been deleted (in HideInterstitialPage) and the
+ // new NavigationEntry will not be set until DidNavigate. This is ok,
+ // because the new NavigationEntry will have its max security style set
+ // within DidNavigate.
+ //
+ // While AllowCertForHost() executes synchronously on this thread,
+ // ContinueRequest() gets posted to a different thread. Calling
+ // AllowCertForHost() first ensures deterministic ordering.
+ backend_->AllowCertForHost(*handler->ssl_info().cert.get(),
+ handler->request_url().host(),
+ handler->cert_error());
+ handler->ContinueRequest();
+ return;
+ case CERTIFICATE_REQUEST_RESULT_TYPE_DENY:
+ handler->DenyRequest();
+ return;
+ case CERTIFICATE_REQUEST_RESULT_TYPE_CANCEL:
+ handler->CancelRequest();
+ return;
}
}
@@ -227,28 +232,13 @@ void SSLPolicy::OnCertErrorInternal(SSLCertErrorHandler* handler,
bool strict_enforcement = (options_mask & STRICT_ENFORCEMENT) != 0;
bool expired_previous_decision =
(options_mask & EXPIRED_PREVIOUS_DECISION) != 0;
- CertificateRequestResultType result =
- CERTIFICATE_REQUEST_RESULT_TYPE_CONTINUE;
GetContentClient()->browser()->AllowCertificateError(
handler->GetManager()->controller()->GetWebContents(),
handler->cert_error(), handler->ssl_info(), handler->request_url(),
handler->resource_type(), overridable, strict_enforcement,
expired_previous_decision,
base::Bind(&SSLPolicy::OnAllowCertificate, base::Unretained(this),
- make_scoped_refptr(handler)),
- &result);
- switch (result) {
- case CERTIFICATE_REQUEST_RESULT_TYPE_CONTINUE:
- break;
- case CERTIFICATE_REQUEST_RESULT_TYPE_CANCEL:
- handler->CancelRequest();
- break;
- case CERTIFICATE_REQUEST_RESULT_TYPE_DENY:
- handler->DenyRequest();
- break;
- default:
- NOTREACHED();
- }
+ make_scoped_refptr(handler)));
}
void SSLPolicy::InitializeEntryIfNeeded(NavigationEntryImpl* entry) {
« no previous file with comments | « content/browser/ssl/ssl_policy.h ('k') | content/public/browser/content_browser_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698