OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 NET_HTTP_TRANSPORT_SECURITY_STATE_H_ | 5 #ifndef NET_HTTP_TRANSPORT_SECURITY_STATE_H_ |
6 #define NET_HTTP_TRANSPORT_SECURITY_STATE_H_ | 6 #define NET_HTTP_TRANSPORT_SECURITY_STATE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 // True if subdomains are subject to this policy | 277 // True if subdomains are subject to this policy |
278 bool include_subdomains; | 278 bool include_subdomains; |
279 }; | 279 }; |
280 | 280 |
281 // An interface for asynchronously sending HPKP violation reports. | 281 // An interface for asynchronously sending HPKP violation reports. |
282 class NET_EXPORT ReportSenderInterface { | 282 class NET_EXPORT ReportSenderInterface { |
283 public: | 283 public: |
284 // Sends the given serialized |report| to |report_uri| with | 284 // Sends the given serialized |report| to |report_uri| with |
285 // Content-Type header as specified in | 285 // Content-Type header as specified in |
286 // |content_type|. |content_type| should be non-empty. | 286 // |content_type|. |content_type| should be non-empty. |
287 // |report_id| could be any non-negative integer. It's passed back to the | 287 // |success_callback| is called iff an HTTP 200 response is received. |
288 // error or success callbacks. | 288 // |error_callback| is called in all other cases. Error callback's |
289 virtual void Send( | 289 // |net_error| can be net::OK if the upload was successful but the server |
290 const GURL& report_uri, | 290 // returned a non-HTTP 200 |http_response_code|. In all other cases, |
291 base::StringPiece content_type, | 291 // error callback's |http_response_code| is -1. |
292 base::StringPiece report, | 292 virtual void Send(const GURL& report_uri, |
293 const base::Callback<void()>& success_callback, | 293 base::StringPiece content_type, |
294 const base::Callback<void(const GURL&, int)>& error_callback) = 0; | 294 base::StringPiece report, |
| 295 const base::Callback<void()>& success_callback, |
| 296 const base::Callback<void(const GURL&, |
| 297 int /* net_error */, |
| 298 int /* http_response_code */)>& |
| 299 error_callback) = 0; |
295 | 300 |
296 protected: | 301 protected: |
297 virtual ~ReportSenderInterface() {} | 302 virtual ~ReportSenderInterface() {} |
298 }; | 303 }; |
299 | 304 |
300 // An interface for building and asynchronously sending reports when a | 305 // An interface for building and asynchronously sending reports when a |
301 // site expects valid Certificate Transparency information but it | 306 // site expects valid Certificate Transparency information but it |
302 // wasn't supplied. | 307 // wasn't supplied. |
303 class NET_EXPORT ExpectCTReporter { | 308 class NET_EXPORT ExpectCTReporter { |
304 public: | 309 public: |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 // rate-limiting. | 653 // rate-limiting. |
649 ExpiringCache<std::string, bool, base::TimeTicks, std::less<base::TimeTicks>> | 654 ExpiringCache<std::string, bool, base::TimeTicks, std::less<base::TimeTicks>> |
650 sent_reports_cache_; | 655 sent_reports_cache_; |
651 | 656 |
652 DISALLOW_COPY_AND_ASSIGN(TransportSecurityState); | 657 DISALLOW_COPY_AND_ASSIGN(TransportSecurityState); |
653 }; | 658 }; |
654 | 659 |
655 } // namespace net | 660 } // namespace net |
656 | 661 |
657 #endif // NET_HTTP_TRANSPORT_SECURITY_STATE_H_ | 662 #endif // NET_HTTP_TRANSPORT_SECURITY_STATE_H_ |
OLD | NEW |