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