Chromium Code Reviews| 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..ce7b591a066ce2a99ff7b8f3682295f1e8f46527 100644 |
| --- a/chrome/browser/chromeos/policy/policy_cert_verifier.h |
| +++ b/chrome/browser/chromeos/policy/policy_cert_verifier.h |
| @@ -12,10 +12,13 @@ |
| #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; |
| } |
| @@ -27,15 +30,21 @@ namespace policy { |
| class PolicyCertVerifier : public net::CertVerifier, |
| public net::CertTrustAnchorProvider { |
| public: |
| - // This object must be created on the UI thread. It's member functions and |
| - // 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. |
| + // This object must be created on the UI thread. |anchor_used_callback| is |
| + // called on the UI thread everytime a certificate from the additional trust |
| + // anchors (set with SetTrustAnchors) is used. This notifications are stopped |
|
Joao da Silva
2013/10/25 11:57:10
*These
pneubeck (no reviews)
2013/10/25 12:17:00
Done.
|
| + // once UnsetTrustAnchorUsedCallback is called. |
| explicit PolicyCertVerifier(const base::Closure& anchor_used_callback); |
| virtual ~PolicyCertVerifier(); |
| void InitializeOnIOThread(); |
| + // To be called on the UI thread. Unsets |anchor_used_callback| from the |
| + // constructor. Until this is called, that callback is run for usages of |
| + // additional trust anchors. |
| + void UnsetTrustAnchorUsedCallback(); |
| + |
| + // To be called on the IO thread. Sets the additional trust anchors. |
| void SetTrustAnchors(const net::CertificateList& trust_anchors); |
| // CertVerifier: |
| @@ -55,10 +64,35 @@ class PolicyCertVerifier : public net::CertVerifier, |
| virtual const net::CertificateList& GetAdditionalTrustAnchors() OVERRIDE; |
| private: |
| + void NotifyOnUI(); |
| + |
| + 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); |
| + |
| + // Access on IO thread. |
| net::CertificateList trust_anchors_; |
| - base::Closure anchor_used_callback_; |
| + |
| + // Access on IO thread. |
| scoped_ptr<CertVerifier> delegate_; |
| + // Access on UI thread. |
| + base::Closure anchor_used_callback_; |
| + |
| + // 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); |
| }; |