Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: net/http/transport_security_state.h

Issue 2910473005: Deprecate NonThreadSafe in net/ in favor of SequenceChecker/ThreadChecker. (Closed)
Patch Set: fix compile Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/feature_list.h" 14 #include "base/feature_list.h"
15 #include "base/gtest_prod_util.h" 15 #include "base/gtest_prod_util.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/strings/string_piece.h" 17 #include "base/strings/string_piece.h"
18 #include "base/threading/non_thread_safe.h" 18 #include "base/threading/thread_checker.h"
19 #include "base/time/time.h" 19 #include "base/time/time.h"
20 #include "net/base/expiring_cache.h" 20 #include "net/base/expiring_cache.h"
21 #include "net/base/hash_value.h" 21 #include "net/base/hash_value.h"
22 #include "net/base/net_export.h" 22 #include "net/base/net_export.h"
23 #include "net/cert/signed_certificate_timestamp_and_status.h" 23 #include "net/cert/signed_certificate_timestamp_and_status.h"
24 #include "net/http/transport_security_state_source.h" 24 #include "net/http/transport_security_state_source.h"
25 #include "url/gurl.h" 25 #include "url/gurl.h"
26 26
27 namespace net { 27 namespace net {
28 28
(...skipping 11 matching lines...) Expand all
40 // Tracks which hosts have enabled strict transport security and/or public 40 // Tracks which hosts have enabled strict transport security and/or public
41 // key pins. 41 // key pins.
42 // 42 //
43 // This object manages the in-memory store. Register a Delegate with 43 // This object manages the in-memory store. Register a Delegate with
44 // |SetDelegate| to persist the state to disk. 44 // |SetDelegate| to persist the state to disk.
45 // 45 //
46 // HTTP strict transport security (HSTS) is defined in 46 // HTTP strict transport security (HSTS) is defined in
47 // http://tools.ietf.org/html/ietf-websec-strict-transport-sec, and 47 // http://tools.ietf.org/html/ietf-websec-strict-transport-sec, and
48 // HTTP-based dynamic public key pinning (HPKP) is defined in 48 // HTTP-based dynamic public key pinning (HPKP) is defined in
49 // http://tools.ietf.org/html/ietf-websec-key-pinning. 49 // http://tools.ietf.org/html/ietf-websec-key-pinning.
50 class NET_EXPORT TransportSecurityState 50 class NET_EXPORT TransportSecurityState {
51 : NON_EXPORTED_BASE(public base::NonThreadSafe) {
52 public: 51 public:
53 class NET_EXPORT Delegate { 52 class NET_EXPORT Delegate {
54 public: 53 public:
55 // This function may not block and may be called with internal locks held. 54 // This function may not block and may be called with internal locks held.
56 // Thus it must not reenter the TransportSecurityState object. 55 // Thus it must not reenter the TransportSecurityState object.
57 virtual void StateIsDirty(TransportSecurityState* state) = 0; 56 virtual void StateIsDirty(TransportSecurityState* state) = 0;
58 57
59 protected: 58 protected:
60 virtual ~Delegate() {} 59 virtual ~Delegate() {}
61 }; 60 };
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 // SetExpectCTReporter). 558 // SetExpectCTReporter).
560 // 559 //
561 // The header can also have the value "preload", indicating that the site 560 // The header can also have the value "preload", indicating that the site
562 // wants to opt-in to the static report-only version of Expect-CT. If the 561 // wants to opt-in to the static report-only version of Expect-CT. If the
563 // given host is present on the preload list and the build is timely and the 562 // given host is present on the preload list and the build is timely and the
564 // connection is not CT-compliant, then a report will be sent. 563 // connection is not CT-compliant, then a report will be sent.
565 void ProcessExpectCTHeader(const std::string& value, 564 void ProcessExpectCTHeader(const std::string& value,
566 const HostPortPair& host_port_pair, 565 const HostPortPair& host_port_pair,
567 const SSLInfo& ssl_info); 566 const SSLInfo& ssl_info);
568 567
568 void AssertCalledOnValidThread() const {
569 DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
570 }
571
569 // For unit tests only. Causes CheckCTRequirements() to return 572 // For unit tests only. Causes CheckCTRequirements() to return
570 // CT_REQUIREMENTS_NOT_MET (if |*required| is true) or CT_REQUIREMENTS_MET (if 573 // CT_REQUIREMENTS_NOT_MET (if |*required| is true) or CT_REQUIREMENTS_MET (if
571 // |*required| is false) for non-compliant connections by default (that is, 574 // |*required| is false) for non-compliant connections by default (that is,
572 // unless a RequireCTDelegate overrides). Set to nullptr to reset. 575 // unless a RequireCTDelegate overrides). Set to nullptr to reset.
573 static void SetShouldRequireCTForTesting(bool* required); 576 static void SetShouldRequireCTForTesting(bool* required);
574 577
575 // For unit tests only. Clears the caches that deduplicate sent HPKP and 578 // For unit tests only. Clears the caches that deduplicate sent HPKP and
576 // Expect-CT reports. 579 // Expect-CT reports.
577 void ClearReportCachesForTesting(); 580 void ClearReportCachesForTesting();
578 581
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 709
707 ExpectCTReporter* expect_ct_reporter_ = nullptr; 710 ExpectCTReporter* expect_ct_reporter_ = nullptr;
708 711
709 RequireCTDelegate* require_ct_delegate_ = nullptr; 712 RequireCTDelegate* require_ct_delegate_ = nullptr;
710 713
711 // Keeps track of reports that have been sent recently for 714 // Keeps track of reports that have been sent recently for
712 // rate-limiting. 715 // rate-limiting.
713 ReportCache sent_hpkp_reports_cache_; 716 ReportCache sent_hpkp_reports_cache_;
714 ReportCache sent_expect_ct_reports_cache_; 717 ReportCache sent_expect_ct_reports_cache_;
715 718
719 THREAD_CHECKER(thread_checker_);
720
716 DISALLOW_COPY_AND_ASSIGN(TransportSecurityState); 721 DISALLOW_COPY_AND_ASSIGN(TransportSecurityState);
717 }; 722 };
718 723
719 } // namespace net 724 } // namespace net
720 725
721 #endif // NET_HTTP_TRANSPORT_SECURITY_STATE_H_ 726 #endif // NET_HTTP_TRANSPORT_SECURITY_STATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698