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

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

Issue 12041059: content: convert SSL notifications to observer usage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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
Index: content/browser/ssl/ssl_manager.cc
diff --git a/content/browser/ssl/ssl_manager.cc b/content/browser/ssl/ssl_manager.cc
index d41260e583e325a7dc9ef4e251c148ba006ce283..8435f13cf41574a0561bb852f3456ba5d1c425b3 100644
--- a/content/browser/ssl/ssl_manager.cc
+++ b/content/browser/ssl/ssl_manager.cc
@@ -60,15 +60,6 @@ void SSLManager::OnSSLCertificateError(
fatal)));
}
-// static
-void SSLManager::NotifySSLInternalStateChanged(
- NavigationControllerImpl* controller) {
- NotificationService::current()->Notify(
- NOTIFICATION_SSL_INTERNAL_STATE_CHANGED,
- Source<BrowserContext>(controller->GetBrowserContext()),
- NotificationService::NoDetails());
-}
-
SSLManager::SSLManager(NavigationControllerImpl* controller)
: backend_(controller),
policy_(new SSLPolicy(&backend_)),
@@ -85,10 +76,6 @@ SSLManager::SSLManager(NavigationControllerImpl* controller)
registrar_.Add(
this, NOTIFICATION_LOAD_FROM_MEMORY_CACHE,
Source<NavigationController>(controller_));
- registrar_.Add(
- this, NOTIFICATION_SSL_INTERNAL_STATE_CHANGED,
- Source<BrowserContext>(
- controller_->GetBrowserContext()));
}
SSLManager::~SSLManager() {
@@ -128,10 +115,30 @@ void SSLManager::DidCommitProvisionalLoad(
UpdateEntry(entry);
}
+void SSLManager::DidDisplayInsecureContent() {
+ UpdateEntry(
+ NavigationEntryImpl::FromNavigationEntry(controller_->GetActiveEntry()));
+}
+
void SSLManager::DidRunInsecureContent(const std::string& security_origin) {
- policy()->DidRunInsecureContent(
- NavigationEntryImpl::FromNavigationEntry(controller_->GetActiveEntry()),
- security_origin);
+ NavigationEntryImpl* navigation_entry =
+ NavigationEntryImpl::FromNavigationEntry(controller_->GetActiveEntry());
+ policy()->DidRunInsecureContent(navigation_entry, security_origin);
+ UpdateEntry(navigation_entry);
+}
+
+void SSLManager::UpdateEntry(NavigationEntryImpl* entry) {
+ // We don't always have a navigation entry to update, for example in the
+ // case of the Web Inspector.
+ if (!entry)
+ return;
+
+ SSLStatus original_ssl_status = entry->GetSSL(); // Copy!
+
+ policy()->UpdateEntry(entry, controller_->web_contents());
+
+ if (!entry->GetSSL().Equals(original_ssl_status))
+ controller_->web_contents()->NotifyVisibleSSLStateChanged();
}
void SSLManager::Observe(int type,
@@ -151,9 +158,6 @@ void SSLManager::Observe(int type,
DidLoadFromMemoryCache(
Details<LoadFromMemoryCacheDetails>(details).ptr());
break;
- case NOTIFICATION_SSL_INTERNAL_STATE_CHANGED:
- DidChangeSSLInternalState();
- break;
default:
NOTREACHED() << "The SSLManager received an unexpected notification.";
}
@@ -198,27 +202,4 @@ void SSLManager::DidReceiveResourceRedirect(ResourceRedirectDetails* details) {
// HTTP request to https://attacker.com/payload.js.
}
-void SSLManager::DidChangeSSLInternalState() {
- UpdateEntry(
- NavigationEntryImpl::FromNavigationEntry(controller_->GetActiveEntry()));
-}
-
-void SSLManager::UpdateEntry(NavigationEntryImpl* entry) {
- // We don't always have a navigation entry to update, for example in the
- // case of the Web Inspector.
- if (!entry)
- return;
-
- SSLStatus original_ssl_status = entry->GetSSL(); // Copy!
-
- policy()->UpdateEntry(entry, controller_->web_contents());
-
- if (!entry->GetSSL().Equals(original_ssl_status)) {
- NotificationService::current()->Notify(
- NOTIFICATION_SSL_VISIBLE_STATE_CHANGED,
- Source<NavigationController>(controller_),
- NotificationService::NoDetails());
- }
-}
-
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698