Chromium Code Reviews| Index: chrome/browser/pdf_unsupported_feature.cc |
| diff --git a/chrome/browser/pdf_unsupported_feature.cc b/chrome/browser/pdf_unsupported_feature.cc |
| index 1a91a39e0934104c806a4b9a13aa19c9d808474a..d3bdf3f277eb1e0887bc0cb64b6445008bf42ec4 100644 |
| --- a/chrome/browser/pdf_unsupported_feature.cc |
| +++ b/chrome/browser/pdf_unsupported_feature.cc |
| @@ -116,14 +116,13 @@ string16 PDFEnableAdobeReaderInfoBarDelegate::GetMessageText() const { |
| void PDFEnableAdobeReaderInfoBarDelegate::OnYes() { |
| UserMetrics::RecordAction(UserMetricsAction("PDF_EnableReaderInfoBarOK")); |
| - webkit::npapi::PluginList::Singleton()->EnableGroup(false, |
| - ASCIIToUTF16(chrome::ChromeContentClient::kPDFPluginName)); |
| Profile* profile = |
| Profile::FromBrowserContext(tab_contents_->browser_context()); |
| PluginPrefs* plugin_prefs = PluginPrefs::GetForProfile(profile); |
| plugin_prefs->EnablePluginGroup( |
|
jam
2011/09/13 01:47:31
wouldn't these two calls assert since they're not
Bernhard Bauer
2011/09/13 12:13:01
Indeed! Thanks for catching that. I changed Plugin
jam
2011/09/13 15:58:13
cool. i was just going to comment that it would be
|
| true, ASCIIToUTF16(webkit::npapi::PluginGroup::kAdobeReaderGroupName)); |
| - plugin_prefs->UpdatePreferences(0); |
| + plugin_prefs->EnablePluginGroup( |
| + false, ASCIIToUTF16(chrome::ChromeContentClient::kPDFPluginName)); |
| } |
| void PDFEnableAdobeReaderInfoBarDelegate::OnNo() { |
| @@ -142,11 +141,9 @@ void OpenUsingReader(TabContentsWrapper* tab, |
| InfoBarDelegate* old_delegate, |
| InfoBarDelegate* new_delegate) { |
| WebPluginInfo plugin = reader_plugin; |
| - // The plugin is disabled, so enable it to get around the renderer check. |
| - // Also give it a new version so that the renderer doesn't show the blocked |
| + // Give the plugin a new version so that the renderer doesn't show the blocked |
| // plugin UI if it's vulnerable, since we already went through the |
| // interstitial. |
| - plugin.enabled = WebPluginInfo::USER_ENABLED; |
| plugin.version = ASCIIToUTF16("11.0.0.0"); |
| ChromePluginServiceFilter::GetInstance()->OverridePluginForTab( |
| @@ -284,11 +281,12 @@ PDFUnsupportedFeatureInfoBarDelegate::PDFUnsupportedFeatureInfoBarDelegate( |
| } |
| UserMetrics::RecordAction(UserMetricsAction("PDF_UseReaderInfoBarShown")); |
| - std::vector<WebPluginInfo> plugins = reader_group->web_plugin_infos(); |
| + const std::vector<WebPluginInfo>& plugins = |
| + reader_group->web_plugin_infos(); |
| DCHECK_EQ(plugins.size(), 1u); |
| reader_webplugininfo_ = plugins[0]; |
| - reader_vulnerable_ = reader_group->IsVulnerable(); |
| + reader_vulnerable_ = reader_group->IsVulnerable(reader_webplugininfo_); |
| if (!reader_vulnerable_) { |
| scoped_ptr<Version> version(PluginGroup::CreateVersionFromString( |
| reader_webplugininfo_.version)); |
| @@ -382,8 +380,11 @@ void PDFHasUnsupportedFeature(TabContentsWrapper* tab) { |
| string16 reader_group_name(ASCIIToUTF16(PluginGroup::kAdobeReaderGroupName)); |
| // If the Reader plugin is disabled by policy, don't prompt them. |
| - if (PluginGroup::IsPluginNameDisabledByPolicy(reader_group_name)) |
| + PluginPrefs* plugin_prefs = PluginPrefs::GetForProfile(tab->profile()); |
| + if (plugin_prefs->PolicyStatusForPlugin(reader_group_name) == |
| + PluginPrefs::POLICY_DISABLED) { |
| return; |
| + } |
| PluginGroup* reader_group = NULL; |
| std::vector<PluginGroup> plugin_groups; |