Chromium Code Reviews| Index: chrome/browser/supervised_user/supervised_user_site_list.h |
| diff --git a/chrome/browser/supervised_user/supervised_user_site_list.h b/chrome/browser/supervised_user/supervised_user_site_list.h |
| index 4f813ef2a03ce447ef54afd57177ad5774a888c2..5f71186d8cc711e8cc999d77f1b7adfc79ce00cf 100644 |
| --- a/chrome/browser/supervised_user/supervised_user_site_list.h |
| +++ b/chrome/browser/supervised_user/supervised_user_site_list.h |
| @@ -12,6 +12,7 @@ |
| #include "base/files/file_path.h" |
| #include "base/memory/ref_counted.h" |
| #include "base/memory/scoped_ptr.h" |
| +#include "base/sha1.h" |
| #include "base/strings/string16.h" |
| #include "base/time/time.h" |
| #include "url/gurl.h" |
| @@ -34,6 +35,20 @@ class Value; |
| class SupervisedUserSiteList |
| : public base::RefCountedThreadSafe<SupervisedUserSiteList> { |
| public: |
| + class HostnameHash { |
| + public: |
| + explicit HostnameHash(const std::string& hostname); |
| + // |bytes| must have a size of at least |base::kSHA1Length|. |
| + explicit HostnameHash(const std::vector<uint8>& bytes); |
| + |
| + bool operator==(const HostnameHash& rhs) const; |
| + |
| + const uint8* data() const { return bytes_; } |
| + |
| + private: |
| + uint8 bytes_[base::kSHA1Length]; |
|
Bernhard Bauer
2015/12/01 12:42:32
DISALLOW_COPY_AND_ASSIGN? Or add a comment that co
Marc Treib
2015/12/03 11:21:11
Yeah, I meant to allow copying here. Comment added
|
| + }; |
| + |
| using LoadedCallback = |
| base::Callback<void(const scoped_refptr<SupervisedUserSiteList>&)>; |
| @@ -46,7 +61,7 @@ class SupervisedUserSiteList |
| const base::string16& title() const { return title_; } |
| const GURL& entry_point() const { return entry_point_; } |
| const std::vector<std::string>& patterns() const { return patterns_; } |
| - const std::vector<std::string>& hostname_hashes() const { |
| + const std::vector<HostnameHash>& hostname_hashes() const { |
| return hostname_hashes_; |
| } |
| @@ -73,8 +88,8 @@ class SupervisedUserSiteList |
| // A list of URL patterns that should be whitelisted. |
| std::vector<std::string> patterns_; |
| - // A list of hex-encoded SHA1 hashes of hostnames that should be whitelisted. |
| - std::vector<std::string> hostname_hashes_; |
| + // A list of SHA1 hashes of hostnames that should be whitelisted. |
| + std::vector<HostnameHash> hostname_hashes_; |
| DISALLOW_COPY_AND_ASSIGN(SupervisedUserSiteList); |
| }; |