Index: chrome/browser/chromeos/policy/policy_cert_verifier.h |
diff --git a/chrome/browser/chromeos/policy/policy_cert_verifier.h b/chrome/browser/chromeos/policy/policy_cert_verifier.h |
index c671161b3cc2661c04c787693bc709602bd3c7a2..b386b720fb2ed880c315189894adc329222d9acd 100644 |
--- a/chrome/browser/chromeos/policy/policy_cert_verifier.h |
+++ b/chrome/browser/chromeos/policy/policy_cert_verifier.h |
@@ -8,14 +8,17 @@ |
#include <vector> |
#include "base/basictypes.h" |
-#include "base/callback.h" |
+#include "base/callback_list.h" |
#include "base/compiler_specific.h" |
#include "base/memory/ref_counted.h" |
#include "base/memory/scoped_ptr.h" |
+#include "base/memory/weak_ptr.h" |
+#include "net/base/completion_callback.h" |
#include "net/cert/cert_trust_anchor_provider.h" |
#include "net/cert/cert_verifier.h" |
namespace net { |
+class CertVerifyResult; |
class X509Certificate; |
typedef std::vector<scoped_refptr<X509Certificate> > CertificateList; |
} |
@@ -31,10 +34,14 @@ class PolicyCertVerifier : public net::CertVerifier, |
// destructor must be called on the IO thread. |anchor_used_callback| is |
// called on the IO thread everytime a certificate from the additional trust |
// anchors (set with SetTrustAnchors) is used. |
- explicit PolicyCertVerifier(const base::Closure& anchor_used_callback); |
+ PolicyCertVerifier(); |
virtual ~PolicyCertVerifier(); |
void InitializeOnIOThread(); |
+ void ShutdownOnUIThread(); |
+ |
+ scoped_ptr<base::CallbackList<void()>::Subscription> |
+ RegisterAnchorUsedCallback(const base::Closure& cb); |
void SetTrustAnchors(const net::CertificateList& trust_anchors); |
@@ -55,10 +62,32 @@ class PolicyCertVerifier : public net::CertVerifier, |
virtual const net::CertificateList& GetAdditionalTrustAnchors() OVERRIDE; |
private: |
+ void RunCallback(); |
+ |
+ static void MaybeSignalAnchorUse( |
+ int error, |
+ const net::CertVerifyResult& verify_result, |
+ const base::WeakPtr<PolicyCertVerifier>& weak_ptr); |
+ |
+ static void CompleteAndSignalAnchorUse( |
+ const net::CompletionCallback& completion_callback, |
+ const net::CertVerifyResult* verify_result, |
+ const base::WeakPtr<PolicyCertVerifier>& weak_ptr, |
+ int error); |
+ |
net::CertificateList trust_anchors_; |
- base::Closure anchor_used_callback_; |
scoped_ptr<CertVerifier> delegate_; |
+ // Must be constructed, modified, and destructed on the UI thread. |
+ scoped_ptr<base::CallbackList<void()> > anchor_used_callback_list_; |
+ |
+ // Must be constructed, modified, and invalidated on the UI thread. |
+ base::WeakPtrFactory<PolicyCertVerifier> weak_ptr_factory_; |
+ |
+ // Must be constructed and dereferenced on the UI thread. This WeakPtr has to |
+ // be used for callbacks from the IO thread to the UI thread. |
+ base::WeakPtr<PolicyCertVerifier> weak_ptr_; |
+ |
DISALLOW_COPY_AND_ASSIGN(PolicyCertVerifier); |
}; |