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

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

Issue 324593004: Windows: Add an "Open in Adobe Reader" menu item for PDF files in the download shelf. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: leave content/ alone Created 6 years, 6 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/download/chrome_download_manager_delegate.cc
diff --git a/chrome/browser/download/chrome_download_manager_delegate.cc b/chrome/browser/download/chrome_download_manager_delegate.cc
index 2a8d6c6f1e2343e7d46b7e9f8e78873e3a16b15e..5ef85131cc71f62df495bcfe6108944ac135be07 100644
--- a/chrome/browser/download/chrome_download_manager_delegate.cc
+++ b/chrome/browser/download/chrome_download_manager_delegate.cc
@@ -184,29 +184,6 @@ std::string GetMimeType(const base::FilePath& path) {
return mime_type;
}
-bool IsOpenInBrowserPreferreredForFile(const base::FilePath& path) {
- // On Android, always prefer opening with an external app. On ChromeOS, there
- // are no external apps so just allow all opens to be handled by the "System."
-#if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) && defined(ENABLE_PLUGINS)
- // TODO(asanka): Consider other file types and MIME types.
- // http://crbug.com/323561
- if (path.MatchesExtension(FILE_PATH_LITERAL(".pdf")) ||
- path.MatchesExtension(FILE_PATH_LITERAL(".htm")) ||
- path.MatchesExtension(FILE_PATH_LITERAL(".html")) ||
- path.MatchesExtension(FILE_PATH_LITERAL(".shtm")) ||
- path.MatchesExtension(FILE_PATH_LITERAL(".shtml")) ||
- path.MatchesExtension(FILE_PATH_LITERAL(".svg")) ||
- path.MatchesExtension(FILE_PATH_LITERAL(".xht")) ||
- path.MatchesExtension(FILE_PATH_LITERAL(".xhtm")) ||
- path.MatchesExtension(FILE_PATH_LITERAL(".xhtml")) ||
- path.MatchesExtension(FILE_PATH_LITERAL(".xsl")) ||
- path.MatchesExtension(FILE_PATH_LITERAL(".xslt"))) {
- return true;
- }
-#endif
- return false;
-}
-
} // namespace
ChromeDownloadManagerDelegate::ChromeDownloadManagerDelegate(Profile* profile)
@@ -722,3 +699,36 @@ void ChromeDownloadManagerDelegate::OnDownloadTargetDetermined(
target_info->danger_type,
target_info->intermediate_path);
}
+
+bool ChromeDownloadManagerDelegate::IsOpenInBrowserPreferreredForFile(
+ const base::FilePath& path) {
+ // On Windows, PDFs should open in Acrobat Reader if the user chooses.
+#if defined(OS_WIN)
+ if (path.MatchesExtension(FILE_PATH_LITERAL(".pdf")) &&
+ DownloadPrefs::IsAdobeReaderUpToDate()) {
+ DownloadPrefs* prefs = DownloadPrefs::FromBrowserContext(profile_);
asanka 2014/06/25 03:55:07 Now that this is a method of CDMD, you can just us
Lei Zhang 2014/06/26 08:06:12 Done.
+ return !prefs->ShouldOpenPdfInAdobeReader();
+ }
+#endif
+
+ // On Android, always prefer opening with an external app. On ChromeOS, there
+ // are no external apps so just allow all opens to be handled by the "System."
+#if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) && defined(ENABLE_PLUGINS)
+ // TODO(asanka): Consider other file types and MIME types.
+ // http://crbug.com/323561
+ if (path.MatchesExtension(FILE_PATH_LITERAL(".pdf")) ||
+ path.MatchesExtension(FILE_PATH_LITERAL(".htm")) ||
+ path.MatchesExtension(FILE_PATH_LITERAL(".html")) ||
+ path.MatchesExtension(FILE_PATH_LITERAL(".shtm")) ||
+ path.MatchesExtension(FILE_PATH_LITERAL(".shtml")) ||
+ path.MatchesExtension(FILE_PATH_LITERAL(".svg")) ||
+ path.MatchesExtension(FILE_PATH_LITERAL(".xht")) ||
+ path.MatchesExtension(FILE_PATH_LITERAL(".xhtm")) ||
+ path.MatchesExtension(FILE_PATH_LITERAL(".xhtml")) ||
+ path.MatchesExtension(FILE_PATH_LITERAL(".xsl")) ||
+ path.MatchesExtension(FILE_PATH_LITERAL(".xslt"))) {
+ return true;
+ }
+#endif
+ return false;
+}

Powered by Google App Engine
This is Rietveld 408576698