Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef NET_CERT_CT_EV_WHITELIST_H_ | |
| 6 #define NET_CERT_CT_EV_WHITELIST_H_ | |
| 7 | |
| 8 #include <set> | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/files/file_path.h" | |
| 12 #include "net/base/net_export.h" | |
|
wtc
2014/08/14 02:04:43
Nit: Remove this header. Actually, I think we will
Eran Messeri
2014/08/14 11:55:07
Added NET_EXPORT & NET_EXPORT_PRIVATE where (I thi
| |
| 13 | |
| 14 namespace net { | |
| 15 | |
| 16 namespace ct { | |
| 17 | |
| 18 namespace internal { | |
| 19 | |
| 20 class BitStreamReader { | |
|
wtc
2014/08/14 02:04:43
Nit: please add a short comment to summarize this
Eran Messeri
2014/08/14 11:55:07
Done.
Eran Messeri
2014/08/14 11:55:08
Done.
| |
| 21 public: | |
| 22 BitStreamReader(const char* source, size_t length); | |
| 23 | |
| 24 // Reads unary-encoded number into |out|. Returns true if | |
| 25 // there was at least one bit to read, false otherwise. | |
| 26 bool ReadUnaryEncoding(uint64* out); | |
| 27 // Reads |num_bits| (up to 64) into |out|. Returns true if | |
| 28 // the stream had the requested |num_bits|, false otherwise. | |
| 29 bool ReadBits(uint8 num_bits, uint64* out); | |
| 30 // Returns the number of bits left in the stream. | |
| 31 uint64 BitsLeft(); | |
|
wtc
2014/08/14 02:04:43
Nit: Declare this method as const.
Eran Messeri
2014/08/14 11:55:08
Done.
| |
| 32 | |
| 33 private: | |
| 34 // Returns true if there are more bits to read in the stream. | |
| 35 bool HasMoreBits(); | |
| 36 // Reads a single bit. | |
| 37 uint8 ReadBit(); | |
| 38 | |
| 39 const char* source_; | |
| 40 const size_t length_; | |
|
wtc
2014/08/14 02:04:44
Nit: To match this 'const', the |source_| member s
Eran Messeri
2014/08/14 11:55:07
Done.
| |
| 41 | |
| 42 uint64 curr_byte_; | |
| 43 int8 curr_bit_; | |
| 44 }; | |
| 45 | |
| 46 bool UncompressEVWhitelist( | |
| 47 const std::string& compressed_whitelist, | |
| 48 std::set<std::string>* uncompressed_list); | |
| 49 | |
| 50 void SetEVWhitelistData(std::set<std::string> ev_whitelist); | |
|
wtc
2014/08/14 02:04:44
Nit: Should the input parameter be a const referen
Eran Messeri
2014/08/14 11:55:07
No, because I'm using set.swap underneath. Will ad
| |
| 51 | |
| 52 } // namespace internal | |
| 53 | |
| 54 | |
|
wtc
2014/08/14 02:04:43
Nit: delete a blank line.
Eran Messeri
2014/08/14 11:55:08
Done.
| |
| 55 void SetEVWhitelistFromFile(const base::FilePath& compressed_whitelist_file); | |
| 56 | |
| 57 bool IsCertificateHashInWhitelist(const std::string& cert_hash); | |
| 58 | |
| 59 } // namespace ct | |
| 60 | |
| 61 } // namespace net | |
| 62 | |
| 63 #endif // NET_CERT_CT_EV_WHITELIST_H_ | |
| OLD | NEW |