| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SITE_LIST_H_ | 5 #ifndef CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SITE_LIST_H_ |
| 6 #define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SITE_LIST_H_ | 6 #define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SITE_LIST_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // SupervisedUserURLFilter then acts as a big whitelist which is the union of | 39 // SupervisedUserURLFilter then acts as a big whitelist which is the union of |
| 40 // all the whitelists. | 40 // all the whitelists. |
| 41 class SupervisedUserSiteList | 41 class SupervisedUserSiteList |
| 42 : public base::RefCountedThreadSafe<SupervisedUserSiteList> { | 42 : public base::RefCountedThreadSafe<SupervisedUserSiteList> { |
| 43 public: | 43 public: |
| 44 class HostnameHash { | 44 class HostnameHash { |
| 45 public: | 45 public: |
| 46 explicit HostnameHash(const std::string& hostname); | 46 explicit HostnameHash(const std::string& hostname); |
| 47 // |bytes| must have a size of at least |base::kSHA1Length|. | 47 // |bytes| must have a size of at least |base::kSHA1Length|. |
| 48 explicit HostnameHash(const std::vector<uint8_t>& bytes); | 48 explicit HostnameHash(const std::vector<uint8_t>& bytes); |
| 49 HostnameHash(const HostnameHash& other); |
| 49 | 50 |
| 50 bool operator==(const HostnameHash& rhs) const; | 51 bool operator==(const HostnameHash& rhs) const; |
| 51 | 52 |
| 52 // Returns a hash code suitable for putting this into hash maps. | 53 // Returns a hash code suitable for putting this into hash maps. |
| 53 size_t hash() const; | 54 size_t hash() const; |
| 54 | 55 |
| 55 private: | 56 private: |
| 56 std::array<uint8_t, base::kSHA1Length> bytes_; | 57 std::array<uint8_t, base::kSHA1Length> bytes_; |
| 57 // Copy and assign are allowed. | 58 // Copy and assign are allowed. |
| 58 }; | 59 }; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 // A list of URL patterns that should be whitelisted. | 112 // A list of URL patterns that should be whitelisted. |
| 112 std::vector<std::string> patterns_; | 113 std::vector<std::string> patterns_; |
| 113 | 114 |
| 114 // A list of SHA1 hashes of hostnames that should be whitelisted. | 115 // A list of SHA1 hashes of hostnames that should be whitelisted. |
| 115 std::vector<HostnameHash> hostname_hashes_; | 116 std::vector<HostnameHash> hostname_hashes_; |
| 116 | 117 |
| 117 DISALLOW_COPY_AND_ASSIGN(SupervisedUserSiteList); | 118 DISALLOW_COPY_AND_ASSIGN(SupervisedUserSiteList); |
| 118 }; | 119 }; |
| 119 | 120 |
| 120 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SITE_LIST_H_ | 121 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SITE_LIST_H_ |
| OLD | NEW |