Index: chrome/browser/content_settings/tab_specific_content_settings.cc |
diff --git a/chrome/browser/content_settings/tab_specific_content_settings.cc b/chrome/browser/content_settings/tab_specific_content_settings.cc |
index 861df4d0c7d0687edb215cab9a2b6585d28165fa..f0d58a5f5bf5f6879b198fdabbb5aa062e38c880 100644 |
--- a/chrome/browser/content_settings/tab_specific_content_settings.cc |
+++ b/chrome/browser/content_settings/tab_specific_content_settings.cc |
@@ -237,6 +237,24 @@ void TabSpecificContentSettings::FileSystemAccessed(int render_process_id, |
settings->OnFileSystemAccessed(url, blocked_by_policy); |
} |
+const base::string16 TabSpecificContentSettings::blocked_plugin_names() const { |
+ const base::string16 kComma = base::string16(base::ASCIIToUTF16(", ")); |
Lei Zhang
2014/12/05 22:18:05
You don't need to call base::string16().
Will Harris
2014/12/08 00:21:11
Done.
|
+ |
+ base::string16 names; |
+ base::hash_set<base::string16>::const_iterator it = |
Lei Zhang
2014/12/05 22:18:05
You can probably just make this a C++11 Range-Base
Will Harris
2014/12/08 00:21:11
left using iterator as it's the fastest way to che
|
+ blocked_plugin_names_.begin(); |
+ while (it != blocked_plugin_names_.end()) { |
+ names.append(*it); |
+ it++; |
Lei Zhang
2014/12/05 22:18:05
++it;
Will Harris
2014/12/08 00:21:11
Done.
|
+ if (it != blocked_plugin_names_.end()) |
+ names.append(kComma); |
+ else |
+ break; |
+ } |
+ |
+ return names; |
+} |
+ |
bool TabSpecificContentSettings::IsContentBlocked( |
ContentSettingsType content_type) const { |
DCHECK(content_type != CONTENT_SETTINGS_TYPE_GEOLOCATION) |
@@ -291,6 +309,12 @@ bool TabSpecificContentSettings::IsContentAllowed( |
} |
void TabSpecificContentSettings::OnContentBlocked(ContentSettingsType type) { |
+ OnContentBlockedWithDetail(type, base::string16()); |
+} |
+ |
+void TabSpecificContentSettings::OnContentBlockedWithDetail( |
+ ContentSettingsType type, |
+ const base::string16& details) { |
DCHECK(type != CONTENT_SETTINGS_TYPE_GEOLOCATION) |
<< "Geolocation settings handled by OnGeolocationPermissionSet"; |
DCHECK(type != CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC && |
@@ -319,6 +343,10 @@ void TabSpecificContentSettings::OnContentBlocked(ContentSettingsType type) { |
} |
#endif |
+ if (type == CONTENT_SETTINGS_TYPE_PLUGINS) { |
+ blocked_plugin_names_.insert(details); |
+ } |
+ |
if (!content_blocked_[type]) { |
content_blocked_[type] = true; |
// TODO: it would be nice to have a way of mocking this in tests. |
@@ -698,7 +726,8 @@ bool TabSpecificContentSettings::OnMessageReceived( |
content::RenderFrameHost* render_frame_host) { |
bool handled = true; |
IPC_BEGIN_MESSAGE_MAP(TabSpecificContentSettings, message) |
- IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ContentBlocked, OnContentBlocked) |
Lei Zhang
2014/12/05 22:18:05
Is OnContentBlocked() still used?
Will Harris
2014/12/08 00:21:11
used by the tests
Lei Zhang
2014/12/08 20:08:19
If it's the case that only tests call it, it's pro
Will Harris
2014/12/08 21:11:46
Actually, changing the default function signature
|
+ IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ContentBlocked, |
+ OnContentBlockedWithDetail) |
IPC_MESSAGE_UNHANDLED(handled = false) |
IPC_END_MESSAGE_MAP() |
return handled; |
@@ -710,6 +739,7 @@ void TabSpecificContentSettings::DidNavigateMainFrame( |
if (!details.is_in_page) { |
// Clear "blocked" flags. |
ClearBlockedContentSettingsExceptForCookies(); |
+ blocked_plugin_names_.clear(); |
GeolocationDidNavigate(details); |
MidiDidNavigate(details); |
} |