Index: chrome/browser/tab_contents/tab_contents.cc |
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc |
index 4641f3bd61653b8c38fc8b484241c0a56e0e6a23..d8cc1468b676988892a7dd97de5d46430d019c4e 100644 |
--- a/chrome/browser/tab_contents/tab_contents.cc |
+++ b/chrome/browser/tab_contents/tab_contents.cc |
@@ -31,6 +31,7 @@ |
#include "chrome/browser/favicon_service.h" |
#include "chrome/browser/form_field_history_manager.h" |
#include "chrome/browser/google_util.h" |
+#include "chrome/browser/host_content_settings_map.h" |
#include "chrome/browser/hung_renderer_dialog.h" |
#include "chrome/browser/jsmessage_box_handler.h" |
#include "chrome/browser/load_from_memory_cache_details.h" |
@@ -302,6 +303,10 @@ TabContents::TabContents(Profile* profile, |
NotificationService::AllSources()); |
#endif |
+ // Register for notifications about content setting changes. |
+ registrar_.Add(this, NotificationType::CONTENT_SETTINGS_CHANGED, |
+ NotificationService::AllSources()); |
+ |
// Keep a global copy of the previous search string (if any). |
static string16 global_last_search = string16(); |
last_search_prepopulate_text_ = &global_last_search; |
@@ -2718,6 +2723,22 @@ void TabContents::Observe(NotificationType type, |
} |
#endif |
+ case NotificationType::CONTENT_SETTINGS_CHANGED: { |
+ Details<HostContentSettingsMap::ContentSettingsDetails> |
+ settings_details(details); |
+ std::string host; |
+ NavigationEntry* entry = controller_.GetActiveEntry(); |
+ if (entry) |
+ host = entry->url().host(); |
+ Source<HostContentSettingsMap> content_settings(source); |
+ if (settings_details.ptr()->host().empty() || |
+ settings_details.ptr()->host() == host) { |
+ render_view_host()->SendContentSettings(host, |
+ content_settings.ptr()->GetContentSettings(host)); |
+ } |
+ break; |
+ } |
+ |
default: |
NOTREACHED(); |
} |