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

Unified Diff: chrome/browser/chromeos/net/profile_cert_filter.h

Issue 18121007: *WIP* Store NSS slots per profile. Move keygen to chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cert manager basics working Created 7 years, 2 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/net/profile_cert_filter.h
diff --git a/chrome/browser/chromeos/net/profile_cert_filter.h b/chrome/browser/chromeos/net/profile_cert_filter.h
new file mode 100644
index 0000000000000000000000000000000000000000..ae65f623a1e52b070df56ca11dbbaf8b40eb0962
--- /dev/null
+++ b/chrome/browser/chromeos/net/profile_cert_filter.h
@@ -0,0 +1,56 @@
+// Copyright (c) 2013 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.
+
+#ifndef CHROME_BROWSER_CHROMEOS_NET_PROFILE_CERT_FILTER_
+#define CHROME_BROWSER_CHROMEOS_NET_PROFILE_CERT_FILTER_
+
+#include "base/callback_forward.h"
+#include "crypto/scoped_nss_types.h"
+#include "net/base/crypto_module.h"
+#include "net/cert/x509_certificate.h"
+
+namespace content {
+class ResourceContext;
+} // namespace content
+
+namespace chromeos {
+
+class ProfileCertFilter {
+ public:
+ ProfileCertFilter() {}
+
+ // Initialize with slot handles.
+ void Init(crypto::ScopedPK11Slot public_slot,
+ crypto::ScopedPK11Slot private_slot);
+ // Initialize from |context|. Caller must ensure the ProfileCertFilter is not
+ // destroyed before the |callback| is run.
+ void Init(content::ResourceContext* context,
+ const base::Closure& callback);
+
+ bool IsModuleAllowed(PK11SlotInfo* slot) const;
+ bool IsCertAllowed(const scoped_refptr<net::X509Certificate>& cert) const;
+ // Predicate that can be used with remove_if. The operator() returns
+ // !IsCertAllowed(cert) or !IsModuleAllowed(module->os_module_handle()).
+ class Predicate {
+ public:
+ Predicate(const ProfileCertFilter& filter);
+ bool operator()(const scoped_refptr<net::CryptoModule>& module) const;
+ bool operator()(const scoped_refptr<net::X509Certificate>& cert) const;
+ private:
+ const ProfileCertFilter& filter_;
+ };
+
+ private:
+ void GotPrivateSlot(const base::Closure& callback,
+ crypto::ScopedPK11Slot private_slot);
+
+ crypto::ScopedPK11Slot public_slot_;
+ crypto::ScopedPK11Slot private_slot_;
+
+ DISALLOW_COPY_AND_ASSIGN(ProfileCertFilter);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_NET_PROFILE_CERT_FILTER_
« no previous file with comments | « chrome/browser/chromeos/net/nss_cert_database_cros.cc ('k') | chrome/browser/chromeos/net/profile_cert_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698