| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/download/chrome_download_manager_delegate.h" | 5 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 DownloadItemModel(item).SetIsDangerousFileBasedOnType(true); | 704 DownloadItemModel(item).SetIsDangerousFileBasedOnType(true); |
| 705 } | 705 } |
| 706 callback.Run(target_info->target_path, | 706 callback.Run(target_info->target_path, |
| 707 target_info->target_disposition, | 707 target_info->target_disposition, |
| 708 target_info->danger_type, | 708 target_info->danger_type, |
| 709 target_info->intermediate_path); | 709 target_info->intermediate_path); |
| 710 } | 710 } |
| 711 | 711 |
| 712 bool ChromeDownloadManagerDelegate::IsOpenInBrowserPreferreredForFile( | 712 bool ChromeDownloadManagerDelegate::IsOpenInBrowserPreferreredForFile( |
| 713 const base::FilePath& path) { | 713 const base::FilePath& path) { |
| 714 // On Windows, PDFs should open in Acrobat Reader if the user chooses. | 714 #if defined(OS_WIN) || defined(OS_LINUX) || \ |
| 715 #if defined(OS_WIN) | 715 (defined(OS_MACOSX) && !defined(OS_IOS)) |
| 716 if (path.MatchesExtension(FILE_PATH_LITERAL(".pdf")) && | 716 if (path.MatchesExtension(FILE_PATH_LITERAL(".pdf"))) { |
| 717 DownloadTargetDeterminer::IsAdobeReaderUpToDate()) { | 717 return !download_prefs_->ShouldOpenPdfInSystemReader(); |
| 718 return !download_prefs_->ShouldOpenPdfInAdobeReader(); | |
| 719 } | 718 } |
| 720 #endif | 719 #endif |
| 721 | 720 |
| 722 // On Android, always prefer opening with an external app. On ChromeOS, there | 721 // On Android, always prefer opening with an external app. On ChromeOS, there |
| 723 // are no external apps so just allow all opens to be handled by the "System." | 722 // are no external apps so just allow all opens to be handled by the "System." |
| 724 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) && defined(ENABLE_PLUGINS) | 723 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) && defined(ENABLE_PLUGINS) |
| 725 // TODO(asanka): Consider other file types and MIME types. | 724 // TODO(asanka): Consider other file types and MIME types. |
| 726 // http://crbug.com/323561 | 725 // http://crbug.com/323561 |
| 727 if (path.MatchesExtension(FILE_PATH_LITERAL(".pdf")) || | 726 if (path.MatchesExtension(FILE_PATH_LITERAL(".pdf")) || |
| 728 path.MatchesExtension(FILE_PATH_LITERAL(".htm")) || | 727 path.MatchesExtension(FILE_PATH_LITERAL(".htm")) || |
| 729 path.MatchesExtension(FILE_PATH_LITERAL(".html")) || | 728 path.MatchesExtension(FILE_PATH_LITERAL(".html")) || |
| 730 path.MatchesExtension(FILE_PATH_LITERAL(".shtm")) || | 729 path.MatchesExtension(FILE_PATH_LITERAL(".shtm")) || |
| 731 path.MatchesExtension(FILE_PATH_LITERAL(".shtml")) || | 730 path.MatchesExtension(FILE_PATH_LITERAL(".shtml")) || |
| 732 path.MatchesExtension(FILE_PATH_LITERAL(".svg")) || | 731 path.MatchesExtension(FILE_PATH_LITERAL(".svg")) || |
| 733 path.MatchesExtension(FILE_PATH_LITERAL(".xht")) || | 732 path.MatchesExtension(FILE_PATH_LITERAL(".xht")) || |
| 734 path.MatchesExtension(FILE_PATH_LITERAL(".xhtm")) || | 733 path.MatchesExtension(FILE_PATH_LITERAL(".xhtm")) || |
| 735 path.MatchesExtension(FILE_PATH_LITERAL(".xhtml")) || | 734 path.MatchesExtension(FILE_PATH_LITERAL(".xhtml")) || |
| 736 path.MatchesExtension(FILE_PATH_LITERAL(".xsl")) || | 735 path.MatchesExtension(FILE_PATH_LITERAL(".xsl")) || |
| 737 path.MatchesExtension(FILE_PATH_LITERAL(".xslt"))) { | 736 path.MatchesExtension(FILE_PATH_LITERAL(".xslt"))) { |
| 738 return true; | 737 return true; |
| 739 } | 738 } |
| 740 #endif | 739 #endif |
| 741 return false; | 740 return false; |
| 742 } | 741 } |
| OLD | NEW |