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 |
| 17 // A proxy for delegating new STH notifications to all registered | 19 // A proxy for delegating new STH notifications to all registered |
| 18 // observers. | 20 // observers. |
| 19 // For each |observer| registered with RegisterObserver, the | 21 // For each |observer| registered with RegisterObserver, the |
| 20 // NewSTHObserved method will be called whenever the STHDistributor's | 22 // NewSTHObserved method will be called whenever the STHDistributor's |
| 21 // NewSTHObserved method is invoked. | 23 // NewSTHObserved method is invoked. |
| 22 class NET_EXPORT STHDistributor : public STHObserver, public STHReporter { | 24 class NET_EXPORT STHDistributor : public STHObserver, public STHReporter { |
| 23 public: | 25 public: |
| 24 STHDistributor(); | 26 STHDistributor(); |
| 25 ~STHDistributor() override; | 27 ~STHDistributor() override; |
| 26 | 28 |
| 27 // STHObserver implementation. | 29 // STHObserver implementation. |
| 28 void NewSTHObserved(const SignedTreeHead& sth) override; | 30 void NewSTHObserved(const SignedTreeHead& sth) override; |
| 29 | 31 |
| 30 // STHReporter implementation | 32 // STHReporter implementation |
|
Ryan Sleevi
2016/05/13 15:41:12
[NOT FOR THIS CL]
I'm not sure how or why I misse
Eran Messeri
2016/05/16 13:55:14
Acknowledged - it seems possible to remove the STH
| |
| 33 // Registers |observer| for new STH notifications and invokes the | |
| 34 // new STH notification of this |observer| with observed STHs (one | |
| 35 // per log). | |
| 31 void RegisterObserver(STHObserver* observer) override; | 36 void RegisterObserver(STHObserver* observer) override; |
| 37 | |
| 38 // Unregisters |observer|, should only be called with observers | |
| 39 // that were previously registered via RegisterObserver; | |
| 32 void UnregisterObserver(STHObserver* observer) override; | 40 void UnregisterObserver(STHObserver* observer) override; |
| 33 | 41 |
| 34 private: | 42 private: |
| 43 // STHs from logs, one for each log. | |
| 44 std::vector<SignedTreeHead> observed_sths_; | |
|
Ryan Sleevi
2016/05/13 15:41:12
Why doesn't this need to be included or forward de
Eran Messeri
2016/05/16 13:55:14
Done - as you point out I relied on the STHObserve
| |
| 45 | |
| 46 // The observers for new STH notifications. | |
| 35 base::ObserverList<STHObserver> observer_list_; | 47 base::ObserverList<STHObserver> observer_list_; |
| 36 }; | 48 }; |
| 37 | 49 |
| 38 } // namespace ct | 50 } // namespace ct |
| 39 | 51 |
| 40 } // namespace net | 52 } // namespace net |
| 41 | 53 |
| 42 #endif // NET_CERT_STH_DISTRIBUTOR_H_ | 54 #endif // NET_CERT_STH_DISTRIBUTOR_H_ |
| OLD | NEW |