Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2911)

Unified Diff: chrome/browser/pdf_unsupported_feature.cc

Issue 7848025: Store plug-in enabled/disabled state in PluginPrefs instead of WebPluginInfo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: copyright Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..9fb0747c636df8a5e01e8f347c2d0daaa8e07e0b 100644
--- a/chrome/browser/pdf_unsupported_feature.cc
+++ b/chrome/browser/pdf_unsupported_feature.cc
@@ -7,9 +7,9 @@
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "base/version.h"
+#include "chrome/browser/chrome_plugin_service_filter.h"
#include "chrome/browser/infobars/infobar_tab_helper.h"
#include "chrome/browser/plugin_prefs.h"
-#include "chrome/browser/chrome_plugin_service_filter.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/tab_contents/chrome_interstitial_page.h"
@@ -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(
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;

Powered by Google App Engine
This is Rietveld 408576698