| 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 RevokeAllowAndDenyPreferences(const std::string& host) OVERRIDE; | 43 virtual void RevokeAllowAndDenyPreferences(const std::string& host) OVERRIDE; |
| 42 virtual bool HasAllowedOrDeniedCert(const std::string& host) OVERRIDE; | 44 virtual bool HasAllowedOrDeniedCert(const std::string& host) OVERRIDE; |
| 43 | 45 |
| 44 // Called on the UI thread when the profile is about to be destroyed. | 46 // Called on the UI thread when the profile is about to be destroyed. |
| 45 void ShutdownOnUIThread() {} | 47 void ShutdownOnUIThread() {} |
| 46 | 48 |
| 47 protected: | 49 protected: |
| 48 // SetClock takes ownership of the passed in clock. | 50 // SetClock takes ownership of the passed in clock. |
| 49 void SetClock(scoped_ptr<base::Clock> clock); | 51 void SetClock(scoped_ptr<base::Clock> clock); |
| 50 | 52 |
| 51 private: | 53 private: |
| 52 FRIEND_TEST_ALL_PREFIXES(ForgetInstantlySSLHostStateDelegateTest, | 54 FRIEND_TEST_ALL_PREFIXES(ForgetInstantlySSLHostStateDelegateTest, |
| 53 MakeAndForgetException); | 55 MakeAndForgetException); |
| 54 FRIEND_TEST_ALL_PREFIXES(RememberSSLHostStateDelegateTest, AfterRestart); | 56 FRIEND_TEST_ALL_PREFIXES(RememberSSLHostStateDelegateTest, AfterRestart); |
| 57 FRIEND_TEST_ALL_PREFIXES(RememberSSLHostStateDelegateTest, |
| 58 QueryPolicyExpired); |
| 55 | 59 |
| 56 // Used to specify whether new content setting entries should be created if | 60 // Used to specify whether new content setting entries should be created if |
| 57 // they don't already exist when querying the user's settings. | 61 // they don't already exist when querying the user's settings. |
| 58 enum CreateDictionaryEntriesDisposition { | 62 enum CreateDictionaryEntriesDisposition { |
| 59 CreateDictionaryEntries, | 63 CreateDictionaryEntries, |
| 60 DoNotCreateDictionaryEntries | 64 DoNotCreateDictionaryEntries |
| 61 }; | 65 }; |
| 62 | 66 |
| 63 // Specifies whether user SSL error decisions should be forgetten at the end | 67 // Specifies whether user SSL error decisions should be forgetten at the end |
| 64 // of this current session (the old style of remembering decisions), or | 68 // of this current session (the old style of remembering decisions), or |
| (...skipping 19 matching lines...) Expand all Loading... |
| 84 // ChangeCertPolicy. Returns NULL on a failure. | 88 // ChangeCertPolicy. Returns NULL on a failure. |
| 85 // | 89 // |
| 86 // |dict| specifies the user's full exceptions dictionary for a specific site | 90 // |dict| specifies the user's full exceptions dictionary for a specific site |
| 87 // in their content settings. Must be retrieved directly from a website | 91 // in their content settings. Must be retrieved directly from a website |
| 88 // setting in the the profile's HostContentSettingsMap. | 92 // setting in the the profile's HostContentSettingsMap. |
| 89 // | 93 // |
| 90 // If |create_entries| specifies CreateDictionaryEntries, then | 94 // If |create_entries| specifies CreateDictionaryEntries, then |
| 91 // GetValidCertDecisionsDict will create a new set of entries within the | 95 // GetValidCertDecisionsDict will create a new set of entries within the |
| 92 // dictionary if they do not already exist. Otherwise will fail and return if | 96 // dictionary if they do not already exist. Otherwise will fail and return if |
| 93 // NULL if they do not exist. | 97 // NULL if they do not exist. |
| 98 // |
| 99 // |expired_previous_decision| receives a true value if there had been a |
| 100 // previous decision made by the user but it has expired. Otherwise it is set |
| 101 // to false. |
| 94 base::DictionaryValue* GetValidCertDecisionsDict( | 102 base::DictionaryValue* GetValidCertDecisionsDict( |
| 95 base::DictionaryValue* dict, | 103 base::DictionaryValue* dict, |
| 96 CreateDictionaryEntriesDisposition create_entries); | 104 CreateDictionaryEntriesDisposition create_entries, |
| 105 bool* expired_previous_decision); |
| 97 | 106 |
| 98 scoped_ptr<base::Clock> clock_; | 107 scoped_ptr<base::Clock> clock_; |
| 99 RememberSSLExceptionDecisionsDisposition should_remember_ssl_decisions_; | 108 RememberSSLExceptionDecisionsDisposition should_remember_ssl_decisions_; |
| 100 base::TimeDelta default_ssl_cert_decision_expiration_delta_; | 109 base::TimeDelta default_ssl_cert_decision_expiration_delta_; |
| 101 Profile* profile_; | 110 Profile* profile_; |
| 102 | 111 |
| 103 DISALLOW_COPY_AND_ASSIGN(ChromeSSLHostStateDelegate); | 112 DISALLOW_COPY_AND_ASSIGN(ChromeSSLHostStateDelegate); |
| 104 }; | 113 }; |
| 105 | 114 |
| 106 #endif // CHROME_BROWSER_SSL_CHROME_SSL_HOST_STATE_DELEGATE_H_ | 115 #endif // CHROME_BROWSER_SSL_CHROME_SSL_HOST_STATE_DELEGATE_H_ |
| OLD | NEW |