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