Browse Source

Fix compilation of atom/browser/api/atom_api_app.cc

Refactor client cert private key handling.
https://codereview.chromium.org/2898573002
Aleksei Kuzmin 7 years ago
parent
commit
1073c9b1ed
1 changed files with 12 additions and 6 deletions
  1. 12 6
      atom/browser/api/atom_api_app.cc

+ 12 - 6
atom/browser/api/atom_api_app.cc

@@ -425,14 +425,14 @@ void OnClientCertificateSelected(
     std::shared_ptr<content::ClientCertificateDelegate> delegate,
     mate::Arguments* args) {
   if (args->Length() == 2) {
-    delegate->ContinueWithCertificate(nullptr);
+    delegate->ContinueWithCertificate(nullptr, nullptr);
     return;
   }
 
   v8::Local<v8::Value> val;
   args->GetNext(&val);
   if (val->IsNull()) {
-    delegate->ContinueWithCertificate(nullptr);
+    delegate->ContinueWithCertificate(nullptr, nullptr);
     return;
   }
 
@@ -448,8 +448,11 @@ void OnClientCertificateSelected(
 
   auto certs = net::X509Certificate::CreateCertificateListFromBytes(
       data.c_str(), data.length(), net::X509Certificate::FORMAT_AUTO);
-  if (!certs.empty())
-    delegate->ContinueWithCertificate(certs[0].get());
+  if (!certs.empty()) {
+    scoped_refptr<net::X509Certificate> cert(certs[0].get());
+    // FIXME: Pass private key as a second argument.
+    delegate->ContinueWithCertificate(cert, nullptr);
+  }
 }
 
 void PassLoginInformation(scoped_refptr<LoginHandler> login_handler,
@@ -720,8 +723,11 @@ void App::SelectClientCertificate(
                       shared_delegate));
 
   // Default to first certificate from the platform store.
-  if (!prevent_default)
-    shared_delegate->ContinueWithCertificate(client_certs[0].get());
+  if (!prevent_default) {
+    scoped_refptr<net::X509Certificate> cert = identities[0]->certificate();
+    // FIXME: Pass private key as a second argument.
+    shared_delegate->ContinueWithCertificate(cert, nullptr);
+  }
 }
 
 void App::OnGpuProcessCrashed(base::TerminationStatus status) {