| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_POLICY_H_ | 5 #ifndef CHROME_BROWSER_SSL_POLICY_H_ |
| 6 #define CHROME_BROWSER_SSL_POLICY_H_ | 6 #define CHROME_BROWSER_SSL_POLICY_H_ |
| 7 | 7 |
| 8 #include "base/singleton.h" | 8 #include "base/singleton.h" |
| 9 #include "chrome/browser/ssl/ssl_blocking_page.h" | 9 #include "chrome/browser/ssl/ssl_blocking_page.h" |
| 10 #include "chrome/browser/ssl/ssl_manager.h" | 10 #include "chrome/browser/ssl/ssl_manager.h" |
| 11 | 11 |
| 12 // SSLPolicy | 12 // SSLPolicy |
| 13 // | 13 // |
| 14 // This class is responsible for making the security decisions that concern the | 14 // This class is responsible for making the security decisions that concern the |
| 15 // SSL trust indicators. It relies on the SSLManager to actually enact the | 15 // SSL trust indicators. It relies on the SSLManager to actually enact the |
| 16 // decisions it reaches. | 16 // decisions it reaches. |
| 17 // | 17 // |
| 18 class SSLPolicy : public SSLManager::Delegate, | 18 class SSLPolicy : public SSLManager::Delegate, |
| 19 public SSLBlockingPage::Delegate { | 19 public SSLBlockingPage::Delegate { |
| 20 public: | 20 public: |
| 21 // Factory method to get the default policy. | 21 // Factory method to get the default policy. |
| 22 static SSLPolicy* GetDefaultPolicy(); | 22 static SSLPolicy* GetDefaultPolicy(); |
| 23 | 23 |
| 24 // SSLManager::Delegate methods. | 24 // SSLManager::Delegate methods. |
| 25 virtual void OnCertError(SSLManager::CertError* error); | 25 virtual void OnCertError(SSLCertErrorHandler* handler); |
| 26 virtual void OnMixedContent(SSLManager::MixedContentHandler* handler); | 26 virtual void OnMixedContent(SSLMixedContentHandler* handler); |
| 27 virtual void OnRequestStarted(SSLManager::RequestInfo* info); | 27 virtual void OnRequestStarted(SSLRequestInfo* info); |
| 28 virtual void UpdateEntry(SSLManager* manager, NavigationEntry* entry); | 28 virtual void UpdateEntry(SSLManager* manager, NavigationEntry* entry); |
| 29 | 29 |
| 30 // This method is static because it is called from both the UI and the IO | 30 // This method is static because it is called from both the UI and the IO |
| 31 // threads. | 31 // threads. |
| 32 static bool IsMixedContent(const GURL& url, | 32 static bool IsMixedContent(const GURL& url, |
| 33 ResourceType::Type resource_type, | 33 ResourceType::Type resource_type, |
| 34 FilterPolicy::Type filter_policy, | 34 FilterPolicy::Type filter_policy, |
| 35 const std::string& frame_origin); | 35 const std::string& frame_origin); |
| 36 | 36 |
| 37 // SSLBlockingPage::Delegate methods. | 37 // SSLBlockingPage::Delegate methods. |
| 38 virtual SSLErrorInfo GetSSLErrorInfo(SSLManager::CertError* error); | 38 virtual SSLErrorInfo GetSSLErrorInfo(SSLCertErrorHandler* handler); |
| 39 virtual void OnDenyCertificate(SSLManager::CertError* error); | 39 virtual void OnDenyCertificate(SSLCertErrorHandler* handler); |
| 40 virtual void OnAllowCertificate(SSLManager::CertError* error); | 40 virtual void OnAllowCertificate(SSLCertErrorHandler* handler); |
| 41 | 41 |
| 42 private: | 42 private: |
| 43 // Construct via |GetDefaultPolicy|. | 43 // Construct via |GetDefaultPolicy|. |
| 44 SSLPolicy(); | 44 SSLPolicy(); |
| 45 friend struct DefaultSingletonTraits<SSLPolicy>; | 45 friend struct DefaultSingletonTraits<SSLPolicy>; |
| 46 | 46 |
| 47 // Helper method for derived classes handling certificate errors that can be | 47 // Helper method for derived classes handling certificate errors that can be |
| 48 // overridden by the user. | 48 // overridden by the user. |
| 49 // Show a blocking page and let the user continue or cancel the request. | 49 // Show a blocking page and let the user continue or cancel the request. |
| 50 void OnOverridableCertError(SSLManager::CertError* error); | 50 void OnOverridableCertError(SSLCertErrorHandler* handler); |
| 51 | 51 |
| 52 // Helper method for derived classes handling fatal certificate errors. | 52 // Helper method for derived classes handling fatal certificate errors. |
| 53 // Cancel the request and show an error page. | 53 // Cancel the request and show an error page. |
| 54 void OnFatalCertError(SSLManager::CertError* error); | 54 void OnFatalCertError(SSLCertErrorHandler* handler); |
| 55 | 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(SSLPolicy); | 56 DISALLOW_COPY_AND_ASSIGN(SSLPolicy); |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 #endif // CHROME_BROWSER_SSL_POLICY_H_ | 59 #endif // CHROME_BROWSER_SSL_POLICY_H_ |
| OLD | NEW |