Chromium Code Reviews| 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; |
| +} |