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

Unified Diff: chrome/browser/tab_contents/tab_contents.cc

Issue 551225: Send a message to the renderers when content settings change. (Closed)
Patch Set: merge Created 10 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
« no previous file with comments | « chrome/browser/renderer_host/render_view_host.cc ('k') | chrome/common/notification_type.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « chrome/browser/renderer_host/render_view_host.cc ('k') | chrome/common/notification_type.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698