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

Unified Diff: content/browser/devtools/protocol/security_handler.cc

Issue 2639203003: Add certificate error handling to devtools. (Closed)
Patch Set: format Created 3 years, 11 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/devtools/protocol/security_handler.cc
diff --git a/content/browser/devtools/protocol/security_handler.cc b/content/browser/devtools/protocol/security_handler.cc
index cf214a7fc8782702fab8d8bb77bc1a9cd7b96764..4c5b238af292241860b6d513cccc0530c5cd32d5 100644
--- a/content/browser/devtools/protocol/security_handler.cc
+++ b/content/browser/devtools/protocol/security_handler.cc
@@ -136,6 +136,12 @@ void SecurityHandler::DidChangeVisibleSecurityState() {
Maybe<std::string>(security_style_explanations.summary));
}
+bool SecurityHandler::NotifyCertificateError(CertErrorHandler handler) {
+ handlers_[++cert_error_id_] = handler;
Eric Seckler 2017/01/19 11:42:28 nit: with next_cert_error_id_, this should become
irisu 2017/02/07 23:30:19 Done.
+ frontend_->CertificateError(cert_error_id_);
+ return true;
+}
+
Response SecurityHandler::Enable() {
enabled_ = true;
if (host_)
@@ -163,5 +169,25 @@ Response SecurityHandler::ShowCertificateViewer() {
return Response::OK();
}
+Response SecurityHandler::HandleCertificateError(int event_id,
+ const String& in_action) {
+ content::CertificateRequestResultType type =
+ content::CERTIFICATE_REQUEST_RESULT_TYPE_DENY;
+ Response response = Response::OK();
+ if (in_action == "continue") {
+ type = content::CERTIFICATE_REQUEST_RESULT_TYPE_CONTINUE;
+ } else if (in_action == "cancel") {
+ type = content::CERTIFICATE_REQUEST_RESULT_TYPE_CANCEL;
+ } else if (in_action == "deny") {
+ type = content::CERTIFICATE_REQUEST_RESULT_TYPE_DENY;
+ } else {
+ response = Response::Error(
+ String("Unknown Certificate Error Action: " + in_action));
+ }
+ handlers_[event_id].Run(type);
Eric Seckler 2017/01/19 11:42:28 We should probably check above whether the provide
irisu 2017/02/07 23:30:19 Done.
+ handlers_.erase(event_id);
+ return response;
+}
+
} // namespace protocol
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698