| 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/notification_observer.h" | 15 #include "content/common/notification_observer.h" |
| 15 #include "content/common/notification_registrar.h" | 16 #include "content/common/notification_registrar.h" |
| 16 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
| 17 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
| 18 | 19 |
| 19 class LoadFromMemoryCacheDetails; | 20 class LoadFromMemoryCacheDetails; |
| 20 class NavigationController; | 21 class NavigationController; |
| 21 class NavigationEntry; | 22 class NavigationEntry; |
| 22 class ProvisionalLoadDetails; | 23 class ProvisionalLoadDetails; |
| 23 class ResourceDispatcherHost; | 24 class ResourceDispatcherHost; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 52 | 53 |
| 53 // Called when SSL state for a host or tab changes. Broadcasts the | 54 // Called when SSL state for a host or tab changes. Broadcasts the |
| 54 // SSL_INTERNAL_STATE_CHANGED notification. | 55 // SSL_INTERNAL_STATE_CHANGED notification. |
| 55 static void NotifySSLInternalStateChanged(NavigationController* controller); | 56 static void NotifySSLInternalStateChanged(NavigationController* controller); |
| 56 | 57 |
| 57 // Convenience methods for serializing/deserializing the security info. | 58 // Convenience methods for serializing/deserializing the security info. |
| 58 static std::string SerializeSecurityInfo(int cert_id, | 59 static std::string SerializeSecurityInfo(int cert_id, |
| 59 int cert_status, | 60 int cert_status, |
| 60 int security_bits, | 61 int security_bits, |
| 61 int connection_status); | 62 int connection_status); |
| 62 static bool DeserializeSecurityInfo(const std::string& state, | 63 CONTENT_EXPORT static bool DeserializeSecurityInfo(const std::string& state, |
| 63 int* cert_id, | 64 int* cert_id, |
| 64 int* cert_status, | 65 int* cert_status, |
| 65 int* security_bits, | 66 int* security_bits, |
| 66 int* connection_status); | 67 int* connection_status); |
| 67 | 68 |
| 68 // Construct an SSLManager for the specified tab. | 69 // Construct an SSLManager for the specified tab. |
| 69 // If |delegate| is NULL, SSLPolicy::GetDefaultPolicy() is used. | 70 // If |delegate| is NULL, SSLPolicy::GetDefaultPolicy() is used. |
| 70 explicit SSLManager(NavigationController* controller); | 71 explicit SSLManager(NavigationController* controller); |
| 71 virtual ~SSLManager(); | 72 virtual ~SSLManager(); |
| 72 | 73 |
| 73 SSLPolicy* policy() { return policy_.get(); } | 74 SSLPolicy* policy() { return policy_.get(); } |
| 74 SSLPolicyBackend* backend() { return &backend_; } | 75 SSLPolicyBackend* backend() { return &backend_; } |
| 75 | 76 |
| 76 // The navigation controller associated with this SSLManager. The | 77 // The navigation controller associated with this SSLManager. The |
| 77 // NavigationController is guaranteed to outlive the SSLManager. | 78 // NavigationController is guaranteed to outlive the SSLManager. |
| 78 NavigationController* controller() { return controller_; } | 79 NavigationController* controller() { return controller_; } |
| 79 | 80 |
| 80 // This entry point is called directly (instead of via the notification | 81 // This entry point is called directly (instead of via the notification |
| 81 // service) because we need more precise control of the order in which folks | 82 // service) because we need more precise control of the order in which folks |
| 82 // are notified of this event. | 83 // are notified of this event. |
| 83 void DidCommitProvisionalLoad(const NotificationDetails& details); | 84 void DidCommitProvisionalLoad(const NotificationDetails& details); |
| 84 | 85 |
| 85 // Insecure content entry point. | 86 // Insecure content entry point. |
| 86 void DidRunInsecureContent(const std::string& security_origin); | 87 void DidRunInsecureContent(const std::string& security_origin); |
| 87 | 88 |
| 88 // Called to determine if there were any processed SSL errors from request. | 89 // Called to determine if there were any processed SSL errors from request. |
| 89 bool ProcessedSSLErrorFromRequest() const; | 90 CONTENT_EXPORT bool ProcessedSSLErrorFromRequest() const; |
| 90 | 91 |
| 91 // Entry point for navigation. This function begins the process of updating | 92 // Entry point for navigation. This function begins the process of updating |
| 92 // the security UI when the main frame navigates to a new URL. | 93 // the security UI when the main frame navigates to a new URL. |
| 93 // | 94 // |
| 94 // Called on the UI thread. | 95 // Called on the UI thread. |
| 95 virtual void Observe(int type, | 96 virtual void Observe(int type, |
| 96 const NotificationSource& source, | 97 const NotificationSource& source, |
| 97 const NotificationDetails& details); | 98 const NotificationDetails& details); |
| 98 | 99 |
| 99 private: | 100 private: |
| (...skipping 19 matching lines...) Expand all Loading... |
| 119 // for the security UI of this tab. | 120 // for the security UI of this tab. |
| 120 NavigationController* controller_; | 121 NavigationController* controller_; |
| 121 | 122 |
| 122 // Handles registering notifications with the NotificationService. | 123 // Handles registering notifications with the NotificationService. |
| 123 NotificationRegistrar registrar_; | 124 NotificationRegistrar registrar_; |
| 124 | 125 |
| 125 DISALLOW_COPY_AND_ASSIGN(SSLManager); | 126 DISALLOW_COPY_AND_ASSIGN(SSLManager); |
| 126 }; | 127 }; |
| 127 | 128 |
| 128 #endif // CONTENT_BROWSER_SSL_SSL_MANAGER_H_ | 129 #endif // CONTENT_BROWSER_SSL_SSL_MANAGER_H_ |
| OLD | NEW |