| 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_
|
|
|