summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-09 22:13:24 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-09 22:13:24 +0000
commit81ee43276c8ad381c139ddf58f2b7e978a09ec1c (patch)
tree16d5c1374ebb79d9fc031507b5c05e5371038143
parent1fc104d078b910dba6fb1eff1ed6572dac1f5642 (diff)
downloadchromium_src-81ee43276c8ad381c139ddf58f2b7e978a09ec1c.zip
chromium_src-81ee43276c8ad381c139ddf58f2b7e978a09ec1c.tar.gz
chromium_src-81ee43276c8ad381c139ddf58f2b7e978a09ec1c.tar.bz2
Really don't show the set Adobe Reader by default infobar. Also don't show it again if the user clicks No.
Review URL: http://codereview.chromium.org/6476001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74346 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/dom_ui/plugins_ui.cc1
-rw-r--r--chrome/browser/pdf_unsupported_feature.cc43
-rw-r--r--chrome/common/pref_names.cc3
-rw-r--r--chrome/common/pref_names.h1
4 files changed, 36 insertions, 12 deletions
diff --git a/chrome/browser/dom_ui/plugins_ui.cc b/chrome/browser/dom_ui/plugins_ui.cc
index b67397b..022a06a 100644
--- a/chrome/browser/dom_ui/plugins_ui.cc
+++ b/chrome/browser/dom_ui/plugins_ui.cc
@@ -370,4 +370,5 @@ void PluginsUI::RegisterUserPrefs(PrefService* prefs) {
prefs->RegisterListPref(prefs::kPluginsPluginsList);
prefs->RegisterBooleanPref(prefs::kPluginsEnabledInternalPDF, false);
prefs->RegisterBooleanPref(prefs::kPluginsShowDetails, false);
+ prefs->RegisterBooleanPref(prefs::kPluginsShowSetReaderDefaultInfobar, true);
}
diff --git a/chrome/browser/pdf_unsupported_feature.cc b/chrome/browser/pdf_unsupported_feature.cc
index 5056da2..bd598af 100644
--- a/chrome/browser/pdf_unsupported_feature.cc
+++ b/chrome/browser/pdf_unsupported_feature.cc
@@ -9,6 +9,8 @@
#include "base/version.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/plugin_service.h"
+#include "chrome/browser/prefs/pref_service.h"
+#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/tab_contents/infobar_delegate.h"
@@ -16,6 +18,7 @@
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/jstemplate_builder.h"
#include "chrome/common/pepper_plugin_registry.h"
+#include "chrome/common/pref_names.h"
#include "grit/browser_resources.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
@@ -41,7 +44,8 @@ class PDFEnableAdobeReaderConfirmInfoBarDelegate
public:
PDFEnableAdobeReaderConfirmInfoBarDelegate(
TabContents* tab_contents)
- : ConfirmInfoBarDelegate(tab_contents) {
+ : ConfirmInfoBarDelegate(tab_contents),
+ tab_contents_(tab_contents) {
UserMetrics::RecordAction(
UserMetricsAction("PDF_EnableReaderInfoBarShown"));
}
@@ -60,6 +64,8 @@ class PDFEnableAdobeReaderConfirmInfoBarDelegate
}
virtual bool Accept() {
+ tab_contents_->profile()->GetPrefs()->SetBoolean(
+ prefs::kPluginsShowSetReaderDefaultInfobar, false);
return OnNo();
}
@@ -108,6 +114,8 @@ class PDFEnableAdobeReaderConfirmInfoBarDelegate
return true;
}
+ TabContents* tab_contents_;
+
DISALLOW_IMPLICIT_CONSTRUCTORS(PDFEnableAdobeReaderConfirmInfoBarDelegate);
};
@@ -120,7 +128,8 @@ void OpenReaderUpdateURL(TabContents* tab) {
// Opens the PDF using Adobe Reader.
void OpenUsingReader(TabContents* tab,
const WebPluginInfo& reader_plugin,
- InfoBarDelegate* old_delegate) {
+ InfoBarDelegate* old_delegate,
+ InfoBarDelegate* new_delegate) {
PluginService::OverriddenPlugin plugin;
plugin.render_process_id = tab->GetRenderProcessHost()->id();
plugin.render_view_id = tab->render_view_host()->routing_id();
@@ -136,11 +145,12 @@ void OpenUsingReader(TabContents* tab,
PluginService::GetInstance()->OverridePluginForTab(plugin);
tab->render_view_host()->ReloadFrame();
- InfoBarDelegate* bar = new PDFEnableAdobeReaderConfirmInfoBarDelegate(tab);
- if (old_delegate) {
- tab->ReplaceInfoBar(old_delegate, bar);
- } else {
- tab->AddInfoBar(bar);
+ if (new_delegate) {
+ if (old_delegate) {
+ tab->ReplaceInfoBar(old_delegate, new_delegate);
+ } else {
+ tab->AddInfoBar(new_delegate);
+ }
}
}
@@ -201,7 +211,7 @@ class PDFUnsupportedFeatureInterstitial : public InterstitialPage {
} else if (command == "2") {
UserMetrics::RecordAction(
UserMetricsAction("PDF_ReaderInterstitialIgnore"));
- OpenUsingReader(tab(), reader_webplugininfo_, NULL);
+ OpenUsingReader(tab(), reader_webplugininfo_, NULL, NULL);
} else {
NOTREACHED();
}
@@ -314,13 +324,22 @@ class PDFUnsupportedFeatureConfirmInfoBarDelegate
return true;
}
+ InfoBarDelegate* bar = NULL;
// Don't show the enable Reader by default info bar for now.
/*
- OpenUsingReader(tab_contents_, reader_webplugininfo_, this);
- return false;
+ if (tab_contents_->profile()->GetPrefs()->GetBoolean(
+ prefs::kPluginsShowSetReaderDefaultInfobar)) {
+ bar = new PDFEnableAdobeReaderConfirmInfoBarDelegate(tab_contents_);
+ }
*/
- OpenUsingReader(tab_contents_, reader_webplugininfo_, NULL);
- return true;
+
+ if (bar) {
+ OpenUsingReader(tab_contents_, reader_webplugininfo_, this, bar);
+ return false;
+ } else {
+ OpenUsingReader(tab_contents_, reader_webplugininfo_, NULL, NULL);
+ return true;
+ }
}
bool OnNo() {
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc
index d14c9f8..f0e1277 100644
--- a/chrome/common/pref_names.cc
+++ b/chrome/common/pref_names.cc
@@ -568,6 +568,9 @@ const char kPluginsPluginsBlacklist[] = "plugins.plugins_blacklist";
// enable it by default, we'll want to do so only once.
const char kPluginsEnabledInternalPDF[] = "plugins.enabled_internal_pdf3";
+const char kPluginsShowSetReaderDefaultInfobar[] =
+ "plugins.show_set_reader_default";
+
// Whether about:plugins is shown in the details mode or not.
const char kPluginsShowDetails[] = "plugins.show_details";
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h
index 9e37786..a8fe14e 100644
--- a/chrome/common/pref_names.h
+++ b/chrome/common/pref_names.h
@@ -206,6 +206,7 @@ extern const char kPluginsLastInternalDirectory[];
extern const char kPluginsPluginsList[];
extern const char kPluginsPluginsBlacklist[];
extern const char kPluginsEnabledInternalPDF[];
+extern const char kPluginsShowSetReaderDefaultInfobar[];
extern const char kPluginsShowDetails[];
extern const char kCheckDefaultBrowser[];
extern const char kDefaultBrowserSettingEnabled[];