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 @@
#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() {
......
......@@ -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,
......
......@@ -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,
......
// 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);
};
......
......@@ -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) {
......
......@@ -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.
......
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