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 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 static void OnSSLCertificateError( | 51 static void OnSSLCertificateError( |
52 const base::WeakPtr<SSLErrorHandler::Delegate>& delegate, | 52 const base::WeakPtr<SSLErrorHandler::Delegate>& delegate, |
53 const GlobalRequestID& id, | 53 const GlobalRequestID& id, |
54 ResourceType::Type resource_type, | 54 ResourceType::Type resource_type, |
55 const GURL& url, | 55 const GURL& url, |
56 int render_process_id, | 56 int render_process_id, |
57 int render_view_id, | 57 int render_view_id, |
58 const net::SSLInfo& ssl_info, | 58 const net::SSLInfo& ssl_info, |
59 bool fatal); | 59 bool fatal); |
60 | 60 |
61 // Called when SSL state for a host or tab changes. Broadcasts the | |
62 // SSL_INTERNAL_STATE_CHANGED notification. | |
63 static void NotifySSLInternalStateChanged( | |
64 NavigationControllerImpl* controller); | |
65 | |
66 // Construct an SSLManager for the specified tab. | 61 // Construct an SSLManager for the specified tab. |
67 // If |delegate| is NULL, SSLPolicy::GetDefaultPolicy() is used. | 62 // If |delegate| is NULL, SSLPolicy::GetDefaultPolicy() is used. |
68 explicit SSLManager(NavigationControllerImpl* controller); | 63 explicit SSLManager(NavigationControllerImpl* controller); |
69 virtual ~SSLManager(); | 64 virtual ~SSLManager(); |
70 | 65 |
71 SSLPolicy* policy() { return policy_.get(); } | 66 SSLPolicy* policy() { return policy_.get(); } |
72 SSLPolicyBackend* backend() { return &backend_; } | 67 SSLPolicyBackend* backend() { return &backend_; } |
73 | 68 |
74 // The navigation controller associated with this SSLManager. The | 69 // The navigation controller associated with this SSLManager. The |
75 // NavigationController is guaranteed to outlive the SSLManager. | 70 // NavigationController is guaranteed to outlive the SSLManager. |
76 NavigationControllerImpl* controller() { return controller_; } | 71 NavigationControllerImpl* controller() { return controller_; } |
77 | 72 |
78 // This entry point is called directly (instead of via the notification | 73 // This entry point is called directly (instead of via the notification |
79 // service) because we need more precise control of the order in which folks | 74 // service) because we need more precise control of the order in which folks |
80 // are notified of this event. | 75 // are notified of this event. |
81 void DidCommitProvisionalLoad(const NotificationDetails& details); | 76 void DidCommitProvisionalLoad(const NotificationDetails& details); |
82 | 77 |
83 // Insecure content entry point. | 78 // Insecure content entry point. |
| 79 void DidDisplayInsecureContent(); |
84 void DidRunInsecureContent(const std::string& security_origin); | 80 void DidRunInsecureContent(const std::string& security_origin); |
85 | 81 |
| 82 // Update the NavigationEntry with our current state. |
| 83 void UpdateEntry(NavigationEntryImpl* entry); |
| 84 |
86 // Entry point for navigation. This function begins the process of updating | 85 // Entry point for navigation. This function begins the process of updating |
87 // the security UI when the main frame navigates to a new URL. | 86 // the security UI when the main frame navigates to a new URL. |
88 // | 87 // |
89 // Called on the UI thread. | 88 // Called on the UI thread. |
90 virtual void Observe(int type, | 89 virtual void Observe(int type, |
91 const NotificationSource& source, | 90 const NotificationSource& source, |
92 const NotificationDetails& details) OVERRIDE; | 91 const NotificationDetails& details) OVERRIDE; |
93 | 92 |
94 private: | 93 private: |
95 // Entry points for notifications to which we subscribe. Note that | 94 // Entry points for notifications to which we subscribe. Note that |
96 // DidCommitProvisionalLoad uses the abstract NotificationDetails type since | 95 // DidCommitProvisionalLoad uses the abstract NotificationDetails type since |
97 // the type we need is in NavigationController which would create a circular | 96 // the type we need is in NavigationController which would create a circular |
98 // header file dependency. | 97 // header file dependency. |
99 void DidLoadFromMemoryCache(LoadFromMemoryCacheDetails* details); | 98 void DidLoadFromMemoryCache(LoadFromMemoryCacheDetails* details); |
100 void DidStartResourceResponse(ResourceRequestDetails* details); | 99 void DidStartResourceResponse(ResourceRequestDetails* details); |
101 void DidReceiveResourceRedirect(ResourceRedirectDetails* details); | 100 void DidReceiveResourceRedirect(ResourceRedirectDetails* details); |
102 void DidChangeSSLInternalState(); | |
103 | |
104 // Update the NavigationEntry with our current state. | |
105 void UpdateEntry(NavigationEntryImpl* entry); | |
106 | 101 |
107 // The backend for the SSLPolicy to actuate its decisions. | 102 // The backend for the SSLPolicy to actuate its decisions. |
108 SSLPolicyBackend backend_; | 103 SSLPolicyBackend backend_; |
109 | 104 |
110 // The SSLPolicy instance for this manager. | 105 // The SSLPolicy instance for this manager. |
111 scoped_ptr<SSLPolicy> policy_; | 106 scoped_ptr<SSLPolicy> policy_; |
112 | 107 |
113 // The NavigationController that owns this SSLManager. We are responsible | 108 // The NavigationController that owns this SSLManager. We are responsible |
114 // for the security UI of this tab. | 109 // for the security UI of this tab. |
115 NavigationControllerImpl* controller_; | 110 NavigationControllerImpl* controller_; |
116 | 111 |
117 // Handles registering notifications with the NotificationService. | 112 // Handles registering notifications with the NotificationService. |
118 NotificationRegistrar registrar_; | 113 NotificationRegistrar registrar_; |
119 | 114 |
120 DISALLOW_COPY_AND_ASSIGN(SSLManager); | 115 DISALLOW_COPY_AND_ASSIGN(SSLManager); |
121 }; | 116 }; |
122 | 117 |
123 } // namespace content | 118 } // namespace content |
124 | 119 |
125 #endif // CONTENT_BROWSER_SSL_SSL_MANAGER_H_ | 120 #endif // CONTENT_BROWSER_SSL_SSL_MANAGER_H_ |
OLD | NEW |