Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser/ssl/ssl_error_handler.h" | |
| 14 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
| 16 #include "content/public/browser/global_request_id.h" | |
| 15 #include "content/public/browser/notification_observer.h" | 17 #include "content/public/browser/notification_observer.h" |
| 16 #include "content/public/browser/notification_registrar.h" | 18 #include "content/public/browser/notification_registrar.h" |
| 17 #include "googleurl/src/gurl.h" | 19 #include "googleurl/src/gurl.h" |
| 18 #include "net/base/cert_status_flags.h" | 20 #include "net/base/cert_status_flags.h" |
| 19 #include "net/base/net_errors.h" | 21 #include "net/base/net_errors.h" |
| 20 | 22 |
| 21 class LoadFromMemoryCacheDetails; | 23 class LoadFromMemoryCacheDetails; |
| 22 class NavigationControllerImpl; | 24 class NavigationControllerImpl; |
| 23 class ResourceDispatcherHost; | |
| 24 class ResourceRedirectDetails; | 25 class ResourceRedirectDetails; |
| 25 class ResourceRequestDetails; | 26 class ResourceRequestDetails; |
| 26 class SSLPolicy; | 27 class SSLPolicy; |
| 27 | 28 |
| 28 namespace content { | 29 namespace content { |
| 29 class NavigationEntryImpl; | 30 class NavigationEntryImpl; |
| 30 } | 31 } |
| 31 | 32 |
| 32 namespace net { | 33 namespace net { |
| 33 class SSLInfo; | 34 class SSLInfo; |
| 34 class URLRequest; | |
| 35 } // namespace net | 35 } // namespace net |
| 36 | 36 |
| 37 // The SSLManager SSLManager controls the SSL UI elements in a TabContents. It | 37 // The SSLManager SSLManager controls the SSL UI elements in a TabContents. It |
| 38 // listens for various events that influence when these elements should or | 38 // listens for various events that influence when these elements should or |
| 39 // should not be displayed and adjusts them accordingly. | 39 // should not be displayed and adjusts them accordingly. |
| 40 // | 40 // |
| 41 // There is one SSLManager per tab. | 41 // There is one SSLManager per tab. |
| 42 // The security state (secure/insecure) is stored in the navigation entry. | 42 // The security state (secure/insecure) is stored in the navigation entry. |
| 43 // Along with it are stored any SSL error code and the associated cert. | 43 // Along with it are stored any SSL error code and the associated cert. |
| 44 | 44 |
| 45 class SSLManager : public content::NotificationObserver { | 45 class SSLManager : public content::NotificationObserver { |
| 46 public: | 46 public: |
| 47 // Entry point for SSLCertificateErrors. This function begins the process | 47 // Entry point for SSLCertificateErrors. This function begins the process |
| 48 // of resolving a certificate error during an SSL connection. SSLManager | 48 // of resolving a certificate error during an SSL connection. SSLManager |
| 49 // will adjust the security UI and either call |Cancel| or | 49 // will adjust the security UI and either call |Cancel| or |
| 50 // |ContinueDespiteLastError| on the net::URLRequest. | 50 // |ContinueDespiteLastError| on the request associated with |id|. |
|
wtc
2012/02/24 00:44:38
The references to |Cancel| and |ContinueDespiteLas
Takashi Toyoshima
2012/02/28 20:55:43
Done.
| |
| 51 // | 51 // |
| 52 // Called on the IO thread. | 52 // Called on the IO thread. |
| 53 static void OnSSLCertificateError(ResourceDispatcherHost* resource_dispatcher, | 53 static void OnSSLCertificateError(SSLErrorHandler::Delegate* delegate, |
| 54 net::URLRequest* request, | 54 const content::GlobalRequestID& id, |
| 55 const net::SSLInfo& ssl_info, | 55 const net::SSLInfo& ssl_info, |
| 56 bool fatal); | 56 bool fatal); |
| 57 | 57 |
| 58 // Called when SSL state for a host or tab changes. Broadcasts the | 58 // Called when SSL state for a host or tab changes. Broadcasts the |
| 59 // SSL_INTERNAL_STATE_CHANGED notification. | 59 // SSL_INTERNAL_STATE_CHANGED notification. |
| 60 static void NotifySSLInternalStateChanged( | 60 static void NotifySSLInternalStateChanged( |
| 61 NavigationControllerImpl* controller); | 61 NavigationControllerImpl* controller); |
| 62 | 62 |
| 63 // Construct an SSLManager for the specified tab. | 63 // Construct an SSLManager for the specified tab. |
| 64 // If |delegate| is NULL, SSLPolicy::GetDefaultPolicy() is used. | 64 // If |delegate| is NULL, SSLPolicy::GetDefaultPolicy() is used. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 // for the security UI of this tab. | 111 // for the security UI of this tab. |
| 112 NavigationControllerImpl* controller_; | 112 NavigationControllerImpl* controller_; |
| 113 | 113 |
| 114 // Handles registering notifications with the NotificationService. | 114 // Handles registering notifications with the NotificationService. |
| 115 content::NotificationRegistrar registrar_; | 115 content::NotificationRegistrar registrar_; |
| 116 | 116 |
| 117 DISALLOW_COPY_AND_ASSIGN(SSLManager); | 117 DISALLOW_COPY_AND_ASSIGN(SSLManager); |
| 118 }; | 118 }; |
| 119 | 119 |
| 120 #endif // CONTENT_BROWSER_SSL_SSL_MANAGER_H_ | 120 #endif // CONTENT_BROWSER_SSL_SSL_MANAGER_H_ |
| OLD | NEW |