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

Unified Diff: chrome/browser/chromeos/platform_keys/platform_keys_service.cc

Issue 875373002: First implementation of chrome.platformKeys. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cert_idl
Patch Set: Fix .gn file. Created 5 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/chromeos/platform_keys/platform_keys_service.cc
diff --git a/chrome/browser/chromeos/platform_keys/platform_keys_service.cc b/chrome/browser/chromeos/platform_keys/platform_keys_service.cc
index b4bdd1cb6e1cda98099e76c5b045792e0eede5ee..95dbff81b22c72ddd2b89243a6b74048b9e923c1 100644
--- a/chrome/browser/chromeos/platform_keys/platform_keys_service.cc
+++ b/chrome/browser/chromeos/platform_keys/platform_keys_service.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/chromeos/platform_keys/platform_keys.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/browser/state_store.h"
+#include "net/cert/x509_certificate.h"
using content::BrowserThread;
@@ -74,6 +75,10 @@ PlatformKeysService::PlatformKeysService(
PlatformKeysService::~PlatformKeysService() {
}
+void PlatformKeysService::DisablePermissionCheckForTesting() {
+ permission_check_enabled_ = false;
+}
+
void PlatformKeysService::GenerateRSAKey(const std::string& token_id,
unsigned int modulus_length,
const std::string& extension_id,
@@ -108,6 +113,19 @@ void PlatformKeysService::Sign(const std::string& token_id,
browser_context_));
}
+void PlatformKeysService::SelectClientCertificates(
+ const platform_keys::ClientCertificateRequest& request,
+ const std::string& extension_id,
+ const SelectCertificatesCallback& callback) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ platform_keys::subtle::SelectClientCertificates(
+ request,
+ base::Bind(&PlatformKeysService::SelectClientCertificatesCallback,
+ weak_factory_.GetWeakPtr(), extension_id, callback),
+ browser_context_);
+}
+
void PlatformKeysService::RegisterPublicKey(
const std::string& extension_id,
const std::string& public_key_spki_der,
@@ -163,6 +181,18 @@ void PlatformKeysService::GenerateRSAKeyCallback(
RegisterPublicKey(extension_id, public_key_spki_der, wrapped_callback);
}
+void PlatformKeysService::SelectClientCertificatesCallback(
+ const std::string& extension_id,
+ const SelectCertificatesCallback& callback,
+ scoped_ptr<net::CertificateList> matches,
+ const std::string& error_message) {
+ if (permission_check_enabled_)
+ matches->clear();
+
+ // TODO(pneubeck): Remove all certs that the extension doesn't have access to.
+ callback.Run(matches.Pass(), error_message);
+}
+
void PlatformKeysService::RegisterPublicKeyGotPlatformKeys(
const std::string& extension_id,
const std::string& public_key_spki_der,
« no previous file with comments | « chrome/browser/chromeos/platform_keys/platform_keys_service.h ('k') | chrome/browser/extensions/api/platform_keys/OWNERS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698