summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-05 00:06:56 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-05 00:06:56 +0000
commitc3d78e06c57fcd18a04110472e2456a513c903ac (patch)
treeb0e1b64e0f0afc470c9ebabf8eb98d78bbd3672f
parenteb07f55914c156ac2b521f6a5268f50d9d1e1d37 (diff)
downloadchromium_src-c3d78e06c57fcd18a04110472e2456a513c903ac.zip
chromium_src-c3d78e06c57fcd18a04110472e2456a513c903ac.tar.gz
chromium_src-c3d78e06c57fcd18a04110472e2456a513c903ac.tar.bz2
Profiles: SSLManger broadcasts SSL_INTERNAL_STATE_CHANGED with a Source<BrowserContext> instead of a Source<NavigationController>.
We do this since SSLManagers want to hear all the notifications coming from different NavigationControllers; not just from the one they are associated with. BUG=87457 TEST=none R=abarth TBR=darin Review URL: http://codereview.chromium.org/7542029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95541 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/browser/ssl/ssl_manager.cc9
-rw-r--r--content/browser/ssl/ssl_manager.h2
-rw-r--r--content/browser/ssl/ssl_policy_backend.cc7
-rw-r--r--content/browser/ssl/ssl_policy_backend.h4
-rw-r--r--content/browser/tab_contents/tab_contents.cc4
-rw-r--r--content/common/content_notification_types.h4
6 files changed, 18 insertions, 12 deletions
diff --git a/content/browser/ssl/ssl_manager.cc b/content/browser/ssl/ssl_manager.cc
index 0f6fff3..2f88040 100644
--- a/content/browser/ssl/ssl_manager.cc
+++ b/content/browser/ssl/ssl_manager.cc
@@ -18,6 +18,7 @@
#include "content/browser/tab_contents/provisional_load_details.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/common/notification_service.h"
+#include "content/common/notification_source.h"
#include "net/base/cert_status_flags.h"
// static
@@ -44,10 +45,11 @@ void SSLManager::OnSSLCertificateError(ResourceDispatcherHost* rdh,
}
// static
-void SSLManager::NotifySSLInternalStateChanged() {
+void SSLManager::NotifySSLInternalStateChanged(
+ NavigationController* controller) {
NotificationService::current()->Notify(
content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED,
- NotificationService::AllSources(),
+ Source<content::BrowserContext>(controller->browser_context()),
NotificationService::NoDetails());
}
@@ -105,7 +107,8 @@ SSLManager::SSLManager(NavigationController* controller)
registrar_.Add(this, content::NOTIFICATION_LOAD_FROM_MEMORY_CACHE,
Source<NavigationController>(controller_));
registrar_.Add(this, content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED,
- NotificationService::AllSources());
+ Source<content::BrowserContext>(
+ controller_->browser_context()));
}
SSLManager::~SSLManager() {
diff --git a/content/browser/ssl/ssl_manager.h b/content/browser/ssl/ssl_manager.h
index 6961c20..07e3a57 100644
--- a/content/browser/ssl/ssl_manager.h
+++ b/content/browser/ssl/ssl_manager.h
@@ -52,7 +52,7 @@ class SSLManager : public NotificationObserver {
// Called when SSL state for a host or tab changes. Broadcasts the
// SSL_INTERNAL_STATE_CHANGED notification.
- static void NotifySSLInternalStateChanged();
+ static void NotifySSLInternalStateChanged(NavigationController* controller);
// Convenience methods for serializing/deserializing the security info.
static std::string SerializeSecurityInfo(int cert_id,
diff --git a/content/browser/ssl/ssl_policy_backend.cc b/content/browser/ssl/ssl_policy_backend.cc
index 77689a9..60137cf 100644
--- a/content/browser/ssl/ssl_policy_backend.cc
+++ b/content/browser/ssl/ssl_policy_backend.cc
@@ -9,13 +9,14 @@
#include "content/browser/tab_contents/navigation_controller.h"
SSLPolicyBackend::SSLPolicyBackend(NavigationController* controller)
- : ssl_host_state_(controller->browser_context()->GetSSLHostState()) {
- DCHECK(controller);
+ : ssl_host_state_(controller->browser_context()->GetSSLHostState()),
+ controller_(controller) {
+ DCHECK(controller_);
}
void SSLPolicyBackend::HostRanInsecureContent(const std::string& host, int id) {
ssl_host_state_->HostRanInsecureContent(host, id);
- SSLManager::NotifySSLInternalStateChanged();
+ SSLManager::NotifySSLInternalStateChanged(controller_);
}
bool SSLPolicyBackend::DidHostRunInsecureContent(const std::string& host,
diff --git a/content/browser/ssl/ssl_policy_backend.h b/content/browser/ssl/ssl_policy_backend.h
index 97fa38f..8c88af5 100644
--- a/content/browser/ssl/ssl_policy_backend.h
+++ b/content/browser/ssl/ssl_policy_backend.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -40,6 +40,8 @@ class SSLPolicyBackend {
// SSL state specific for each host.
SSLHostState* ssl_host_state_;
+ NavigationController* controller_;
+
DISALLOW_COPY_AND_ASSIGN(SSLPolicyBackend);
};
diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc
index 2197339..14a387a 100644
--- a/content/browser/tab_contents/tab_contents.cc
+++ b/content/browser/tab_contents/tab_contents.cc
@@ -1002,7 +1002,7 @@ void TabContents::OnDidLoadResourceFromMemoryCache(
void TabContents::OnDidDisplayInsecureContent() {
UserMetrics::RecordAction(UserMetricsAction("SSL.DisplayedInsecureContent"));
displayed_insecure_content_ = true;
- SSLManager::NotifySSLInternalStateChanged();
+ SSLManager::NotifySSLInternalStateChanged(&controller());
}
void TabContents::OnDidRunInsecureContent(
@@ -1016,7 +1016,7 @@ void TabContents::OnDidRunInsecureContent(
}
controller_.ssl_manager()->DidRunInsecureContent(security_origin);
displayed_insecure_content_ = true;
- SSLManager::NotifySSLInternalStateChanged();
+ SSLManager::NotifySSLInternalStateChanged(&controller());
}
void TabContents::OnDocumentLoadedInFrame(int64 frame_id) {
diff --git a/content/common/content_notification_types.h b/content/common/content_notification_types.h
index 3b1fe92..d0ae76f 100644
--- a/content/common/content_notification_types.h
+++ b/content/common/content_notification_types.h
@@ -162,8 +162,8 @@ enum {
// or a secure origin might have included some insecure content. Listen to
// this notifiation if you need to keep track of our internal SSL state.
//
- // The source will be the navigation controller associated with the state
- // change. There are no details.
+ // The source will be the browser context. The details will be the navigation
+ // controller associated with the state change.
NOTIFICATION_SSL_INTERNAL_STATE_CHANGED,
// The user accepted or dismissed a SSL client authentication request.