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_SSL_CHROME_SSL_HOST_STATE_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_SSL_CHROME_SSL_HOST_STATE_DELEGATE_H_ |
6 #define CHROME_BROWSER_SSL_CHROME_SSL_HOST_STATE_DELEGATE_H_ | 6 #define CHROME_BROWSER_SSL_CHROME_SSL_HOST_STATE_DELEGATE_H_ |
7 | 7 |
8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 virtual ~ChromeSSLHostStateDelegate(); | 28 virtual ~ChromeSSLHostStateDelegate(); |
29 | 29 |
30 // SSLHostStateDelegate: | 30 // SSLHostStateDelegate: |
31 virtual void DenyCert(const std::string& host, | 31 virtual void DenyCert(const std::string& host, |
32 net::X509Certificate* cert, | 32 net::X509Certificate* cert, |
33 net::CertStatus error) OVERRIDE; | 33 net::CertStatus error) OVERRIDE; |
34 virtual void AllowCert(const std::string& host, | 34 virtual void AllowCert(const std::string& host, |
35 net::X509Certificate* cert, | 35 net::X509Certificate* cert, |
36 net::CertStatus error) OVERRIDE; | 36 net::CertStatus error) OVERRIDE; |
37 virtual void Clear() OVERRIDE; | 37 virtual void Clear() OVERRIDE; |
38 virtual net::CertPolicy::Judgment QueryPolicy(const std::string& host, | 38 virtual net::CertPolicy::Judgment QueryPolicy( |
39 net::X509Certificate* cert, | 39 const std::string& host, |
40 net::CertStatus error) OVERRIDE; | 40 net::X509Certificate* cert, |
| 41 net::CertStatus error, |
| 42 bool* expired_previous_decision) OVERRIDE; |
41 virtual void HostRanInsecureContent(const std::string& host, | 43 virtual void HostRanInsecureContent(const std::string& host, |
42 int pid) OVERRIDE; | 44 int pid) OVERRIDE; |
43 virtual bool DidHostRunInsecureContent(const std::string& host, | 45 virtual bool DidHostRunInsecureContent(const std::string& host, |
44 int pid) const OVERRIDE; | 46 int pid) const OVERRIDE; |
45 | 47 |
46 // ChromeSSLHostStateDelegate implementation: | 48 // ChromeSSLHostStateDelegate implementation: |
47 // Revoke all user decisions for |host| in the given Profile. The | 49 // Revoke all user decisions for |host| in the given Profile. The |
48 // RevokeUserDecisionsHard version may close idle connections in the process. | 50 // RevokeUserDecisionsHard version may close idle connections in the process. |
49 // This version should be used *only* for rare events, such as a user | 51 // This version should be used *only* for rare events, such as a user |
50 // controlled button, as it may be very disruptive to the networking stack. | 52 // controlled button, as it may be very disruptive to the networking stack. |
51 virtual void RevokeUserDecisions(const std::string& host); | 53 virtual void RevokeUserDecisions(const std::string& host); |
52 virtual void RevokeUserDecisionsHard(const std::string& host); | 54 virtual void RevokeUserDecisionsHard(const std::string& host); |
53 | 55 |
54 // Returns true if any decisions has been recorded for |host| for the given | 56 // Returns true if any decisions has been recorded for |host| for the given |
55 // Profile, otherwise false. | 57 // Profile, otherwise false. |
56 virtual bool HasUserDecision(const std::string& host); | 58 virtual bool HasUserDecision(const std::string& host); |
57 | 59 |
58 // Called on the UI thread when the profile is about to be destroyed. | 60 // Called on the UI thread when the profile is about to be destroyed. |
59 void ShutdownOnUIThread() {} | 61 void ShutdownOnUIThread() {} |
60 | 62 |
61 protected: | 63 protected: |
62 // SetClock takes ownership of the passed in clock. | 64 // SetClock takes ownership of the passed in clock. |
63 void SetClock(scoped_ptr<base::Clock> clock); | 65 void SetClock(scoped_ptr<base::Clock> clock); |
64 | 66 |
65 private: | 67 private: |
66 FRIEND_TEST_ALL_PREFIXES(ForgetInstantlySSLHostStateDelegateTest, | 68 FRIEND_TEST_ALL_PREFIXES(ForgetInstantlySSLHostStateDelegateTest, |
67 MakeAndForgetException); | 69 MakeAndForgetException); |
68 FRIEND_TEST_ALL_PREFIXES(RememberSSLHostStateDelegateTest, AfterRestart); | 70 FRIEND_TEST_ALL_PREFIXES(RememberSSLHostStateDelegateTest, AfterRestart); |
| 71 FRIEND_TEST_ALL_PREFIXES(RememberSSLHostStateDelegateTest, |
| 72 QueryPolicyExpired); |
69 | 73 |
70 // Used to specify whether new content setting entries should be created if | 74 // Used to specify whether new content setting entries should be created if |
71 // they don't already exist when querying the user's settings. | 75 // they don't already exist when querying the user's settings. |
72 enum CreateDictionaryEntriesDisposition { | 76 enum CreateDictionaryEntriesDisposition { |
73 CreateDictionaryEntries, | 77 CreateDictionaryEntries, |
74 DoNotCreateDictionaryEntries | 78 DoNotCreateDictionaryEntries |
75 }; | 79 }; |
76 | 80 |
77 // Specifies whether user SSL error decisions should be forgetten at the end | 81 // Specifies whether user SSL error decisions should be forgetten at the end |
78 // of this current session (the old style of remembering decisions), or | 82 // of this current session (the old style of remembering decisions), or |
(...skipping 19 matching lines...) Expand all Loading... |
98 // ChangeCertPolicy. Returns NULL on a failure. | 102 // ChangeCertPolicy. Returns NULL on a failure. |
99 // | 103 // |
100 // |dict| specifies the user's full exceptions dictionary for a specific site | 104 // |dict| specifies the user's full exceptions dictionary for a specific site |
101 // in their content settings. Must be retrieved directly from a website | 105 // in their content settings. Must be retrieved directly from a website |
102 // setting in the the profile's HostContentSettingsMap. | 106 // setting in the the profile's HostContentSettingsMap. |
103 // | 107 // |
104 // If |create_entries| specifies CreateDictionaryEntries, then | 108 // If |create_entries| specifies CreateDictionaryEntries, then |
105 // GetValidCertDecisionsDict will create a new set of entries within the | 109 // GetValidCertDecisionsDict will create a new set of entries within the |
106 // dictionary if they do not already exist. Otherwise will fail and return if | 110 // dictionary if they do not already exist. Otherwise will fail and return if |
107 // NULL if they do not exist. | 111 // NULL if they do not exist. |
| 112 // |
| 113 // |expired_previous_decision| is set to true if there had been a previous |
| 114 // decision made by the user but it has expired. Otherwise it is set to false. |
108 base::DictionaryValue* GetValidCertDecisionsDict( | 115 base::DictionaryValue* GetValidCertDecisionsDict( |
109 base::DictionaryValue* dict, | 116 base::DictionaryValue* dict, |
110 CreateDictionaryEntriesDisposition create_entries); | 117 CreateDictionaryEntriesDisposition create_entries, |
| 118 bool* expired_previous_decision); |
111 | 119 |
112 scoped_ptr<base::Clock> clock_; | 120 scoped_ptr<base::Clock> clock_; |
113 RememberSSLExceptionDecisionsDisposition should_remember_ssl_decisions_; | 121 RememberSSLExceptionDecisionsDisposition should_remember_ssl_decisions_; |
114 base::TimeDelta default_ssl_cert_decision_expiration_delta_; | 122 base::TimeDelta default_ssl_cert_decision_expiration_delta_; |
115 Profile* profile_; | 123 Profile* profile_; |
116 | 124 |
117 // A BrokenHostEntry is a pair of (host, process_id) that indicates the host | 125 // A BrokenHostEntry is a pair of (host, process_id) that indicates the host |
118 // contains insecure content in that renderer process. | 126 // contains insecure content in that renderer process. |
119 typedef std::pair<std::string, int> BrokenHostEntry; | 127 typedef std::pair<std::string, int> BrokenHostEntry; |
120 | 128 |
121 // Hosts which have been contaminated with insecure content in the | 129 // Hosts which have been contaminated with insecure content in the |
122 // specified process. Note that insecure content can travel between | 130 // specified process. Note that insecure content can travel between |
123 // same-origin frames in one processs but cannot jump between processes. | 131 // same-origin frames in one processs but cannot jump between processes. |
124 std::set<BrokenHostEntry> ran_insecure_content_hosts_; | 132 std::set<BrokenHostEntry> ran_insecure_content_hosts_; |
125 | 133 |
126 DISALLOW_COPY_AND_ASSIGN(ChromeSSLHostStateDelegate); | 134 DISALLOW_COPY_AND_ASSIGN(ChromeSSLHostStateDelegate); |
127 }; | 135 }; |
128 | 136 |
129 #endif // CHROME_BROWSER_SSL_CHROME_SSL_HOST_STATE_DELEGATE_H_ | 137 #endif // CHROME_BROWSER_SSL_CHROME_SSL_HOST_STATE_DELEGATE_H_ |
OLD | NEW |