Chromium Code Reviews| 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..f8732a96bac0c8a545fef7509113a466ca65b583 100644 |
| --- a/chrome/browser/content_settings/tab_specific_content_settings.cc |
| +++ b/chrome/browser/content_settings/tab_specific_content_settings.cc |
| @@ -237,6 +237,22 @@ void TabSpecificContentSettings::FileSystemAccessed(int render_process_id, |
| settings->OnFileSystemAccessed(url, blocked_by_policy); |
| } |
| +const base::string16 TabSpecificContentSettings::GetBlockedPluginNames() const { |
| + const base::string16 kComma = base::ASCIIToUTF16(", "); |
| + |
| + base::string16 names; |
|
Bernhard Bauer
2014/12/08 09:21:44
There is JoinString (in base/strings/string_util.h
Will Harris
2014/12/08 21:11:46
Done.
|
| + base::hash_set<base::string16>::const_iterator it = |
| + blocked_plugin_names_.begin(); |
| + while (it != blocked_plugin_names_.end()) { |
| + names.append(*it); |
| + ++it; |
| + if (it != blocked_plugin_names_.end()) |
| + names.append(kComma); |
| + } |
| + |
| + return names; |
| +} |
| + |
| bool TabSpecificContentSettings::IsContentBlocked( |
| ContentSettingsType content_type) const { |
| DCHECK(content_type != CONTENT_SETTINGS_TYPE_GEOLOCATION) |
| @@ -291,6 +307,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 +341,10 @@ void TabSpecificContentSettings::OnContentBlocked(ContentSettingsType type) { |
| } |
| #endif |
| + if (type == CONTENT_SETTINGS_TYPE_PLUGINS) { |
| + blocked_plugin_names_.insert(details); |
|
Bernhard Bauer
2014/12/08 09:21:44
Is this going to insert an empty string into the s
Bernhard Bauer
2014/12/08 09:21:44
Leave out the braces for single-line statements.
Will Harris
2014/12/08 21:11:46
Done.
|
| + } |
| + |
| if (!content_blocked_[type]) { |
| content_blocked_[type] = true; |
| // TODO: it would be nice to have a way of mocking this in tests. |
| @@ -698,7 +724,8 @@ bool TabSpecificContentSettings::OnMessageReceived( |
| content::RenderFrameHost* render_frame_host) { |
| bool handled = true; |
| IPC_BEGIN_MESSAGE_MAP(TabSpecificContentSettings, message) |
| - IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ContentBlocked, OnContentBlocked) |
| + IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ContentBlocked, |
| + OnContentBlockedWithDetail) |
| IPC_MESSAGE_UNHANDLED(handled = false) |
| IPC_END_MESSAGE_MAP() |
| return handled; |
| @@ -710,6 +737,7 @@ void TabSpecificContentSettings::DidNavigateMainFrame( |
| if (!details.is_in_page) { |
| // Clear "blocked" flags. |
| ClearBlockedContentSettingsExceptForCookies(); |
| + blocked_plugin_names_.clear(); |
| GeolocationDidNavigate(details); |
| MidiDidNavigate(details); |
| } |