| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_SSL_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_SSL_SSL_MANAGER_H_ |
| 6 #define CHROME_BROWSER_SSL_SSL_MANAGER_H_ | 6 #define CHROME_BROWSER_SSL_SSL_MANAGER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
| 13 #include "chrome/browser/ssl/ssl_policy_backend.h" | 13 #include "chrome/browser/ssl/ssl_policy_backend.h" |
| 14 #include "chrome/common/notification_observer.h" | 14 #include "chrome/common/notification_observer.h" |
| 15 #include "chrome/common/notification_registrar.h" | 15 #include "chrome/common/notification_registrar.h" |
| 16 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
| 17 #include "net/base/net_errors.h" | 17 #include "net/base/net_errors.h" |
| 18 | 18 |
| 19 class LoadFromMemoryCacheDetails; | 19 class LoadFromMemoryCacheDetails; |
| 20 class NavigationController; | 20 class NavigationController; |
| 21 class NavigationEntry; | 21 class NavigationEntry; |
| 22 class ProvisionalLoadDetails; | 22 class ProvisionalLoadDetails; |
| 23 class ResourceDispatcherHost; | 23 class ResourceDispatcherHost; |
| 24 class ResourceRedirectDetails; | 24 class ResourceRedirectDetails; |
| 25 class ResourceRequestDetails; | 25 class ResourceRequestDetails; |
| 26 class SSLPolicy; | 26 class SSLPolicy; |
| 27 |
| 28 namespace net { |
| 27 class URLRequest; | 29 class URLRequest; |
| 30 } // namespace net |
| 28 | 31 |
| 29 // The SSLManager SSLManager controls the SSL UI elements in a TabContents. It | 32 // The SSLManager SSLManager controls the SSL UI elements in a TabContents. It |
| 30 // listens for various events that influence when these elements should or | 33 // listens for various events that influence when these elements should or |
| 31 // should not be displayed and adjusts them accordingly. | 34 // should not be displayed and adjusts them accordingly. |
| 32 // | 35 // |
| 33 // There is one SSLManager per tab. | 36 // There is one SSLManager per tab. |
| 34 // The security state (secure/insecure) is stored in the navigation entry. | 37 // The security state (secure/insecure) is stored in the navigation entry. |
| 35 // Along with it are stored any SSL error code and the associated cert. | 38 // Along with it are stored any SSL error code and the associated cert. |
| 36 | 39 |
| 37 class SSLManager : public NotificationObserver { | 40 class SSLManager : public NotificationObserver { |
| 38 public: | 41 public: |
| 39 // Entry point for SSLCertificateErrors. This function begins the process | 42 // Entry point for SSLCertificateErrors. This function begins the process |
| 40 // of resolving a certificate error during an SSL connection. SSLManager | 43 // of resolving a certificate error during an SSL connection. SSLManager |
| 41 // will adjust the security UI and either call |Cancel| or | 44 // will adjust the security UI and either call |Cancel| or |
| 42 // |ContinueDespiteLastError| on the URLRequest. | 45 // |ContinueDespiteLastError| on the URLRequest. |
| 43 // | 46 // |
| 44 // Called on the IO thread. | 47 // Called on the IO thread. |
| 45 static void OnSSLCertificateError(ResourceDispatcherHost* resource_dispatcher, | 48 static void OnSSLCertificateError(ResourceDispatcherHost* resource_dispatcher, |
| 46 URLRequest* request, | 49 net::URLRequest* request, |
| 47 int cert_error, | 50 int cert_error, |
| 48 net::X509Certificate* cert); | 51 net::X509Certificate* cert); |
| 49 | 52 |
| 50 // Called when SSL state for a host or tab changes. Broadcasts the | 53 // Called when SSL state for a host or tab changes. Broadcasts the |
| 51 // SSL_INTERNAL_STATE_CHANGED notification. | 54 // SSL_INTERNAL_STATE_CHANGED notification. |
| 52 static void NotifySSLInternalStateChanged(); | 55 static void NotifySSLInternalStateChanged(); |
| 53 | 56 |
| 54 // Convenience methods for serializing/deserializing the security info. | 57 // Convenience methods for serializing/deserializing the security info. |
| 55 static std::string SerializeSecurityInfo(int cert_id, | 58 static std::string SerializeSecurityInfo(int cert_id, |
| 56 int cert_status, | 59 int cert_status, |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // for the security UI of this tab. | 122 // for the security UI of this tab. |
| 120 NavigationController* controller_; | 123 NavigationController* controller_; |
| 121 | 124 |
| 122 // Handles registering notifications with the NotificationService. | 125 // Handles registering notifications with the NotificationService. |
| 123 NotificationRegistrar registrar_; | 126 NotificationRegistrar registrar_; |
| 124 | 127 |
| 125 DISALLOW_COPY_AND_ASSIGN(SSLManager); | 128 DISALLOW_COPY_AND_ASSIGN(SSLManager); |
| 126 }; | 129 }; |
| 127 | 130 |
| 128 #endif // CHROME_BROWSER_SSL_SSL_MANAGER_H_ | 131 #endif // CHROME_BROWSER_SSL_SSL_MANAGER_H_ |
| OLD | NEW |