diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-24 22:31:24 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-24 22:31:24 +0000 |
commit | 89f23a3fc2ab1f96be4299cf3d22c6f9a1d808aa (patch) | |
tree | 7bfa9e82ebfc8db5eeeb93b9142a227e0f427da3 /content/browser/ssl | |
parent | 9ede073d0d9e45e2894fbec4410211a00ef1b207 (diff) | |
download | chromium_src-89f23a3fc2ab1f96be4299cf3d22c6f9a1d808aa.zip chromium_src-89f23a3fc2ab1f96be4299cf3d22c6f9a1d808aa.tar.gz chromium_src-89f23a3fc2ab1f96be4299cf3d22c6f9a1d808aa.tar.bz2 |
content/browser: Move ssl code into the content namespace.
R=jam@chromium.org
Review URL: https://codereview.chromium.org/11283004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163929 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/ssl')
-rw-r--r-- | content/browser/ssl/ssl_cert_error_handler.cc | 6 | ||||
-rw-r--r-- | content/browser/ssl/ssl_cert_error_handler.h | 6 | ||||
-rw-r--r-- | content/browser/ssl/ssl_client_auth_handler.cc | 9 | ||||
-rw-r--r-- | content/browser/ssl/ssl_client_auth_handler.h | 10 | ||||
-rw-r--r-- | content/browser/ssl/ssl_error_handler.cc | 10 | ||||
-rw-r--r-- | content/browser/ssl/ssl_error_handler.h | 23 | ||||
-rw-r--r-- | content/browser/ssl/ssl_host_state.cc | 8 | ||||
-rw-r--r-- | content/browser/ssl/ssl_host_state.h | 5 | ||||
-rw-r--r-- | content/browser/ssl/ssl_host_state_unittest.cc | 5 | ||||
-rw-r--r-- | content/browser/ssl/ssl_manager.cc | 77 | ||||
-rw-r--r-- | content/browser/ssl/ssl_manager.h | 40 | ||||
-rw-r--r-- | content/browser/ssl/ssl_policy.cc | 25 | ||||
-rw-r--r-- | content/browser/ssl/ssl_policy.h | 16 | ||||
-rw-r--r-- | content/browser/ssl/ssl_policy_backend.cc | 4 | ||||
-rw-r--r-- | content/browser/ssl/ssl_policy_backend.h | 10 | ||||
-rw-r--r-- | content/browser/ssl/ssl_request_info.cc | 4 | ||||
-rw-r--r-- | content/browser/ssl/ssl_request_info.h | 4 |
17 files changed, 140 insertions, 122 deletions
diff --git a/content/browser/ssl/ssl_cert_error_handler.cc b/content/browser/ssl/ssl_cert_error_handler.cc index 740aa6b..443d708 100644 --- a/content/browser/ssl/ssl_cert_error_handler.cc +++ b/content/browser/ssl/ssl_cert_error_handler.cc @@ -10,11 +10,11 @@ #include "net/base/cert_status_flags.h" #include "net/base/x509_certificate.h" -using content::ResourceDispatcherHostImpl; +namespace content { SSLCertErrorHandler::SSLCertErrorHandler( const base::WeakPtr<Delegate>& delegate, - const content::GlobalRequestID& id, + const GlobalRequestID& id, ResourceType::Type resource_type, const GURL& url, int render_process_id, @@ -48,3 +48,5 @@ void SSLCertErrorHandler::OnDispatched() { } SSLCertErrorHandler::~SSLCertErrorHandler() {} + +} // namespace content diff --git a/content/browser/ssl/ssl_cert_error_handler.h b/content/browser/ssl/ssl_cert_error_handler.h index 3eaa186..914bb3e 100644 --- a/content/browser/ssl/ssl_cert_error_handler.h +++ b/content/browser/ssl/ssl_cert_error_handler.h @@ -11,6 +11,8 @@ #include "content/browser/ssl/ssl_error_handler.h" #include "net/base/ssl_info.h" +namespace content { + // A CertError represents an error that occurred with the certificate in an // SSL session. A CertError object exists both on the IO thread and on the UI // thread and allows us to cancel/continue a request it is associated with. @@ -18,7 +20,7 @@ class SSLCertErrorHandler : public SSLErrorHandler { public: // Construct on the IO thread. SSLCertErrorHandler(const base::WeakPtr<Delegate>& delegate, - const content::GlobalRequestID& id, + const GlobalRequestID& id, ResourceType::Type resource_type, const GURL& url, int render_process_id, @@ -50,4 +52,6 @@ class SSLCertErrorHandler : public SSLErrorHandler { DISALLOW_COPY_AND_ASSIGN(SSLCertErrorHandler); }; +} // namespace content + #endif // CONTENT_BROWSER_SSL_SSL_CERT_ERROR_HANDLER_H_ diff --git a/content/browser/ssl/ssl_client_auth_handler.cc b/content/browser/ssl/ssl_client_auth_handler.cc index b2dc675..676589e 100644 --- a/content/browser/ssl/ssl_client_auth_handler.cc +++ b/content/browser/ssl/ssl_client_auth_handler.cc @@ -14,10 +14,7 @@ #include "net/url_request/url_request.h" #include "net/url_request/url_request_context.h" -using content::BrowserThread; -using content::ResourceDispatcherHostImpl; -using content::ResourceRequestInfo; -using content::ResourceRequestInfoImpl; +namespace content { SSLClientAuthHandler::SSLClientAuthHandler( net::URLRequest* request, @@ -88,8 +85,10 @@ void SSLClientAuthHandler::DoCertificateSelected(net::X509Certificate* cert) { void SSLClientAuthHandler::DoSelectCertificate( int render_process_host_id, int render_view_host_id) { - content::GetContentClient()->browser()->SelectClientCertificate( + GetContentClient()->browser()->SelectClientCertificate( render_process_host_id, render_view_host_id, http_network_session_, cert_request_info_, base::Bind(&SSLClientAuthHandler::CertificateSelected, this)); } + +} // namespace content diff --git a/content/browser/ssl/ssl_client_auth_handler.h b/content/browser/ssl/ssl_client_auth_handler.h index ccc5e3b..54f0999 100644 --- a/content/browser/ssl/ssl_client_auth_handler.h +++ b/content/browser/ssl/ssl_client_auth_handler.h @@ -18,13 +18,15 @@ class URLRequest; class X509Certificate; } // namespace net +namespace content { + // This class handles the approval and selection of a certificate for SSL client // authentication by the user. // It is self-owned and deletes itself when the UI reports the user selection or // when the net::URLRequest is cancelled. class CONTENT_EXPORT SSLClientAuthHandler : public base::RefCountedThreadSafe< - SSLClientAuthHandler, content::BrowserThread::DeleteOnIOThread> { + SSLClientAuthHandler, BrowserThread::DeleteOnIOThread> { public: SSLClientAuthHandler(net::URLRequest* request, net::SSLCertRequestInfo* cert_request_info); @@ -47,8 +49,8 @@ class CONTENT_EXPORT SSLClientAuthHandler private: friend class base::RefCountedThreadSafe< - SSLClientAuthHandler, content::BrowserThread::DeleteOnIOThread>; - friend class content::BrowserThread; + SSLClientAuthHandler, BrowserThread::DeleteOnIOThread>; + friend class BrowserThread; friend class base::DeleteHelper<SSLClientAuthHandler>; // Notifies that the user has selected a cert. @@ -71,4 +73,6 @@ class CONTENT_EXPORT SSLClientAuthHandler DISALLOW_COPY_AND_ASSIGN(SSLClientAuthHandler); }; +} // namespace content + #endif // CONTENT_BROWSER_SSL_SSL_CLIENT_AUTH_HANDLER_H_ diff --git a/content/browser/ssl/ssl_error_handler.cc b/content/browser/ssl/ssl_error_handler.cc index 4ae1da2..218ddeb 100644 --- a/content/browser/ssl/ssl_error_handler.cc +++ b/content/browser/ssl/ssl_error_handler.cc @@ -14,14 +14,12 @@ #include "net/base/net_errors.h" #include "net/url_request/url_request.h" -using content::BrowserThread; -using content::NavigationControllerImpl; -using content::RenderViewHostImpl; -using content::WebContents; using net::SSLInfo; +namespace content { + SSLErrorHandler::SSLErrorHandler(const base::WeakPtr<Delegate>& delegate, - const content::GlobalRequestID& id, + const GlobalRequestID& id, ResourceType::Type resource_type, const GURL& url, int render_process_id, @@ -176,3 +174,5 @@ void SSLErrorHandler::CompleteTakeNoAction() { // We're done with this object on the IO thread. Release(); } + +} // namespace content diff --git a/content/browser/ssl/ssl_error_handler.h b/content/browser/ssl/ssl_error_handler.h index 1b95c71..8fcfeae 100644 --- a/content/browser/ssl/ssl_error_handler.h +++ b/content/browser/ssl/ssl_error_handler.h @@ -15,18 +15,17 @@ #include "googleurl/src/gurl.h" #include "webkit/glue/resource_type.h" -class SSLCertErrorHandler; -class SSLManager; - -namespace content { -class ResourceDispatcherHostImpl; -} - namespace net { class SSLInfo; class URLRequest; } // namespace net +namespace content { + +class ResourceDispatcherHostImpl; +class SSLCertErrorHandler; +class SSLManager; + // An SSLErrorHandler carries information from the IO thread to the UI thread // and is dispatched to the appropriate SSLManager when it arrives on the // UI thread. Subclasses should override the OnDispatched/OnDispatchFailed @@ -52,13 +51,13 @@ class SSLErrorHandler : public base::RefCountedThreadSafe<SSLErrorHandler> { public: // Called when SSLErrorHandler decides to cancel the request because of // the SSL error. - virtual void CancelSSLRequest(const content::GlobalRequestID& id, + virtual void CancelSSLRequest(const GlobalRequestID& id, int error, const net::SSLInfo* ssl_info) = 0; // Called when SSLErrorHandler decides to continue the request despite the // SSL error. - virtual void ContinueSSLRequest(const content::GlobalRequestID& id) = 0; + virtual void ContinueSSLRequest(const GlobalRequestID& id) = 0; protected: virtual ~Delegate() {} @@ -109,7 +108,7 @@ class SSLErrorHandler : public base::RefCountedThreadSafe<SSLErrorHandler> { // Construct on the IO thread. SSLErrorHandler(const base::WeakPtr<Delegate>& delegate, - const content::GlobalRequestID& id, + const GlobalRequestID& id, ResourceType::Type resource_type, const GURL& url, int render_process_id, @@ -128,7 +127,7 @@ class SSLErrorHandler : public base::RefCountedThreadSafe<SSLErrorHandler> { // The id of the request associated with this object. // Should only be accessed from the IO thread. - content::GlobalRequestID request_id_; + GlobalRequestID request_id_; // The delegate we are associated with. base::WeakPtr<Delegate> delegate_; @@ -168,4 +167,6 @@ class SSLErrorHandler : public base::RefCountedThreadSafe<SSLErrorHandler> { DISALLOW_COPY_AND_ASSIGN(SSLErrorHandler); }; +} // namespace content + #endif // CONTENT_BROWSER_SSL_SSL_ERROR_HANDLER_H_ diff --git a/content/browser/ssl/ssl_host_state.cc b/content/browser/ssl/ssl_host_state.cc index c47171f..c2fc06d 100644 --- a/content/browser/ssl/ssl_host_state.cc +++ b/content/browser/ssl/ssl_host_state.cc @@ -8,9 +8,11 @@ #include "base/lazy_instance.h" #include "content/public/browser/browser_context.h" -static const char* kKeyName = "content_ssl_host_state"; +const char kKeyName[] = "content_ssl_host_state"; -SSLHostState* SSLHostState::GetFor(content::BrowserContext* context) { +namespace content { + +SSLHostState* SSLHostState::GetFor(BrowserContext* context) { SSLHostState* rv = static_cast<SSLHostState*>(context->GetUserData(kKeyName)); if (!rv) { rv = new SSLHostState(); @@ -62,3 +64,5 @@ net::CertPolicy::Judgment SSLHostState::QueryPolicy( return cert_policy_for_host_[host].Check(cert); } + +} // namespace content diff --git a/content/browser/ssl/ssl_host_state.h b/content/browser/ssl/ssl_host_state.h index 38c8e23..da3fe9c 100644 --- a/content/browser/ssl/ssl_host_state.h +++ b/content/browser/ssl/ssl_host_state.h @@ -19,7 +19,6 @@ namespace content { class BrowserContext; -} // SSLHostState // @@ -33,7 +32,7 @@ class CONTENT_EXPORT SSLHostState : NON_EXPORTED_BASE(base::SupportsUserData::Data), NON_EXPORTED_BASE(public base::NonThreadSafe) { public: - static SSLHostState* GetFor(content::BrowserContext* browser_context); + static SSLHostState* GetFor(BrowserContext* browser_context); SSLHostState(); virtual ~SSLHostState(); @@ -73,4 +72,6 @@ class CONTENT_EXPORT SSLHostState DISALLOW_COPY_AND_ASSIGN(SSLHostState); }; +} // namespace content + #endif // CONTENT_BROWSER_SSL_SSL_HOST_STATE_H_ diff --git a/content/browser/ssl/ssl_host_state_unittest.cc b/content/browser/ssl/ssl_host_state_unittest.cc index 15743f1..7ba266b 100644 --- a/content/browser/ssl/ssl_host_state_unittest.cc +++ b/content/browser/ssl/ssl_host_state_unittest.cc @@ -88,6 +88,8 @@ unsigned char google_der[] = { } // namespace +namespace content { + class SSLHostStateTest : public testing::Test { }; @@ -160,5 +162,6 @@ TEST_F(SSLHostStateTest, QueryPolicy) { net::CertPolicy::UNKNOWN); EXPECT_EQ(state.QueryPolicy(google_cert.get(), "example.com"), net::CertPolicy::UNKNOWN); - } + +} // namespace content diff --git a/content/browser/ssl/ssl_manager.cc b/content/browser/ssl/ssl_manager.cc index 91d6cfd..53b996b 100644 --- a/content/browser/ssl/ssl_manager.cc +++ b/content/browser/ssl/ssl_manager.cc @@ -23,22 +23,12 @@ #include "content/public/common/ssl_status.h" #include "net/url_request/url_request.h" -using content::BrowserThread; -using content::NavigationController; -using content::NavigationControllerImpl; -using content::NavigationEntry; -using content::NavigationEntryImpl; -using content::ResourceDispatcherHostImpl; -using content::ResourceRedirectDetails; -using content::ResourceRequestDetails; -using content::ResourceRequestInfoImpl; -using content::SSLStatus; -using content::WebContents; +namespace content { // static void SSLManager::OnSSLCertificateError( const base::WeakPtr<SSLErrorHandler::Delegate>& delegate, - const content::GlobalRequestID& id, + const GlobalRequestID& id, const ResourceType::Type resource_type, const GURL& url, int render_process_id, @@ -73,10 +63,10 @@ void SSLManager::OnSSLCertificateError( // static void SSLManager::NotifySSLInternalStateChanged( NavigationControllerImpl* controller) { - content::NotificationService::current()->Notify( - content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED, - content::Source<content::BrowserContext>(controller->GetBrowserContext()), - content::NotificationService::NoDetails()); + NotificationService::current()->Notify( + NOTIFICATION_SSL_INTERNAL_STATE_CHANGED, + Source<BrowserContext>(controller->GetBrowserContext()), + NotificationService::NoDetails()); } SSLManager::SSLManager(NavigationControllerImpl* controller) @@ -87,17 +77,17 @@ SSLManager::SSLManager(NavigationControllerImpl* controller) // Subscribe to various notifications. registrar_.Add( - this, content::NOTIFICATION_RESOURCE_RESPONSE_STARTED, - content::Source<WebContents>(controller_->web_contents())); + this, NOTIFICATION_RESOURCE_RESPONSE_STARTED, + Source<WebContents>(controller_->web_contents())); registrar_.Add( - this, content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT, - content::Source<WebContents>(controller_->web_contents())); + this, NOTIFICATION_RESOURCE_RECEIVED_REDIRECT, + Source<WebContents>(controller_->web_contents())); registrar_.Add( - this, content::NOTIFICATION_LOAD_FROM_MEMORY_CACHE, - content::Source<NavigationController>(controller_)); + this, NOTIFICATION_LOAD_FROM_MEMORY_CACHE, + Source<NavigationController>(controller_)); registrar_.Add( - this, content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED, - content::Source<content::BrowserContext>( + this, NOTIFICATION_SSL_INTERNAL_STATE_CHANGED, + Source<BrowserContext>( controller_->GetBrowserContext())); } @@ -105,9 +95,9 @@ SSLManager::~SSLManager() { } void SSLManager::DidCommitProvisionalLoad( - const content::NotificationDetails& in_details) { - content::LoadCommittedDetails* details = - content::Details<content::LoadCommittedDetails>(in_details).ptr(); + const NotificationDetails& in_details) { + LoadCommittedDetails* details = + Details<LoadCommittedDetails>(in_details).ptr(); NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry(controller_->GetActiveEntry()); @@ -119,7 +109,7 @@ void SSLManager::DidCommitProvisionalLoad( net::CertStatus ssl_cert_status; int ssl_security_bits; int ssl_connection_status; - content::DeserializeSecurityInfo(details->serialized_security_info, + DeserializeSecurityInfo(details->serialized_security_info, &ssl_cert_id, &ssl_cert_status, &ssl_security_bits, @@ -145,23 +135,23 @@ void SSLManager::DidRunInsecureContent(const std::string& security_origin) { } void SSLManager::Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) { + const NotificationSource& source, + const NotificationDetails& details) { // Dispatch by type. switch (type) { - case content::NOTIFICATION_RESOURCE_RESPONSE_STARTED: + case NOTIFICATION_RESOURCE_RESPONSE_STARTED: DidStartResourceResponse( - content::Details<ResourceRequestDetails>(details).ptr()); + Details<ResourceRequestDetails>(details).ptr()); break; - case content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT: + case NOTIFICATION_RESOURCE_RECEIVED_REDIRECT: DidReceiveResourceRedirect( - content::Details<ResourceRedirectDetails>(details).ptr()); + Details<ResourceRedirectDetails>(details).ptr()); break; - case content::NOTIFICATION_LOAD_FROM_MEMORY_CACHE: + case NOTIFICATION_LOAD_FROM_MEMORY_CACHE: DidLoadFromMemoryCache( - content::Details<content::LoadFromMemoryCacheDetails>(details).ptr()); + Details<LoadFromMemoryCacheDetails>(details).ptr()); break; - case content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED: + case NOTIFICATION_SSL_INTERNAL_STATE_CHANGED: DidChangeSSLInternalState(); break; default: @@ -169,8 +159,7 @@ void SSLManager::Observe(int type, } } -void SSLManager::DidLoadFromMemoryCache( - content::LoadFromMemoryCacheDetails* details) { +void SSLManager::DidLoadFromMemoryCache(LoadFromMemoryCacheDetails* details) { // Simulate loading this resource through the usual path. // Note that we specify SUB_RESOURCE as the resource type as WebCore only // caches sub-resources. @@ -225,9 +214,11 @@ void SSLManager::UpdateEntry(NavigationEntryImpl* entry) { policy()->UpdateEntry(entry, controller_->web_contents()); if (!entry->GetSSL().Equals(original_ssl_status)) { - content::NotificationService::current()->Notify( - content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED, - content::Source<NavigationController>(controller_), - content::NotificationService::NoDetails()); + NotificationService::current()->Notify( + NOTIFICATION_SSL_VISIBLE_STATE_CHANGED, + Source<NavigationController>(controller_), + NotificationService::NoDetails()); } } + +} // namespace content diff --git a/content/browser/ssl/ssl_manager.h b/content/browser/ssl/ssl_manager.h index b2e86d4..4349a90 100644 --- a/content/browser/ssl/ssl_manager.h +++ b/content/browser/ssl/ssl_manager.h @@ -20,19 +20,17 @@ #include "net/base/cert_status_flags.h" #include "net/base/net_errors.h" -class SSLPolicy; +namespace net { +class SSLInfo; +} namespace content { class NavigationEntryImpl; class NavigationControllerImpl; +class SSLPolicy; struct LoadFromMemoryCacheDetails; struct ResourceRedirectDetails; struct ResourceRequestDetails; -} - -namespace net { -class SSLInfo; -} // The SSLManager SSLManager controls the SSL UI elements in a WebContents. It // listens for various events that influence when these elements should or @@ -42,7 +40,7 @@ class SSLInfo; // The security state (secure/insecure) is stored in the navigation entry. // Along with it are stored any SSL error code and the associated cert. -class SSLManager : public content::NotificationObserver { +class SSLManager : public NotificationObserver { public: // Entry point for SSLCertificateErrors. This function begins the process // of resolving a certificate error during an SSL connection. SSLManager @@ -52,7 +50,7 @@ class SSLManager : public content::NotificationObserver { // Called on the IO thread. static void OnSSLCertificateError( const base::WeakPtr<SSLErrorHandler::Delegate>& delegate, - const content::GlobalRequestID& id, + const GlobalRequestID& id, ResourceType::Type resource_type, const GURL& url, int render_process_id, @@ -63,11 +61,11 @@ class SSLManager : public content::NotificationObserver { // Called when SSL state for a host or tab changes. Broadcasts the // SSL_INTERNAL_STATE_CHANGED notification. static void NotifySSLInternalStateChanged( - content::NavigationControllerImpl* controller); + NavigationControllerImpl* controller); // Construct an SSLManager for the specified tab. // If |delegate| is NULL, SSLPolicy::GetDefaultPolicy() is used. - explicit SSLManager(content::NavigationControllerImpl* controller); + explicit SSLManager(NavigationControllerImpl* controller); virtual ~SSLManager(); SSLPolicy* policy() { return policy_.get(); } @@ -75,12 +73,12 @@ class SSLManager : public content::NotificationObserver { // The navigation controller associated with this SSLManager. The // NavigationController is guaranteed to outlive the SSLManager. - content::NavigationControllerImpl* controller() { return controller_; } + NavigationControllerImpl* controller() { return controller_; } // This entry point is called directly (instead of via the notification // service) because we need more precise control of the order in which folks // are notified of this event. - void DidCommitProvisionalLoad(const content::NotificationDetails& details); + void DidCommitProvisionalLoad(const NotificationDetails& details); // Insecure content entry point. void DidRunInsecureContent(const std::string& security_origin); @@ -90,21 +88,21 @@ class SSLManager : public content::NotificationObserver { // // Called on the UI thread. virtual void Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const NotificationSource& source, + const NotificationDetails& details) OVERRIDE; private: // Entry points for notifications to which we subscribe. Note that // DidCommitProvisionalLoad uses the abstract NotificationDetails type since // the type we need is in NavigationController which would create a circular // header file dependency. - void DidLoadFromMemoryCache(content::LoadFromMemoryCacheDetails* details); - void DidStartResourceResponse(content::ResourceRequestDetails* details); - void DidReceiveResourceRedirect(content::ResourceRedirectDetails* details); + void DidLoadFromMemoryCache(LoadFromMemoryCacheDetails* details); + void DidStartResourceResponse(ResourceRequestDetails* details); + void DidReceiveResourceRedirect(ResourceRedirectDetails* details); void DidChangeSSLInternalState(); // Update the NavigationEntry with our current state. - void UpdateEntry(content::NavigationEntryImpl* entry); + void UpdateEntry(NavigationEntryImpl* entry); // The backend for the SSLPolicy to actuate its decisions. SSLPolicyBackend backend_; @@ -114,12 +112,14 @@ class SSLManager : public content::NotificationObserver { // The NavigationController that owns this SSLManager. We are responsible // for the security UI of this tab. - content::NavigationControllerImpl* controller_; + NavigationControllerImpl* controller_; // Handles registering notifications with the NotificationService. - content::NotificationRegistrar registrar_; + NotificationRegistrar registrar_; DISALLOW_COPY_AND_ASSIGN(SSLManager); }; +} // namespace content + #endif // CONTENT_BROWSER_SSL_SSL_MANAGER_H_ diff --git a/content/browser/ssl/ssl_policy.cc b/content/browser/ssl/ssl_policy.cc index b1c7d62..e8e9371 100644 --- a/content/browser/ssl/ssl_policy.cc +++ b/content/browser/ssl/ssl_policy.cc @@ -23,22 +23,20 @@ #include "net/base/ssl_info.h" #include "webkit/glue/resource_type.h" -using content::NavigationEntryImpl; -using content::SiteInstance; -using content::SSLStatus; -using content::WebContentsImpl; namespace { -static const char kDot = '.'; +const char kDot = '.'; -static bool IsIntranetHost(const std::string& host) { +bool IsIntranetHost(const std::string& host) { const size_t dot = host.find(kDot); return dot == std::string::npos || dot == host.length() - 1; } } // namespace +namespace content { + SSLPolicy::SSLPolicy(SSLPolicyBackend* backend) : backend_(backend) { DCHECK(backend_); @@ -123,7 +121,7 @@ void SSLPolicy::UpdateEntry(NavigationEntryImpl* entry, // happens, use the unauthenticated (HTTP) rather than the authentication // broken security style so that we can detect this error condition. if (!entry->GetSSL().cert_id) { - entry->GetSSL().security_style = content::SECURITY_STYLE_UNAUTHENTICATED; + entry->GetSSL().security_style = SECURITY_STYLE_UNAUTHENTICATED; return; } @@ -140,7 +138,7 @@ void SSLPolicy::UpdateEntry(NavigationEntryImpl* entry, // SECURITY_STYLE_AUTHENTICATION_BROKEN. if (!net::IsCertStatusMinorError(entry->GetSSL().cert_status)) { entry->GetSSL().security_style = - content::SECURITY_STYLE_AUTHENTICATION_BROKEN; + SECURITY_STYLE_AUTHENTICATION_BROKEN; } return; } @@ -153,7 +151,7 @@ void SSLPolicy::UpdateEntry(NavigationEntryImpl* entry, backend_->DidHostRunInsecureContent( entry->GetURL().host(), site_instance->GetProcess()->GetID())) { entry->GetSSL().security_style = - content::SECURITY_STYLE_AUTHENTICATION_BROKEN; + SECURITY_STYLE_AUTHENTICATION_BROKEN; entry->GetSSL().content_status |= SSLStatus::RAN_INSECURE_CONTENT; return; } @@ -206,7 +204,7 @@ void SSLPolicy::OnCertErrorInternal(SSLCertErrorHandler* handler, } bool cancel_request = false; - content::GetContentClient()->browser()->AllowCertificateError( + GetContentClient()->browser()->AllowCertificateError( handler->render_process_id(), handler->render_view_id(), handler->cert_error(), @@ -222,12 +220,11 @@ void SSLPolicy::OnCertErrorInternal(SSLCertErrorHandler* handler, } void SSLPolicy::InitializeEntryIfNeeded(NavigationEntryImpl* entry) { - if (entry->GetSSL().security_style != content::SECURITY_STYLE_UNKNOWN) + if (entry->GetSSL().security_style != SECURITY_STYLE_UNKNOWN) return; entry->GetSSL().security_style = entry->GetURL().SchemeIsSecure() ? - content::SECURITY_STYLE_AUTHENTICATED : - content::SECURITY_STYLE_UNAUTHENTICATED; + SECURITY_STYLE_AUTHENTICATED : SECURITY_STYLE_UNAUTHENTICATED; } void SSLPolicy::OriginRanInsecureContent(const std::string& origin, int pid) { @@ -235,3 +232,5 @@ void SSLPolicy::OriginRanInsecureContent(const std::string& origin, int pid) { if (parsed_origin.SchemeIsSecure()) backend_->HostRanInsecureContent(parsed_origin.host(), pid); } + +} // namespace content diff --git a/content/browser/ssl/ssl_policy.h b/content/browser/ssl/ssl_policy.h index 32edd30..7d5d361 100644 --- a/content/browser/ssl/ssl_policy.h +++ b/content/browser/ssl/ssl_policy.h @@ -10,14 +10,12 @@ #include "base/memory/ref_counted.h" #include "webkit/glue/resource_type.h" +namespace content { +class NavigationEntryImpl; class SSLCertErrorHandler; class SSLPolicyBackend; class SSLRequestInfo; - -namespace content { -class NavigationEntryImpl; class WebContentsImpl; -} // SSLPolicy // @@ -32,7 +30,7 @@ class SSLPolicy { // An error occurred with the certificate in an SSL connection. void OnCertError(SSLCertErrorHandler* handler); - void DidRunInsecureContent(content::NavigationEntryImpl* entry, + void DidRunInsecureContent(NavigationEntryImpl* entry, const std::string& security_origin); // We have started a resource request with the given info. @@ -40,8 +38,8 @@ class SSLPolicy { // Update the SSL information in |entry| to match the current state. // |web_contents| is the WebContentsImpl associated with this entry. - void UpdateEntry(content::NavigationEntryImpl* entry, - content::WebContentsImpl* web_contents); + void UpdateEntry(NavigationEntryImpl* entry, + WebContentsImpl* web_contents); SSLPolicyBackend* backend() const { return backend_; } @@ -63,7 +61,7 @@ class SSLPolicy { // If the security style of |entry| has not been initialized, then initialize // it with the default style for its URL. - void InitializeEntryIfNeeded(content::NavigationEntryImpl* entry); + void InitializeEntryIfNeeded(NavigationEntryImpl* entry); // Mark |origin| as having run insecure content in the process with ID |pid|. void OriginRanInsecureContent(const std::string& origin, int pid); @@ -74,4 +72,6 @@ class SSLPolicy { DISALLOW_COPY_AND_ASSIGN(SSLPolicy); }; +} // namespace content + #endif // CONTENT_BROWSER_SSL_SSL_POLICY_H_ diff --git a/content/browser/ssl/ssl_policy_backend.cc b/content/browser/ssl/ssl_policy_backend.cc index 7f53e66..c405b79 100644 --- a/content/browser/ssl/ssl_policy_backend.cc +++ b/content/browser/ssl/ssl_policy_backend.cc @@ -8,7 +8,7 @@ #include "content/browser/web_contents/navigation_controller_impl.h" #include "content/public/browser/browser_context.h" -using content::NavigationControllerImpl; +namespace content { SSLPolicyBackend::SSLPolicyBackend(NavigationControllerImpl* controller) : ssl_host_state_(SSLHostState::GetFor(controller->GetBrowserContext())), @@ -40,3 +40,5 @@ net::CertPolicy::Judgment SSLPolicyBackend::QueryPolicy( net::X509Certificate* cert, const std::string& host) { return ssl_host_state_->QueryPolicy(cert, host); } + +} // namespace content diff --git a/content/browser/ssl/ssl_policy_backend.h b/content/browser/ssl/ssl_policy_backend.h index 8dd20d5..3d8f390 100644 --- a/content/browser/ssl/ssl_policy_backend.h +++ b/content/browser/ssl/ssl_policy_backend.h @@ -12,15 +12,13 @@ #include "base/string16.h" #include "net/base/x509_certificate.h" -class SSLHostState; - namespace content { class NavigationControllerImpl; -} +class SSLHostState; class SSLPolicyBackend { public: - explicit SSLPolicyBackend(content::NavigationControllerImpl* controller); + explicit SSLPolicyBackend(NavigationControllerImpl* controller); // Records that a host has run insecure content. void HostRanInsecureContent(const std::string& host, int pid); @@ -42,9 +40,11 @@ class SSLPolicyBackend { // SSL state specific for each host. SSLHostState* ssl_host_state_; - content::NavigationControllerImpl* controller_; + NavigationControllerImpl* controller_; DISALLOW_COPY_AND_ASSIGN(SSLPolicyBackend); }; +} // namespace content + #endif // CONTENT_BROWSER_SSL_SSL_POLICY_BACKEND_H_ diff --git a/content/browser/ssl/ssl_request_info.cc b/content/browser/ssl/ssl_request_info.cc index 0459b6a..0c23f83 100644 --- a/content/browser/ssl/ssl_request_info.cc +++ b/content/browser/ssl/ssl_request_info.cc @@ -4,6 +4,8 @@ #include "content/browser/ssl/ssl_request_info.h" +namespace content { + SSLRequestInfo::SSLRequestInfo(const GURL& url, ResourceType::Type resource_type, int child_id, @@ -17,3 +19,5 @@ SSLRequestInfo::SSLRequestInfo(const GURL& url, } SSLRequestInfo::~SSLRequestInfo() {} + +} // namespace content diff --git a/content/browser/ssl/ssl_request_info.h b/content/browser/ssl/ssl_request_info.h index 114dcac..5e9428c 100644 --- a/content/browser/ssl/ssl_request_info.h +++ b/content/browser/ssl/ssl_request_info.h @@ -12,6 +12,8 @@ #include "net/base/cert_status_flags.h" #include "webkit/glue/resource_type.h" +namespace content { + // SSLRequestInfo wraps up the information SSLPolicy needs about a request in // order to update our security IU. SSLRequestInfo is RefCounted in case we // need to deal with the request asynchronously. @@ -43,4 +45,6 @@ class SSLRequestInfo : public base::RefCounted<SSLRequestInfo> { DISALLOW_COPY_AND_ASSIGN(SSLRequestInfo); }; +} // namespace content + #endif // CONTENT_BROWSER_SSL_SSL_REQUEST_INFO_H_ |