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 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_PREFS_H_ | 5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_PREFS_H_ |
6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_PREFS_H_ | 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_PREFS_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 // |path.Extension()|. | 66 // |path.Extension()|. |
67 bool IsAutoOpenEnabledBasedOnExtension(const base::FilePath& path) const; | 67 bool IsAutoOpenEnabledBasedOnExtension(const base::FilePath& path) const; |
68 | 68 |
69 // Enables auto-open based on file extension. Returns true on success. | 69 // Enables auto-open based on file extension. Returns true on success. |
70 // TODO(phajdan.jr): Add WARN_UNUSED_RESULT here. | 70 // TODO(phajdan.jr): Add WARN_UNUSED_RESULT here. |
71 bool EnableAutoOpenBasedOnExtension(const base::FilePath& file_name); | 71 bool EnableAutoOpenBasedOnExtension(const base::FilePath& file_name); |
72 | 72 |
73 // Disables auto-open based on file extension. | 73 // Disables auto-open based on file extension. |
74 void DisableAutoOpenBasedOnExtension(const base::FilePath& file_name); | 74 void DisableAutoOpenBasedOnExtension(const base::FilePath& file_name); |
75 | 75 |
76 #if defined(OS_WIN) | 76 #if defined(OS_WIN) || defined(OS_LINUX) || \ |
| 77 (defined(OS_MACOSX) && !defined(OS_IOS)) |
77 // Store the user preference to disk. If |should_open| is true, also disable | 78 // Store the user preference to disk. If |should_open| is true, also disable |
78 // the built-in PDF plugin. If |should_open| is false, enable the PDF plugin. | 79 // the built-in PDF plugin. If |should_open| is false, enable the PDF plugin. |
79 void SetShouldOpenPdfInAdobeReader(bool should_open); | 80 void SetShouldOpenPdfInSystemReader(bool should_open); |
80 | 81 |
81 // Return whether the user prefers to open PDF downloads in Adobe Reader. | 82 // Return whether the user prefers to open PDF downloads in the platform's |
82 bool ShouldOpenPdfInAdobeReader() const; | 83 // default reader. |
| 84 bool ShouldOpenPdfInSystemReader() const; |
83 #endif | 85 #endif |
84 | 86 |
85 void ResetAutoOpen(); | 87 void ResetAutoOpen(); |
86 | 88 |
87 private: | 89 private: |
88 void SaveAutoOpenState(); | 90 void SaveAutoOpenState(); |
89 | 91 |
90 Profile* profile_; | 92 Profile* profile_; |
91 | 93 |
92 BooleanPrefMember prompt_for_download_; | 94 BooleanPrefMember prompt_for_download_; |
93 FilePathPrefMember download_path_; | 95 FilePathPrefMember download_path_; |
94 FilePathPrefMember save_file_path_; | 96 FilePathPrefMember save_file_path_; |
95 IntegerPrefMember save_file_type_; | 97 IntegerPrefMember save_file_type_; |
96 | 98 |
97 // Set of file extensions to open at download completion. | 99 // Set of file extensions to open at download completion. |
98 struct AutoOpenCompareFunctor { | 100 struct AutoOpenCompareFunctor { |
99 bool operator()(const base::FilePath::StringType& a, | 101 bool operator()(const base::FilePath::StringType& a, |
100 const base::FilePath::StringType& b) const; | 102 const base::FilePath::StringType& b) const; |
101 }; | 103 }; |
102 typedef std::set<base::FilePath::StringType, | 104 typedef std::set<base::FilePath::StringType, |
103 AutoOpenCompareFunctor> AutoOpenSet; | 105 AutoOpenCompareFunctor> AutoOpenSet; |
104 AutoOpenSet auto_open_; | 106 AutoOpenSet auto_open_; |
105 | 107 |
106 #if defined(OS_WIN) | 108 #if defined(OS_WIN) || defined(OS_LINUX) || \ |
107 bool should_open_pdf_in_adobe_reader_; | 109 (defined(OS_MACOSX) && !defined(OS_IOS)) |
| 110 bool should_open_pdf_in_system_reader_; |
108 #endif | 111 #endif |
109 | 112 |
110 DISALLOW_COPY_AND_ASSIGN(DownloadPrefs); | 113 DISALLOW_COPY_AND_ASSIGN(DownloadPrefs); |
111 }; | 114 }; |
112 | 115 |
113 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_PREFS_H_ | 116 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_PREFS_H_ |
OLD | NEW |