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/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 #include "components/pref_registry/pref_registry_syncable.h" | 47 #include "components/pref_registry/pref_registry_syncable.h" |
48 #include "components/prefs/pref_member.h" | 48 #include "components/prefs/pref_member.h" |
49 #include "components/prefs/pref_service.h" | 49 #include "components/prefs/pref_service.h" |
50 #include "content/public/browser/download_item.h" | 50 #include "content/public/browser/download_item.h" |
51 #include "content/public/browser/download_manager.h" | 51 #include "content/public/browser/download_manager.h" |
52 #include "content/public/browser/notification_source.h" | 52 #include "content/public/browser/notification_source.h" |
53 #include "content/public/browser/page_navigator.h" | 53 #include "content/public/browser/page_navigator.h" |
54 #include "extensions/features/features.h" | 54 #include "extensions/features/features.h" |
55 #include "net/base/filename_util.h" | 55 #include "net/base/filename_util.h" |
56 #include "net/base/mime_util.h" | 56 #include "net/base/mime_util.h" |
| 57 #include "ppapi/features/features.h" |
57 #include "ui/base/l10n/l10n_util.h" | 58 #include "ui/base/l10n/l10n_util.h" |
58 | 59 |
59 #if BUILDFLAG(ANDROID_JAVA_UI) | 60 #if BUILDFLAG(ANDROID_JAVA_UI) |
60 #include "chrome/browser/android/download/chrome_duplicate_download_infobar_dele
gate.h" | 61 #include "chrome/browser/android/download/chrome_duplicate_download_infobar_dele
gate.h" |
61 #include "chrome/browser/infobars/infobar_service.h" | 62 #include "chrome/browser/infobars/infobar_service.h" |
62 #endif | 63 #endif |
63 | 64 |
64 #if defined(OS_CHROMEOS) | 65 #if defined(OS_CHROMEOS) |
65 #include "chrome/browser/chromeos/drive/download_handler.h" | 66 #include "chrome/browser/chromeos/drive/download_handler.h" |
66 #include "chrome/browser/chromeos/drive/file_system_util.h" | 67 #include "chrome/browser/chromeos/drive/file_system_util.h" |
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 bool ChromeDownloadManagerDelegate::IsOpenInBrowserPreferreredForFile( | 794 bool ChromeDownloadManagerDelegate::IsOpenInBrowserPreferreredForFile( |
794 const base::FilePath& path) { | 795 const base::FilePath& path) { |
795 #if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_MACOSX) | 796 #if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_MACOSX) |
796 if (path.MatchesExtension(FILE_PATH_LITERAL(".pdf"))) { | 797 if (path.MatchesExtension(FILE_PATH_LITERAL(".pdf"))) { |
797 return !download_prefs_->ShouldOpenPdfInSystemReader(); | 798 return !download_prefs_->ShouldOpenPdfInSystemReader(); |
798 } | 799 } |
799 #endif | 800 #endif |
800 | 801 |
801 // On Android, always prefer opening with an external app. On ChromeOS, there | 802 // On Android, always prefer opening with an external app. On ChromeOS, there |
802 // are no external apps so just allow all opens to be handled by the "System." | 803 // are no external apps so just allow all opens to be handled by the "System." |
803 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) && defined(ENABLE_PLUGINS) | 804 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) && BUILDFLAG(ENABLE_PLUGINS) |
804 // TODO(asanka): Consider other file types and MIME types. | 805 // TODO(asanka): Consider other file types and MIME types. |
805 // http://crbug.com/323561 | 806 // http://crbug.com/323561 |
806 if (path.MatchesExtension(FILE_PATH_LITERAL(".pdf")) || | 807 if (path.MatchesExtension(FILE_PATH_LITERAL(".pdf")) || |
807 path.MatchesExtension(FILE_PATH_LITERAL(".htm")) || | 808 path.MatchesExtension(FILE_PATH_LITERAL(".htm")) || |
808 path.MatchesExtension(FILE_PATH_LITERAL(".html")) || | 809 path.MatchesExtension(FILE_PATH_LITERAL(".html")) || |
809 path.MatchesExtension(FILE_PATH_LITERAL(".shtm")) || | 810 path.MatchesExtension(FILE_PATH_LITERAL(".shtm")) || |
810 path.MatchesExtension(FILE_PATH_LITERAL(".shtml")) || | 811 path.MatchesExtension(FILE_PATH_LITERAL(".shtml")) || |
811 path.MatchesExtension(FILE_PATH_LITERAL(".svg")) || | 812 path.MatchesExtension(FILE_PATH_LITERAL(".svg")) || |
812 path.MatchesExtension(FILE_PATH_LITERAL(".xht")) || | 813 path.MatchesExtension(FILE_PATH_LITERAL(".xht")) || |
813 path.MatchesExtension(FILE_PATH_LITERAL(".xhtm")) || | 814 path.MatchesExtension(FILE_PATH_LITERAL(".xhtm")) || |
814 path.MatchesExtension(FILE_PATH_LITERAL(".xhtml")) || | 815 path.MatchesExtension(FILE_PATH_LITERAL(".xhtml")) || |
815 path.MatchesExtension(FILE_PATH_LITERAL(".xsl")) || | 816 path.MatchesExtension(FILE_PATH_LITERAL(".xsl")) || |
816 path.MatchesExtension(FILE_PATH_LITERAL(".xslt"))) { | 817 path.MatchesExtension(FILE_PATH_LITERAL(".xslt"))) { |
817 return true; | 818 return true; |
818 } | 819 } |
819 #endif | 820 #endif |
820 return false; | 821 return false; |
821 } | 822 } |
OLD | NEW |