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

Unified Diff: chrome/browser/ssl/ssl_add_certificate_android.cc

Issue 11266008: Fix certificate and keychain installation on Android. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: separate android and openssl CertDatabase implementations Created 8 years 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 | « chrome/browser/ssl/ssl_add_certificate.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ssl/ssl_add_certificate_android.cc
diff --git a/chrome/browser/ssl/ssl_add_certificate_android.cc b/chrome/browser/ssl/ssl_add_certificate_android.cc
new file mode 100644
index 0000000000000000000000000000000000000000..460980e5e20bcaa691a9db9b09ff5d901bf6bb20
--- /dev/null
+++ b/chrome/browser/ssl/ssl_add_certificate_android.cc
@@ -0,0 +1,42 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ssl/ssl_add_certificate.h"
+
+#include "net/android/network_library.h"
+
+namespace chrome {
+
+// Special case for Android here for several reasons:
+//
+// - The SSLAddCertHandler implementation currently only supports
+// CERTIFICATE_TYPE_X509_USER_CERT, but not other types, like
+// CERTIFICATE_TYPE_PKCS12_ARCHIVE which are required on this
+// platform.
+//
+// - Besides, SSLAddCertHandler tries to parse the certificate
+// by calling net::CertDatabase::CheckUserCert() which is not
+// implemented on Android, mainly because there is no API
+// provided by the system to do that properly.
+//
+// - The Android CertInstaller activity will check the certificate file
+// and display a toast (small fading dialog) to the user if it is
+// not valid, so the UI performed by SSLAddCertHandler would
+// be redundant.
+void SSLAddCertificate(
+ net::URLRequest* /* request */,
+ net::CertificateMimeType cert_type,
+ const void* cert_data,
+ size_t cert_size,
+ int /* render_process_id */,
+ int /* render_view_id */) {
+ if (cert_size > 0) {
+ // This launches a new activity which will run in a different process.
+ // It handles all user interaction, so no need to do anything in the
+ // browser UI thread here.
+ net::android::StoreCertificate(cert_type, cert_data, cert_size);
+ }
+}
+
+} // namespace chrome
« no previous file with comments | « chrome/browser/ssl/ssl_add_certificate.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698