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

Unified Diff: chrome/browser/download/download_prefs.cc

Issue 2369353002: Adds a pref and a policy to decide if PDFs should always be opened externally. (Closed)
Patch Set: Remove changes leaked in from the dependent branch. Created 4 years, 2 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
« no previous file with comments | « chrome/browser/download/download_prefs.h ('k') | chrome/browser/download/download_prefs_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/download_prefs.cc
diff --git a/chrome/browser/download/download_prefs.cc b/chrome/browser/download/download_prefs.cc
index 05039fe5c5eb181f30070fdf77d3618f4df86067..1b85c84815062268c99020f1db0d395cd386a21e 100644
--- a/chrome/browser/download/download_prefs.cc
+++ b/chrome/browser/download/download_prefs.cc
@@ -138,7 +138,9 @@ DownloadPrefs::DownloadPrefs(Profile* profile) : profile_(profile) {
#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_MACOSX)
should_open_pdf_in_system_reader_ =
- prefs->GetBoolean(prefs::kOpenPdfDownloadInSystemReader);
+ prefs->GetBoolean(prefs::kOpenPdfDownloadInSystemReader) ||
+ prefs->GetBoolean(prefs::kPluginsAlwaysOpenPdfExternally);
+ disable_adobe_version_check_for_tests_ = false;
#endif
// If the download path is dangerous we forcefully reset it. But if we do
@@ -340,22 +342,26 @@ void DownloadPrefs::DisableAutoOpenBasedOnExtension(
#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_MACOSX)
void DownloadPrefs::SetShouldOpenPdfInSystemReader(bool should_open) {
- if (should_open_pdf_in_system_reader_ == should_open)
- return;
- should_open_pdf_in_system_reader_ = should_open;
+ should_open_pdf_in_system_reader_ = should_open ||
+ profile_->GetPrefs()->GetBoolean(prefs::kPluginsAlwaysOpenPdfExternally);
profile_->GetPrefs()->SetBoolean(prefs::kOpenPdfDownloadInSystemReader,
should_open);
}
bool DownloadPrefs::ShouldOpenPdfInSystemReader() const {
#if defined(OS_WIN)
- if (IsAdobeReaderDefaultPDFViewer() &&
+ if (!disable_adobe_version_check_for_tests_ &&
+ IsAdobeReaderDefaultPDFViewer() &&
!DownloadTargetDeterminer::IsAdobeReaderUpToDate()) {
return false;
}
#endif
return should_open_pdf_in_system_reader_;
}
+
+void DownloadPrefs::DisableAdobeVersionCheckForTests() {
+ disable_adobe_version_check_for_tests_ = true;
+}
#endif
void DownloadPrefs::ResetAutoOpen() {
« no previous file with comments | « chrome/browser/download/download_prefs.h ('k') | chrome/browser/download/download_prefs_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698