| 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 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 DownloadItemModel(item).SetIsDangerousFileBasedOnType(true); | 712 DownloadItemModel(item).SetIsDangerousFileBasedOnType(true); |
| 713 } | 713 } |
| 714 callback.Run(target_info->target_path, | 714 callback.Run(target_info->target_path, |
| 715 target_info->target_disposition, | 715 target_info->target_disposition, |
| 716 target_info->danger_type, | 716 target_info->danger_type, |
| 717 target_info->intermediate_path); | 717 target_info->intermediate_path); |
| 718 } | 718 } |
| 719 | 719 |
| 720 bool ChromeDownloadManagerDelegate::IsOpenInBrowserPreferreredForFile( | 720 bool ChromeDownloadManagerDelegate::IsOpenInBrowserPreferreredForFile( |
| 721 const base::FilePath& path) { | 721 const base::FilePath& path) { |
| 722 // On Windows, PDFs should open in Acrobat Reader if the user chooses. | 722 #if defined(OS_WIN) || defined(OS_LINUX) || \ |
| 723 #if defined(OS_WIN) | 723 (defined(OS_MACOSX) && !defined(OS_IOS)) |
| 724 if (path.MatchesExtension(FILE_PATH_LITERAL(".pdf")) && | 724 if (path.MatchesExtension(FILE_PATH_LITERAL(".pdf"))) { |
| 725 DownloadTargetDeterminer::IsAdobeReaderUpToDate()) { | 725 return !download_prefs_->ShouldOpenPdfInSystemReader(); |
| 726 return !download_prefs_->ShouldOpenPdfInAdobeReader(); | |
| 727 } | 726 } |
| 728 #endif | 727 #endif |
| 729 | 728 |
| 730 // On Android, always prefer opening with an external app. On ChromeOS, there | 729 // On Android, always prefer opening with an external app. On ChromeOS, there |
| 731 // are no external apps so just allow all opens to be handled by the "System." | 730 // are no external apps so just allow all opens to be handled by the "System." |
| 732 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) && defined(ENABLE_PLUGINS) | 731 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) && defined(ENABLE_PLUGINS) |
| 733 // TODO(asanka): Consider other file types and MIME types. | 732 // TODO(asanka): Consider other file types and MIME types. |
| 734 // http://crbug.com/323561 | 733 // http://crbug.com/323561 |
| 735 if (path.MatchesExtension(FILE_PATH_LITERAL(".pdf")) || | 734 if (path.MatchesExtension(FILE_PATH_LITERAL(".pdf")) || |
| 736 path.MatchesExtension(FILE_PATH_LITERAL(".htm")) || | 735 path.MatchesExtension(FILE_PATH_LITERAL(".htm")) || |
| 737 path.MatchesExtension(FILE_PATH_LITERAL(".html")) || | 736 path.MatchesExtension(FILE_PATH_LITERAL(".html")) || |
| 738 path.MatchesExtension(FILE_PATH_LITERAL(".shtm")) || | 737 path.MatchesExtension(FILE_PATH_LITERAL(".shtm")) || |
| 739 path.MatchesExtension(FILE_PATH_LITERAL(".shtml")) || | 738 path.MatchesExtension(FILE_PATH_LITERAL(".shtml")) || |
| 740 path.MatchesExtension(FILE_PATH_LITERAL(".svg")) || | 739 path.MatchesExtension(FILE_PATH_LITERAL(".svg")) || |
| 741 path.MatchesExtension(FILE_PATH_LITERAL(".xht")) || | 740 path.MatchesExtension(FILE_PATH_LITERAL(".xht")) || |
| 742 path.MatchesExtension(FILE_PATH_LITERAL(".xhtm")) || | 741 path.MatchesExtension(FILE_PATH_LITERAL(".xhtm")) || |
| 743 path.MatchesExtension(FILE_PATH_LITERAL(".xhtml")) || | 742 path.MatchesExtension(FILE_PATH_LITERAL(".xhtml")) || |
| 744 path.MatchesExtension(FILE_PATH_LITERAL(".xsl")) || | 743 path.MatchesExtension(FILE_PATH_LITERAL(".xsl")) || |
| 745 path.MatchesExtension(FILE_PATH_LITERAL(".xslt"))) { | 744 path.MatchesExtension(FILE_PATH_LITERAL(".xslt"))) { |
| 746 return true; | 745 return true; |
| 747 } | 746 } |
| 748 #endif | 747 #endif |
| 749 return false; | 748 return false; |
| 750 } | 749 } |
| OLD | NEW |