diff options
author | bauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-15 15:09:44 +0000 |
---|---|---|
committer | bauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-15 15:09:44 +0000 |
commit | 3a21ea5de902b5be5a0945aa29fbe0b226215d97 (patch) | |
tree | 7873f5ddb91306ae4026ec346edf8aa129eaeb1e | |
parent | d70fb3654b968d378139d71942ee2cc5b73c6996 (diff) | |
download | chromium_src-3a21ea5de902b5be5a0945aa29fbe0b226215d97.zip chromium_src-3a21ea5de902b5be5a0945aa29fbe0b226215d97.tar.gz chromium_src-3a21ea5de902b5be5a0945aa29fbe0b226215d97.tar.bz2 |
Use empty resource identifier unless --enable-resource-content-settings is set.
BUG=85748
TEST=see bug
Review URL: http://codereview.chromium.org/7167007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89187 0039d316-1c4b-4281-b951-d872f2087c98
3 files changed, 11 insertions, 12 deletions
diff --git a/chrome/browser/content_settings/content_settings_pref_provider.cc b/chrome/browser/content_settings/content_settings_pref_provider.cc index 3edac54..10c365d 100644 --- a/chrome/browser/content_settings/content_settings_pref_provider.cc +++ b/chrome/browser/content_settings/content_settings_pref_provider.cc @@ -458,8 +458,6 @@ void PrefProvider::GetAllContentSettingsRules( ContentSettingsType content_type, const ResourceIdentifier& resource_identifier, Rules* content_setting_rules) const { - DCHECK_NE(RequiresResourceIdentifier(content_type), - resource_identifier.empty()); DCHECK(content_setting_rules); content_setting_rules->clear(); @@ -493,12 +491,6 @@ void PrefProvider::SetContentSetting( DCHECK(kTypeNames[content_type] != NULL); // Don't call this for Geolocation. DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - DCHECK_NE(RequiresResourceIdentifier(content_type), - resource_identifier.empty()); - DCHECK(content_type != CONTENT_SETTINGS_TYPE_PLUGINS || - setting != CONTENT_SETTING_ASK || - CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableClickToPlay)); updating_preferences_ = true; { diff --git a/chrome/browser/content_settings/host_content_settings_map.cc b/chrome/browser/content_settings/host_content_settings_map.cc index 153a6c7..682256e 100644 --- a/chrome/browser/content_settings/host_content_settings_map.cc +++ b/chrome/browser/content_settings/host_content_settings_map.cc @@ -11,6 +11,7 @@ #include "chrome/browser/content_settings/content_settings_policy_provider.h" #include "chrome/browser/content_settings/content_settings_pref_provider.h" #include "chrome/browser/content_settings/content_settings_provider.h" +#include "chrome/browser/content_settings/content_settings_utils.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" @@ -162,6 +163,8 @@ ContentSetting HostContentSettingsMap::GetContentSetting( ContentSettingsType content_type, const std::string& resource_identifier) const { DCHECK_NE(CONTENT_SETTINGS_TYPE_COOKIES, content_type); + DCHECK_NE(content_settings::RequiresResourceIdentifier(content_type), + resource_identifier.empty()); return GetContentSettingInternal(url, content_type, resource_identifier); } @@ -261,6 +264,8 @@ void HostContentSettingsMap::GetSettingsForOneType( ContentSettingsType content_type, const std::string& resource_identifier, SettingsForOneType* settings) const { + DCHECK_NE(content_settings::RequiresResourceIdentifier(content_type), + resource_identifier.empty()); DCHECK(settings); // Collect content_settings::Rules for the given content_type and // resource_identifier from the content settings providers. @@ -309,6 +314,8 @@ void HostContentSettingsMap::SetContentSetting( const std::string& resource_identifier, ContentSetting setting) { DCHECK(IsSettingAllowedForType(setting, content_type)); + DCHECK_NE(content_settings::RequiresResourceIdentifier(content_type), + resource_identifier.empty()); for (ProviderIterator provider = content_settings_providers_.begin(); provider != content_settings_providers_.end(); ++provider) { diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc index bd71656..21b8e41 100644 --- a/chrome/renderer/chrome_content_renderer_client.cc +++ b/chrome/renderer/chrome_content_renderer_client.cc @@ -267,7 +267,9 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin( DCHECK(group != NULL); ContentSetting plugin_setting = CONTENT_SETTING_DEFAULT; - std::string resource = group->identifier(); + std::string resource; + if (cmd->HasSwitch(switches::kEnableResourceContentSettings)) + resource = group->identifier(); render_view->Send(new ViewHostMsg_GetPluginContentSetting( frame->top()->url(), resource, &plugin_setting)); DCHECK(plugin_setting != CONTENT_SETTING_DEFAULT); @@ -350,9 +352,7 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin( frame, params, info.path, actual_mime_type); } - observer->DidBlockContentType(CONTENT_SETTINGS_TYPE_PLUGINS, - cmd->HasSwitch(switches::kEnableResourceContentSettings) ? - resource : std::string()); + observer->DidBlockContentType(CONTENT_SETTINGS_TYPE_PLUGINS, resource); if (plugin_setting == CONTENT_SETTING_ASK) { return CreatePluginPlaceholder( render_view, frame, params, *group, IDR_CLICK_TO_PLAY_PLUGIN_HTML, |