Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_CERT_STH_DISTRIBUTOR_H_ | 5 #ifndef NET_CERT_STH_DISTRIBUTOR_H_ |
| 6 #define NET_CERT_STH_DISTRIBUTOR_H_ | 6 #define NET_CERT_STH_DISTRIBUTOR_H_ |
| 7 | 7 |
| 8 #include <vector> | |
| 9 | |
| 8 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
| 9 #include "net/base/net_export.h" | 11 #include "net/base/net_export.h" |
| 10 #include "net/cert/sth_observer.h" | 12 #include "net/cert/sth_observer.h" |
| 11 #include "net/cert/sth_reporter.h" | 13 #include "net/cert/sth_reporter.h" |
| 12 | 14 |
| 13 namespace net { | 15 namespace net { |
| 14 | 16 |
| 15 namespace ct { | 17 namespace ct { |
| 16 | 18 |
| 19 struct SignedTreeHead; | |
| 20 | |
| 17 // A proxy for delegating new STH notifications to all registered | 21 // A proxy for delegating new STH notifications to all registered |
| 18 // observers. | 22 // observers. |
| 19 // For each |observer| registered with RegisterObserver, the | 23 // For each |observer| registered with RegisterObserver, the |
| 20 // NewSTHObserved method will be called whenever the STHDistributor's | 24 // NewSTHObserved method will be called whenever the STHDistributor's |
| 21 // NewSTHObserved method is invoked. | 25 // NewSTHObserved method is invoked. |
| 22 class NET_EXPORT STHDistributor : public STHObserver, public STHReporter { | 26 class NET_EXPORT STHDistributor : public STHObserver, public STHReporter { |
| 23 public: | 27 public: |
| 24 STHDistributor(); | 28 STHDistributor(); |
| 25 ~STHDistributor() override; | 29 ~STHDistributor() override; |
| 26 | 30 |
| 27 // STHObserver implementation. | 31 // STHObserver implementation. |
| 28 void NewSTHObserved(const SignedTreeHead& sth) override; | 32 void NewSTHObserved(const SignedTreeHead& sth) override; |
| 29 | 33 |
| 30 // STHReporter implementation | 34 // STHReporter implementation |
| 35 // Registers |observer| for new STH notifications and invokes the | |
| 36 // new STH notification of this |observer| with observed STHs (one | |
| 37 // per log). | |
|
Ryan Sleevi
2016/05/17 16:52:51
Grammar:
Registers |observer| for new STH notifica
Eran Messeri
2016/05/17 17:04:26
Done.
| |
| 31 void RegisterObserver(STHObserver* observer) override; | 38 void RegisterObserver(STHObserver* observer) override; |
| 39 | |
| 40 // Unregisters |observer|, should only be called with observers | |
| 41 // that were previously registered via RegisterObserver; | |
|
Ryan Sleevi
2016/05/17 16:52:51
Style:
// Unregisters |observer|, which must have
Ryan Sleevi
2016/05/17 16:52:51
s/ / / (single space)
Eran Messeri
2016/05/17 17:04:26
Done.
Eran Messeri
2016/05/17 17:04:26
Done.
| |
| 32 void UnregisterObserver(STHObserver* observer) override; | 42 void UnregisterObserver(STHObserver* observer) override; |
| 33 | 43 |
| 34 private: | 44 private: |
| 45 // STHs from logs, one for each log. | |
| 46 std::vector<SignedTreeHead> observed_sths_; | |
| 47 | |
| 48 // The observers for new STH notifications. | |
| 35 base::ObserverList<STHObserver> observer_list_; | 49 base::ObserverList<STHObserver> observer_list_; |
| 36 }; | 50 }; |
| 37 | 51 |
| 38 } // namespace ct | 52 } // namespace ct |
| 39 | 53 |
| 40 } // namespace net | 54 } // namespace net |
| 41 | 55 |
| 42 #endif // NET_CERT_STH_DISTRIBUTOR_H_ | 56 #endif // NET_CERT_STH_DISTRIBUTOR_H_ |
| OLD | NEW |