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

Unified Diff: chrome/browser/renderer_host/x509_user_cert_resource_handler.cc

Issue 652137: Mac: implement <keygen> support, including adding generated cert to the Keychain. (Closed)
Patch Set: Responding to review feedback. Created 10 years, 10 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: chrome/browser/renderer_host/x509_user_cert_resource_handler.cc
diff --git a/chrome/browser/renderer_host/x509_user_cert_resource_handler.cc b/chrome/browser/renderer_host/x509_user_cert_resource_handler.cc
index abf5541cf23129d47ce800c0198352f358e22896..5fbec9658cac560ff4a767dc82a13bba1c7a0905 100644
--- a/chrome/browser/renderer_host/x509_user_cert_resource_handler.cc
+++ b/chrome/browser/renderer_host/x509_user_cert_resource_handler.cc
@@ -12,7 +12,6 @@
#include "chrome/browser/renderer_host/resource_dispatcher_host_request_info.h"
#include "chrome/common/resource_response.h"
#include "chrome/common/url_constants.h"
-#include "net/base/cert_database.h"
#include "net/base/io_buffer.h"
#include "net/base/mime_sniffer.h"
#include "net/base/mime_util.h"
@@ -79,12 +78,17 @@ bool X509UserCertResourceHandler::OnResponseCompleted(
int request_id,
const URLRequestStatus& urs,
const std::string& sec_info) {
+ if (urs.status() != URLRequestStatus::SUCCESS)
+ return false;
+
// TODO(gauravsh): Verify that 'request_id' was actually a keygen form post
// and only then import the certificate.
- scoped_ptr<net::CertDatabase> cert_db(new net::CertDatabase());
AssembleResource();
-
- return cert_db->AddUserCert(resource_buffer_->data(), content_length_);
+ scoped_refptr<net::X509Certificate> cert =
+ net::X509Certificate::CreateFromBytes(resource_buffer_->data(),
+ content_length_);
+ request_->delegate()->OnClientCertificateGenerated(request_, cert);
+ return true;
}
void X509UserCertResourceHandler::AssembleResource() {

Powered by Google App Engine
This is Rietveld 408576698