Chromium Code Reviews| Index: components/certificate_transparency/timestamped_leaf.h |
| diff --git a/components/certificate_transparency/timestamped_leaf.h b/components/certificate_transparency/timestamped_leaf.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a37578e9f3318a3f026d3f459d9b372b60bcbe76 |
| --- /dev/null |
| +++ b/components/certificate_transparency/timestamped_leaf.h |
| @@ -0,0 +1,35 @@ |
| +// 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_TIMESTAMPED_LEAF_H_ |
| +#define COMPONENTS_CERTIFICATE_TRANSPARENCY_TIMESTAMPED_LEAF_H_ |
| + |
| +#include "base/optional.h" |
| +#include "base/time/time.h" |
| +#include "net/cert/merkle_tree_leaf.h" |
|
Rob Percival
2016/06/30 14:15:58
#include <stdint.h> // for uint64_t
Eran Messeri
2016/06/30 19:58:28
Done.
|
| + |
| +class TimestampedLeaf { |
|
Rob Percival
2016/06/30 14:15:58
It might be better to have this inherit from Merkl
Eran Messeri
2016/06/30 19:58:28
I'd rather keep it a separate class:
- Detangling
|
| + public: |
| + TimestampedLeaf(const net::ct::MerkleTreeLeaf& leaf, |
| + const base::Time& seen_at); |
| + TimestampedLeaf(const TimestampedLeaf& other); |
| + ~TimestampedLeaf(); |
| + |
| + void SetLeafIndex(uint64_t index); |
| + bool HasLeafIndex(); |
| + uint64_t GetLeafIndex(); |
|
Rob Percival
2016/06/30 14:15:58
HasLeafIndex() and GetLeafIndex() should be const.
Eran Messeri
2016/06/30 19:58:28
Done.
|
| + net::ct::MerkleTreeLeaf GetLeaf(); |
|
Rob Percival
2016/06/30 14:15:58
What's the point in having a non-const version of
Eran Messeri
2016/06/30 19:58:28
No point, removed.
|
| + const net::ct::MerkleTreeLeaf& GetLeaf() const; |
| + |
| + private: |
| + // The entire leaf for the certificate. |
| + net::ct::MerkleTreeLeaf leaf_; |
| + // When the leaf for the particular certificate was first seen. |
| + base::Time first_seen_; |
| + // The leaf's index in the tree. Only set if the index has been |
| + // obtained from the log. |
| + base::Optional<uint64_t> leaf_index_; |
| +}; |
| + |
| +#endif // COMPONENTS_CERTIFICATE_TRANSPARENCY_TIMESTAMPED_LEAF_H_ |