Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(896)

Unified Diff: content/browser/ssl/ssl_manager.cc

Issue 23947003: Create WebContentsObserver callbacks for notifications, remove notifications from SSLManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: formatting Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/ssl/ssl_manager.h ('k') | content/browser/web_contents/navigation_controller_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/ssl/ssl_manager.cc
diff --git a/content/browser/ssl/ssl_manager.cc b/content/browser/ssl/ssl_manager.cc
index c86dccdcda6b73078349aa079742d69debc3e471..42ee02fbb1cc90c4f22b3b9d46edc403cef9f245 100644
--- a/content/browser/ssl/ssl_manager.cc
+++ b/content/browser/ssl/ssl_manager.cc
@@ -21,8 +21,6 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/load_from_memory_cache_details.h"
#include "content/public/browser/navigation_details.h"
-#include "content/public/browser/notification_service.h"
-#include "content/public/browser/notification_source.h"
#include "content/public/browser/resource_request_details.h"
#include "content/public/common/ssl_status.h"
#include "net/url_request/url_request.h"
@@ -99,17 +97,6 @@ SSLManager::SSLManager(NavigationControllerImpl* controller)
controller_(controller) {
DCHECK(controller_);
- // Subscribe to various notifications.
- registrar_.Add(
- this, NOTIFICATION_RESOURCE_RESPONSE_STARTED,
- Source<WebContents>(controller_->web_contents()));
- registrar_.Add(
- this, NOTIFICATION_RESOURCE_RECEIVED_REDIRECT,
- Source<WebContents>(controller_->web_contents()));
- registrar_.Add(
- this, NOTIFICATION_LOAD_FROM_MEMORY_CACHE,
- Source<NavigationController>(controller_));
-
SSLManagerSet* managers = static_cast<SSLManagerSet*>(
controller_->GetBrowserContext()->GetUserData(kSSLManagerKeyName));
if (!managers) {
@@ -125,22 +112,18 @@ SSLManager::~SSLManager() {
managers->get().erase(this);
}
-void SSLManager::DidCommitProvisionalLoad(
- const NotificationDetails& in_details) {
- LoadCommittedDetails* details =
- Details<LoadCommittedDetails>(in_details).ptr();
-
+void SSLManager::DidCommitProvisionalLoad(const LoadCommittedDetails& details) {
NavigationEntryImpl* entry =
NavigationEntryImpl::FromNavigationEntry(controller_->GetActiveEntry());
- if (details->is_main_frame) {
+ if (details.is_main_frame) {
if (entry) {
// Decode the security details.
int ssl_cert_id;
net::CertStatus ssl_cert_status;
int ssl_security_bits;
int ssl_connection_status;
- DeserializeSecurityInfo(details->serialized_security_info,
+ DeserializeSecurityInfo(details.serialized_security_info,
&ssl_cert_id,
&ssl_cert_status,
&ssl_security_bits,
@@ -171,52 +154,32 @@ void SSLManager::DidRunInsecureContent(const std::string& security_origin) {
UpdateEntry(navigation_entry);
}
-void SSLManager::Observe(int type,
- const NotificationSource& source,
- const NotificationDetails& details) {
- // Dispatch by type.
- switch (type) {
- case NOTIFICATION_RESOURCE_RESPONSE_STARTED:
- DidStartResourceResponse(
- Details<ResourceRequestDetails>(details).ptr());
- break;
- case NOTIFICATION_RESOURCE_RECEIVED_REDIRECT:
- DidReceiveResourceRedirect(
- Details<ResourceRedirectDetails>(details).ptr());
- break;
- case NOTIFICATION_LOAD_FROM_MEMORY_CACHE:
- DidLoadFromMemoryCache(
- Details<LoadFromMemoryCacheDetails>(details).ptr());
- break;
- default:
- NOTREACHED() << "The SSLManager received an unexpected notification.";
- }
-}
-
-void SSLManager::DidLoadFromMemoryCache(LoadFromMemoryCacheDetails* details) {
+void SSLManager::DidLoadFromMemoryCache(
+ const 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.
// This resource must have been loaded with no filtering because filtered
// resouces aren't cachable.
scoped_refptr<SSLRequestInfo> info(new SSLRequestInfo(
- details->url,
+ details.url,
ResourceType::SUB_RESOURCE,
- details->pid,
- details->cert_id,
- details->cert_status));
+ details.pid,
+ details.cert_id,
+ details.cert_status));
// Simulate loading this resource through the usual path.
policy()->OnRequestStarted(info.get());
}
-void SSLManager::DidStartResourceResponse(ResourceRequestDetails* details) {
+void SSLManager::DidStartResourceResponse(
+ const ResourceRequestDetails& details) {
scoped_refptr<SSLRequestInfo> info(new SSLRequestInfo(
- details->url,
- details->resource_type,
- details->origin_child_id,
- details->ssl_cert_id,
- details->ssl_cert_status));
+ details.url,
+ details.resource_type,
+ details.origin_child_id,
+ details.ssl_cert_id,
+ details.ssl_cert_status));
// Notify our policy that we started a resource request. Ideally, the
// policy should have the ability to cancel the request, but we can't do
@@ -224,7 +187,8 @@ void SSLManager::DidStartResourceResponse(ResourceRequestDetails* details) {
policy()->OnRequestStarted(info.get());
}
-void SSLManager::DidReceiveResourceRedirect(ResourceRedirectDetails* details) {
+void SSLManager::DidReceiveResourceRedirect(
+ const ResourceRedirectDetails& details) {
// TODO(abarth): Make sure our redirect behavior is correct. If we ever see a
// non-HTTPS resource in the redirect chain, we want to trigger
// insecure content, even if the redirect chain goes back to
« no previous file with comments | « content/browser/ssl/ssl_manager.h ('k') | content/browser/web_contents/navigation_controller_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698