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 COMPONENTS_SAFE_BROWSING_DB_V4_GET_HASH_PROTOCOL_MANAGER_H_ | 5 #ifndef COMPONENTS_SAFE_BROWSING_DB_V4_GET_HASH_PROTOCOL_MANAGER_H_ |
| 6 #define COMPONENTS_SAFE_BROWSING_DB_V4_GET_HASH_PROTOCOL_MANAGER_H_ | 6 #define COMPONENTS_SAFE_BROWSING_DB_V4_GET_HASH_PROTOCOL_MANAGER_H_ |
| 7 | 7 |
| 8 // A class that implements Chrome's interface with the SafeBrowsing V4 protocol. | 8 // A class that implements Chrome's interface with the SafeBrowsing V4 protocol. |
| 9 // | 9 // |
| 10 // The V4GetHashProtocolManager handles formatting and making requests of, and | 10 // The V4GetHashProtocolManager handles formatting and making requests of, and |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 131 | 131 |
| 132 // Resets the gethash error counter and multiplier. | 132 // Resets the gethash error counter and multiplier. |
| 133 void ResetGetHashErrors(); | 133 void ResetGetHashErrors(); |
| 134 | 134 |
| 135 // Updates internal state for each GetHash response error, assuming that | 135 // Updates internal state for each GetHash response error, assuming that |
| 136 // the current time is |now|. | 136 // the current time is |now|. |
| 137 void HandleGetHashError(const base::Time& now); | 137 void HandleGetHashError(const base::Time& now); |
| 138 | 138 |
| 139 private: | 139 private: |
| 140 // Map of GetHash requests to parameters which created it. | 140 // Map of GetHash requests to parameters which created it. |
| 141 typedef base::hash_map<const net::URLFetcher*, FullHashCallback> HashRequests; | 141 struct FetcherAndCallback; |
| 142 typedef base::hash_map<const net::URLFetcher*, | |
|
vabr (Chromium)
2016/08/29 09:14:50
drive-by nit:
https://chromium-cpp.appspot.com/ pr
Avi (use Gerrit)
2016/08/29 18:04:24
Done.
| |
| 143 std::unique_ptr<FetcherAndCallback>> | |
|
mattm
2016/08/27 01:43:25
Is the unique_ptr here so FetcherAndCallback can b
Avi (use Gerrit)
2016/08/29 18:04:24
I actually don't remember why I did it that specif
| |
| 144 HashRequests; | |
| 142 | 145 |
| 143 // The factory that controls the creation of V4GetHashProtocolManager. | 146 // The factory that controls the creation of V4GetHashProtocolManager. |
| 144 // This is used by tests. | 147 // This is used by tests. |
| 145 static V4GetHashProtocolManagerFactory* factory_; | 148 static V4GetHashProtocolManagerFactory* factory_; |
| 146 | 149 |
| 147 // Current active request (in case we need to cancel) for updates or chunks | 150 // Current active request (in case we need to cancel) for updates or chunks |
| 148 // from the SafeBrowsing service. We can only have one of these outstanding | 151 // from the SafeBrowsing service. We can only have one of these outstanding |
| 149 // at any given time unlike GetHash requests, which are tracked separately. | 152 // at any given time unlike GetHash requests, which are tracked separately. |
| 150 std::unique_ptr<net::URLFetcher> request_; | 153 std::unique_ptr<net::URLFetcher> request_; |
| 151 | 154 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 187 net::URLRequestContextGetter* request_context_getter, | 190 net::URLRequestContextGetter* request_context_getter, |
| 188 const V4ProtocolConfig& config) = 0; | 191 const V4ProtocolConfig& config) = 0; |
| 189 | 192 |
| 190 private: | 193 private: |
| 191 DISALLOW_COPY_AND_ASSIGN(V4GetHashProtocolManagerFactory); | 194 DISALLOW_COPY_AND_ASSIGN(V4GetHashProtocolManagerFactory); |
| 192 }; | 195 }; |
| 193 | 196 |
| 194 } // namespace safe_browsing | 197 } // namespace safe_browsing |
| 195 | 198 |
| 196 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_GET_HASH_PROTOCOL_MANAGER_H_ | 199 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_GET_HASH_PROTOCOL_MANAGER_H_ |
| OLD | NEW |