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

Unified Diff: ios/web/public/cert_store.h

Issue 1043243003: Upstream most of ios/web/net (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove accidentally-added clients Created 5 years, 9 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
« no previous file with comments | « ios/web/public/browser_state.h ('k') | ios/web/public/test/test_web_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/public/cert_store.h
diff --git a/ios/web/public/cert_store.h b/ios/web/public/cert_store.h
new file mode 100644
index 0000000000000000000000000000000000000000..b6b085596d1b147b1adc3e2ec681f5ea56ae9266
--- /dev/null
+++ b/ios/web/public/cert_store.h
@@ -0,0 +1,49 @@
+// Copyright 2015 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 IOS_WEB_PUBLIC_BROWSER_CERT_STORE_H_
+#define IOS_WEB_PUBLIC_BROWSER_CERT_STORE_H_
+
+#include "base/memory/ref_counted.h"
+
+namespace net {
+class X509Certificate;
+}
+
+namespace web {
+
+// The purpose of the cert store is to provide an easy way to store/retrieve
+// X509Certificate objects. When stored, an X509Certificate object is
+// associated with a group, which can be cleared when it is no longer useful.
+// It can be accessed from the UI and IO threads (it is thread-safe).
+// Note that the cert ids will overflow if more than 2^32 - 1 certs are
+// registered in one browsing session (which is highly unlikely to happen).
+class CertStore {
+ public:
+ // Returns the singleton instance of the CertStore.
+ static CertStore* GetInstance();
+
+ // Stores the specified cert and returns the id associated with it. The cert
+ // is associated to the specified RequestTracker.
+ // When all the RequestTrackers associated with a cert have been closed, the
+ // cert is removed from the store.
+ // Note: ids starts at 1.
+ virtual int StoreCert(net::X509Certificate* cert, int group_id) = 0;
+
+ // Tries to retrieve the previously stored cert associated with the specified
+ // |cert_id|. Returns whether the cert could be found, and, if |cert| is
+ // non-nullptr, copies it in.
+ virtual bool RetrieveCert(int cert_id,
+ scoped_refptr<net::X509Certificate>* cert) = 0;
+
+ // Removes all the certs associated with the specified groups from the store.
+ virtual void RemoveCertsForGroup(int group_id) = 0;
+
+ protected:
+ virtual ~CertStore() {}
+};
+
+} // namespace web
+
+#endif // IOS_WEB_PUBLIC_BROWSER_CERT_STORE_H_
« no previous file with comments | « ios/web/public/browser_state.h ('k') | ios/web/public/test/test_web_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698