| 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> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/strings/string_piece.h" |
| 16 #include "base/threading/non_thread_safe.h" | 17 #include "base/threading/non_thread_safe.h" |
| 17 #include "base/time/time.h" | 18 #include "base/time/time.h" |
| 18 #include "net/base/expiring_cache.h" | 19 #include "net/base/expiring_cache.h" |
| 19 #include "net/base/hash_value.h" | 20 #include "net/base/hash_value.h" |
| 20 #include "net/base/net_export.h" | 21 #include "net/base/net_export.h" |
| 21 #include "url/gurl.h" | 22 #include "url/gurl.h" |
| 22 | 23 |
| 23 namespace net { | 24 namespace net { |
| 24 | 25 |
| 25 class HostPortPair; | 26 class HostPortPair; |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 // The URI reports are sent to if a valid OCSP response is not stapled | 246 // The URI reports are sent to if a valid OCSP response is not stapled |
| 246 GURL report_uri; | 247 GURL report_uri; |
| 247 | 248 |
| 248 // True if subdomains are subject to this policy | 249 // True if subdomains are subject to this policy |
| 249 bool include_subdomains; | 250 bool include_subdomains; |
| 250 }; | 251 }; |
| 251 | 252 |
| 252 // An interface for asynchronously sending HPKP violation reports. | 253 // An interface for asynchronously sending HPKP violation reports. |
| 253 class NET_EXPORT ReportSenderInterface { | 254 class NET_EXPORT ReportSenderInterface { |
| 254 public: | 255 public: |
| 255 // Sends the given serialized |report| to |report_uri|. | 256 // Sends the given serialized |report| to |report_uri| with |
| 256 virtual void Send(const GURL& report_uri, const std::string& report) = 0; | 257 // Content-Type header as specified in |
| 258 // |content_type|. |content_type| should be non-empty. |
| 259 virtual void Send(const GURL& report_uri, |
| 260 base::StringPiece content_type, |
| 261 base::StringPiece report) = 0; |
| 257 | 262 |
| 258 // Sets a callback to be called when report sending fails. | 263 // Sets a callback to be called when report sending fails. |
| 259 virtual void SetErrorCallback( | 264 virtual void SetErrorCallback( |
| 260 const base::Callback<void(const GURL&, int)>& error_callback) = 0; | 265 const base::Callback<void(const GURL&, int)>& error_callback) = 0; |
| 261 | 266 |
| 262 protected: | 267 protected: |
| 263 virtual ~ReportSenderInterface() {} | 268 virtual ~ReportSenderInterface() {} |
| 264 }; | 269 }; |
| 265 | 270 |
| 266 // An interface for building and asynchronously sending reports when a | 271 // An interface for building and asynchronously sending reports when a |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 // rate-limiting. | 594 // rate-limiting. |
| 590 ExpiringCache<std::string, bool, base::TimeTicks, std::less<base::TimeTicks>> | 595 ExpiringCache<std::string, bool, base::TimeTicks, std::less<base::TimeTicks>> |
| 591 sent_reports_cache_; | 596 sent_reports_cache_; |
| 592 | 597 |
| 593 DISALLOW_COPY_AND_ASSIGN(TransportSecurityState); | 598 DISALLOW_COPY_AND_ASSIGN(TransportSecurityState); |
| 594 }; | 599 }; |
| 595 | 600 |
| 596 } // namespace net | 601 } // namespace net |
| 597 | 602 |
| 598 #endif // NET_HTTP_TRANSPORT_SECURITY_STATE_H_ | 603 #endif // NET_HTTP_TRANSPORT_SECURITY_STATE_H_ |
| OLD | NEW |