| Index: chrome/browser/host_content_settings_map.cc
 | 
| ===================================================================
 | 
| --- chrome/browser/host_content_settings_map.cc	(revision 66837)
 | 
| +++ chrome/browser/host_content_settings_map.cc	(working copy)
 | 
| @@ -99,6 +99,20 @@
 | 
|           url.SchemeIs(chrome::kGearsScheme) ||
 | 
|           url.SchemeIs(chrome::kUserScriptScheme);
 | 
|  }
 | 
| +
 | 
| +// Map ASK for the plugins content type to BLOCK if click-to-play is
 | 
| +// not enabled.
 | 
| +ContentSetting ClickToPlayFixup(ContentSettingsType content_type,
 | 
| +                                ContentSetting setting) {
 | 
| +  if (setting == CONTENT_SETTING_ASK &&
 | 
| +      content_type == CONTENT_SETTINGS_TYPE_PLUGINS &&
 | 
| +      !CommandLine::ForCurrentProcess()->HasSwitch(
 | 
| +          switches::kEnableClickToPlay)) {
 | 
| +    return CONTENT_SETTING_BLOCK;
 | 
| +  }
 | 
| +  return setting;
 | 
| +}
 | 
| +
 | 
|  }  // namespace
 | 
|  
 | 
|  // static
 | 
| @@ -450,6 +464,10 @@
 | 
|      ContentSetting setting) {
 | 
|    DCHECK(kTypeNames[content_type] != NULL);  // Don't call this for Geolocation.
 | 
|    DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
 | 
| +  DCHECK(content_type != CONTENT_SETTINGS_TYPE_PLUGINS ||
 | 
| +         setting != CONTENT_SETTING_ASK ||
 | 
| +         CommandLine::ForCurrentProcess()->HasSwitch(
 | 
| +            switches::kEnableClickToPlay));
 | 
|    PrefService* prefs = profile_->GetPrefs();
 | 
|  
 | 
|    // The default settings may not be directly modified for OTR sessions.
 | 
| @@ -492,6 +510,10 @@
 | 
|    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));
 | 
|  
 | 
|    bool early_exit = false;
 | 
|    std::string pattern_str(pattern.AsString());
 | 
| @@ -805,6 +827,10 @@
 | 
|    if (settings->settings[CONTENT_SETTINGS_TYPE_COOKIES] ==
 | 
|        CONTENT_SETTING_ASK)
 | 
|      settings->settings[CONTENT_SETTINGS_TYPE_COOKIES] = CONTENT_SETTING_BLOCK;
 | 
| +
 | 
| +  settings->settings[CONTENT_SETTINGS_TYPE_PLUGINS] =
 | 
| +      ClickToPlayFixup(CONTENT_SETTINGS_TYPE_PLUGINS,
 | 
| +                       settings->settings[CONTENT_SETTINGS_TYPE_PLUGINS]);
 | 
|  }
 | 
|  
 | 
|  void HostContentSettingsMap::GetResourceSettingsFromDictionary(
 | 
| @@ -829,7 +855,8 @@
 | 
|            DCHECK(found);
 | 
|            (*settings)[ContentSettingsTypeResourceIdentifierPair(
 | 
|                ContentSettingsType(type), resource_identifier)] =
 | 
| -                  ContentSetting(setting);
 | 
| +                  ClickToPlayFixup(ContentSettingsType(type),
 | 
| +                                   ContentSetting(setting));
 | 
|          }
 | 
|  
 | 
|          break;
 | 
| 
 |