Chromium Code Reviews| Index: chrome/browser/chromeos/net/client_cert_filter_chromeos.h |
| diff --git a/chrome/browser/chromeos/net/client_cert_filter_chromeos.h b/chrome/browser/chromeos/net/client_cert_filter_chromeos.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e7ff3936955a041b94f59a765329dcc7cca1f052 |
| --- /dev/null |
| +++ b/chrome/browser/chromeos/net/client_cert_filter_chromeos.h |
| @@ -0,0 +1,61 @@ |
| +// Copyright 2014 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_CLIENT_CERT_FILTER_CHROMEOS_H_ |
| +#define CHROME_BROWSER_CHROMEOS_NET_CLIENT_CERT_FILTER_CHROMEOS_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/memory/scoped_ptr.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "crypto/scoped_nss_types.h" |
| +#include "net/cert/nss_profile_filter_chromeos.h" |
| +#include "net/ssl/client_cert_store_chromeos.h" |
| + |
| +namespace chromeos { |
| + |
| +// A client certificate filter that filters by applying a |
| +// NSSProfileFilterChromeOS. |
| +class ClientCertFilterChromeOS |
| + : public net::ClientCertStoreChromeOS::CertFilter { |
| + public: |
| + // The internal NSSProfileFilterChromeOS will be initialized with the public |
| + // and private slot of the user with |username_hash| and with the system slot |
| + // if |use_system_slot| is true. |
| + ClientCertFilterChromeOS(bool use_system_slot, |
| + const std::string& username_hash); |
| + ~ClientCertFilterChromeOS() override; |
| + |
| + // ClientCertStoreChromeOS::CertFilter: |
| + bool Init(const base::Closure& callback) override; |
| + bool IsCertAllowed( |
| + const scoped_refptr<net::X509Certificate>& cert) const override; |
| + |
| + private: |
| + // Called back if the system slot was retrieved asynchronously. Continues the |
| + // initialization. |
| + void GotSystemSlot(crypto::ScopedPK11Slot system_slot); |
| + |
| + // Called back if the private slot was retrieved asynchronously. Continues the |
| + // initialization. |
| + void GotPrivateSlot(crypto::ScopedPK11Slot private_slot); |
| + |
| + // If the required slots (|private_slot_| and conditionally |system_slot_|) |
| + // are available, initializes |nss_profile_filter_| and returns true. |
| + // Otherwise returns false. |
| + bool InitIfSlotsAvailable(); |
| + |
| + bool init_called_; |
| + base::Closure init_callback_; |
| + bool use_system_slot_; |
| + crypto::ScopedPK11Slot system_slot_; |
| + crypto::ScopedPK11Slot private_slot_; |
|
mattm
2014/10/29 21:10:53
maybe add a comment that these are only used durin
pneubeck (no reviews)
2014/10/30 08:24:40
Done.
|
| + std::string username_hash_; |
| + net::NSSProfileFilterChromeOS nss_profile_filter_; |
| + base::WeakPtrFactory<ClientCertFilterChromeOS> weak_ptr_factory_; |
| +}; |
| + |
| +} // namespace chromeos |
| + |
| +#endif // CHROME_BROWSER_CHROMEOS_NET_CLIENT_CERT_FILTER_CHROMEOS_H_ |