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

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

Issue 663583006: Remove nss_util dependency from ClientCertStoreChromeOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed typo. Created 6 years, 1 month 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/chromeos/net/OWNERS ('k') | chrome/browser/chromeos/net/client_cert_filter_chromeos.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..302a8c959c5ca622175e7746d37c532b5a4706ab
--- /dev/null
+++ b/chrome/browser/chromeos/net/client_cert_filter_chromeos.h
@@ -0,0 +1,73 @@
+// 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();
+
+ // True once Init() was called.
+ bool init_called_;
+
+ // The callback provided to Init(), which may be null. Reset after the filter
+ // is initialized.
+ base::Closure init_callback_;
+
+ bool use_system_slot_;
+ std::string username_hash_;
+
+ // Used to store the system slot, if required, for initialization. Will be
+ // null after the filter is initialized.
+ crypto::ScopedPK11Slot system_slot_;
+
+ // Used to store the private slot for initialization. Will be null after the
+ // filter is initialized.
+ crypto::ScopedPK11Slot private_slot_;
+
+ net::NSSProfileFilterChromeOS nss_profile_filter_;
+ base::WeakPtrFactory<ClientCertFilterChromeOS> weak_ptr_factory_;
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_NET_CLIENT_CERT_FILTER_CHROMEOS_H_
« no previous file with comments | « chrome/browser/chromeos/net/OWNERS ('k') | chrome/browser/chromeos/net/client_cert_filter_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698