Commit c3d78e06 authored by erg@google.com's avatar erg@google.com

Profiles: SSLManger broadcasts SSL_INTERNAL_STATE_CHANGED with a...

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
parent eb07f559
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "content/browser/tab_contents/provisional_load_details.h" #include "content/browser/tab_contents/provisional_load_details.h"
#include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents.h"
#include "content/common/notification_service.h" #include "content/common/notification_service.h"
#include "content/common/notification_source.h"
#include "net/base/cert_status_flags.h" #include "net/base/cert_status_flags.h"
// static // static
...@@ -44,10 +45,11 @@ void SSLManager::OnSSLCertificateError(ResourceDispatcherHost* rdh, ...@@ -44,10 +45,11 @@ void SSLManager::OnSSLCertificateError(ResourceDispatcherHost* rdh,
} }
// static // static
void SSLManager::NotifySSLInternalStateChanged() { void SSLManager::NotifySSLInternalStateChanged(
NavigationController* controller) {
NotificationService::current()->Notify( NotificationService::current()->Notify(
content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED, content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED,
NotificationService::AllSources(), Source<content::BrowserContext>(controller->browser_context()),
NotificationService::NoDetails()); NotificationService::NoDetails());
} }
...@@ -105,7 +107,8 @@ SSLManager::SSLManager(NavigationController* controller) ...@@ -105,7 +107,8 @@ SSLManager::SSLManager(NavigationController* controller)
registrar_.Add(this, content::NOTIFICATION_LOAD_FROM_MEMORY_CACHE, registrar_.Add(this, content::NOTIFICATION_LOAD_FROM_MEMORY_CACHE,
Source<NavigationController>(controller_)); Source<NavigationController>(controller_));
registrar_.Add(this, content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED, registrar_.Add(this, content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED,
NotificationService::AllSources()); Source<content::BrowserContext>(
controller_->browser_context()));
} }
SSLManager::~SSLManager() { SSLManager::~SSLManager() {
......
...@@ -52,7 +52,7 @@ class SSLManager : public NotificationObserver { ...@@ -52,7 +52,7 @@ class SSLManager : public NotificationObserver {
// Called when SSL state for a host or tab changes. Broadcasts the // Called when SSL state for a host or tab changes. Broadcasts the
// SSL_INTERNAL_STATE_CHANGED notification. // SSL_INTERNAL_STATE_CHANGED notification.
static void NotifySSLInternalStateChanged(); static void NotifySSLInternalStateChanged(NavigationController* controller);
// Convenience methods for serializing/deserializing the security info. // Convenience methods for serializing/deserializing the security info.
static std::string SerializeSecurityInfo(int cert_id, static std::string SerializeSecurityInfo(int cert_id,
......
...@@ -9,13 +9,14 @@ ...@@ -9,13 +9,14 @@
#include "content/browser/tab_contents/navigation_controller.h" #include "content/browser/tab_contents/navigation_controller.h"
SSLPolicyBackend::SSLPolicyBackend(NavigationController* controller) SSLPolicyBackend::SSLPolicyBackend(NavigationController* controller)
: ssl_host_state_(controller->browser_context()->GetSSLHostState()) { : ssl_host_state_(controller->browser_context()->GetSSLHostState()),
DCHECK(controller); controller_(controller) {
DCHECK(controller_);
} }
void SSLPolicyBackend::HostRanInsecureContent(const std::string& host, int id) { void SSLPolicyBackend::HostRanInsecureContent(const std::string& host, int id) {
ssl_host_state_->HostRanInsecureContent(host, id); ssl_host_state_->HostRanInsecureContent(host, id);
SSLManager::NotifySSLInternalStateChanged(); SSLManager::NotifySSLInternalStateChanged(controller_);
} }
bool SSLPolicyBackend::DidHostRunInsecureContent(const std::string& host, bool SSLPolicyBackend::DidHostRunInsecureContent(const std::string& host,
......
// 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 // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -40,6 +40,8 @@ class SSLPolicyBackend { ...@@ -40,6 +40,8 @@ class SSLPolicyBackend {
// SSL state specific for each host. // SSL state specific for each host.
SSLHostState* ssl_host_state_; SSLHostState* ssl_host_state_;
NavigationController* controller_;
DISALLOW_COPY_AND_ASSIGN(SSLPolicyBackend); DISALLOW_COPY_AND_ASSIGN(SSLPolicyBackend);
}; };
......
...@@ -1002,7 +1002,7 @@ void TabContents::OnDidLoadResourceFromMemoryCache( ...@@ -1002,7 +1002,7 @@ void TabContents::OnDidLoadResourceFromMemoryCache(
void TabContents::OnDidDisplayInsecureContent() { void TabContents::OnDidDisplayInsecureContent() {
UserMetrics::RecordAction(UserMetricsAction("SSL.DisplayedInsecureContent")); UserMetrics::RecordAction(UserMetricsAction("SSL.DisplayedInsecureContent"));
displayed_insecure_content_ = true; displayed_insecure_content_ = true;
SSLManager::NotifySSLInternalStateChanged(); SSLManager::NotifySSLInternalStateChanged(&controller());
} }
void TabContents::OnDidRunInsecureContent( void TabContents::OnDidRunInsecureContent(
...@@ -1016,7 +1016,7 @@ void TabContents::OnDidRunInsecureContent( ...@@ -1016,7 +1016,7 @@ void TabContents::OnDidRunInsecureContent(
} }
controller_.ssl_manager()->DidRunInsecureContent(security_origin); controller_.ssl_manager()->DidRunInsecureContent(security_origin);
displayed_insecure_content_ = true; displayed_insecure_content_ = true;
SSLManager::NotifySSLInternalStateChanged(); SSLManager::NotifySSLInternalStateChanged(&controller());
} }
void TabContents::OnDocumentLoadedInFrame(int64 frame_id) { void TabContents::OnDocumentLoadedInFrame(int64 frame_id) {
......
...@@ -162,8 +162,8 @@ enum { ...@@ -162,8 +162,8 @@ enum {
// or a secure origin might have included some insecure content. Listen to // 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. // this notifiation if you need to keep track of our internal SSL state.
// //
// The source will be the navigation controller associated with the state // The source will be the browser context. The details will be the navigation
// change. There are no details. // controller associated with the state change.
NOTIFICATION_SSL_INTERNAL_STATE_CHANGED, NOTIFICATION_SSL_INTERNAL_STATE_CHANGED,
// The user accepted or dismissed a SSL client authentication request. // The user accepted or dismissed a SSL client authentication request.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment