OLD | NEW |
1 // Copyright (c) 2012 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 ResourceRedirectDetails; | 25 class ResourceRedirectDetails; |
24 class ResourceRequestDetails; | 26 class ResourceRequestDetails; |
25 class SSLPolicy; | 27 class SSLPolicy; |
26 | 28 |
27 namespace content { | 29 namespace content { |
28 class NavigationEntryImpl; | 30 class NavigationEntryImpl; |
29 } | 31 } |
30 | 32 |
31 namespace net { | 33 namespace net { |
32 class SSLInfo; | 34 class SSLInfo; |
33 class URLRequest; | |
34 } // namespace net | 35 } // namespace net |
35 | 36 |
36 // 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 |
37 // listens for various events that influence when these elements should or | 38 // listens for various events that influence when these elements should or |
38 // should not be displayed and adjusts them accordingly. | 39 // should not be displayed and adjusts them accordingly. |
39 // | 40 // |
40 // There is one SSLManager per tab. | 41 // There is one SSLManager per tab. |
41 // The security state (secure/insecure) is stored in the navigation entry. | 42 // The security state (secure/insecure) is stored in the navigation entry. |
42 // 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. |
43 | 44 |
44 class SSLManager : public content::NotificationObserver { | 45 class SSLManager : public content::NotificationObserver { |
45 public: | 46 public: |
46 // Entry point for SSLCertificateErrors. This function begins the process | 47 // Entry point for SSLCertificateErrors. This function begins the process |
47 // of resolving a certificate error during an SSL connection. SSLManager | 48 // of resolving a certificate error during an SSL connection. SSLManager |
48 // will adjust the security UI and either call |Cancel| or | 49 // will adjust the security UI and either call |CancelSSLRequest| or |
49 // |ContinueDespiteLastError| on the net::URLRequest. | 50 // |ContinueSSLRequest| of |delegate| with |id| as the first argument. |
50 // | 51 // |
51 // Called on the IO thread. | 52 // Called on the IO thread. |
52 static void OnSSLCertificateError(net::URLRequest* request, | 53 static void OnSSLCertificateError(SSLErrorHandler::Delegate* delegate, |
| 54 const content::GlobalRequestID& id, |
| 55 ResourceType::Type resource_type, |
| 56 const GURL& url, |
| 57 int render_process_id, |
| 58 int render_view_id, |
53 const net::SSLInfo& ssl_info, | 59 const net::SSLInfo& ssl_info, |
54 bool fatal); | 60 bool fatal); |
55 | 61 |
56 // Called when SSL state for a host or tab changes. Broadcasts the | 62 // Called when SSL state for a host or tab changes. Broadcasts the |
57 // SSL_INTERNAL_STATE_CHANGED notification. | 63 // SSL_INTERNAL_STATE_CHANGED notification. |
58 static void NotifySSLInternalStateChanged( | 64 static void NotifySSLInternalStateChanged( |
59 NavigationControllerImpl* controller); | 65 NavigationControllerImpl* controller); |
60 | 66 |
61 // Construct an SSLManager for the specified tab. | 67 // Construct an SSLManager for the specified tab. |
62 // If |delegate| is NULL, SSLPolicy::GetDefaultPolicy() is used. | 68 // If |delegate| is NULL, SSLPolicy::GetDefaultPolicy() is used. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 // for the security UI of this tab. | 115 // for the security UI of this tab. |
110 NavigationControllerImpl* controller_; | 116 NavigationControllerImpl* controller_; |
111 | 117 |
112 // Handles registering notifications with the NotificationService. | 118 // Handles registering notifications with the NotificationService. |
113 content::NotificationRegistrar registrar_; | 119 content::NotificationRegistrar registrar_; |
114 | 120 |
115 DISALLOW_COPY_AND_ASSIGN(SSLManager); | 121 DISALLOW_COPY_AND_ASSIGN(SSLManager); |
116 }; | 122 }; |
117 | 123 |
118 #endif // CONTENT_BROWSER_SSL_SSL_MANAGER_H_ | 124 #endif // CONTENT_BROWSER_SSL_SSL_MANAGER_H_ |
OLD | NEW |