Chromium Code Reviews| Index: components/certificate_transparency/tree_state_tracker.h |
| diff --git a/components/certificate_transparency/tree_state_tracker.h b/components/certificate_transparency/tree_state_tracker.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..254c97addbad75d51bd86eef4e4bb76b4ce20ce0 |
| --- /dev/null |
| +++ b/components/certificate_transparency/tree_state_tracker.h |
| @@ -0,0 +1,69 @@ |
| +// Copyright 2016 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 COMPONENTS_CERTIFICATE_TRANSPARENCY_TREE_STATE_TRACKER_H_ |
| +#define COMPONENTS_CERTIFICATE_TRANSPARENCY_TREE_STATE_TRACKER_H_ |
| + |
| +#include <map> |
| +#include <memory> |
| +#include <string> |
| +#include <vector> |
| + |
| +#include "base/memory/ref_counted.h" |
| +#include "net/cert/ct_verifier.h" |
| +#include "net/cert/sth_observer.h" |
| + |
| +namespace net { |
| +class CTLogVerifier; |
| +class X509Certificate; |
| + |
| +namespace ct { |
| +struct SignedCertificateTimestamp; |
| +struct SignedTreeHead; |
| +} // namespace ct |
| + |
| +} // namespace net |
| + |
| +namespace certificate_transparency { |
| +class SingleTreeTracker; |
| + |
| +// Starting point for handling observed Certificate Transparency data in |
| +// a particular browsing session. |
| +// This class receives notifications of new Signed Tree Heads (STHs) and |
| +// verified Signed Certificate Timestamps (SCTs) and delegates them to |
| +// the SingleTreeTracker tracking the CT log they relate to. |
| +// TODO(eranm): Export the inclusion check status of SCTs+Certs so it can |
| +// be used in the DevTools Security panel, for example - crbug.com/506227 |
| +class TreeStateTracker : public net::CTVerifier::Observer, |
| + public net::ct::STHObserver { |
| + public: |
| + explicit TreeStateTracker( |
| + std::vector<scoped_refptr<const net::CTLogVerifier>> ct_logs); |
|
Sorin Jianu
2016/05/11 17:03:39
maybe pass by ref to const?
Eran Messeri
2016/05/12 17:04:49
IIRC Ryan discouraged me from doing so in another
Ryan Sleevi
2016/05/12 17:09:12
That was only for when you were taking ownership (
Eran Messeri
2016/05/16 14:44:39
Acknowledged.
|
| + ~TreeStateTracker() override; |
| + |
| + // net::ct::CTVerifier::Observer implementation. |
| + // Delegates to the tree tracker corresponding to the log that issued the SCT. |
| + // Should only be called with SCTs from logs present in the |ct_logs| list |
| + // passed into the constructor. |
| + void OnSCTVerified(net::X509Certificate* cert, |
| + const net::ct::SignedCertificateTimestamp* sct) override; |
| + |
| + // net::ct::STHObserver implementation. |
| + // Delegates to the tree tracker corresponding to the log that issued the STH. |
| + // May be called with any STH, not only ones issued by logs provided in the |
| + // |ct_logs| list passed into the constructor. |
| + // TODO(eranm): When the caller filters out STHs for us, DCHECK that the |
| + // |sth| is from a known log. |
| + void NewSTHObserved(const net::ct::SignedTreeHead& sth) override; |
| + |
| + private: |
| + // Holds the SingleTreeTracker for each log |
| + std::map<std::string, std::unique_ptr<SingleTreeTracker>> tree_trackers_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(TreeStateTracker); |
| +}; |
| + |
| +} // namespace certificate_transparency |
| + |
| +#endif // COMPONENTS_CERTIFICATE_TRANSPARENCY_TREE_STATE_TRACKER_H_ |