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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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) |
77 // Store the user preference to disk. If |should_open| is true, also disable | 77 // 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. | 78 // the built-in PDF plugin. If |should_open| is false, enable the PDF plugin. |
79 void SetShouldOpenPdfInAdobeReader(bool should_open); | 79 void SetShouldOpenPdfInAdobeReader(bool should_open); |
80 | 80 |
81 // Return whether the user prefers to open PDF downloads in Adobe Reader. | 81 // Return whether the user prefers to open PDF downloads in Adobe Reader. |
82 bool ShouldOpenPdfInAdobeReader() const; | 82 bool ShouldOpenPdfInAdobeReader() const; |
| 83 #elif defined(OS_MACOSX) || defined(OS_LINUX) |
| 84 // Store the user preference to disk. If |should_open| is true, also disable |
| 85 // the built-in PDF plugin. If |should_open| is false, enable the PDF plugin. |
| 86 void SetShouldOpenPdfInSystemReader(bool should_open); |
| 87 |
| 88 // Return whether the user prefers to open PDF downloads in the platform's |
| 89 // default reader. |
| 90 bool ShouldOpenPdfInSystemReader() const; |
83 #endif | 91 #endif |
84 | 92 |
85 void ResetAutoOpen(); | 93 void ResetAutoOpen(); |
86 | 94 |
87 private: | 95 private: |
88 void SaveAutoOpenState(); | 96 void SaveAutoOpenState(); |
89 | 97 |
90 Profile* profile_; | 98 Profile* profile_; |
91 | 99 |
92 BooleanPrefMember prompt_for_download_; | 100 BooleanPrefMember prompt_for_download_; |
93 FilePathPrefMember download_path_; | 101 FilePathPrefMember download_path_; |
94 FilePathPrefMember save_file_path_; | 102 FilePathPrefMember save_file_path_; |
95 IntegerPrefMember save_file_type_; | 103 IntegerPrefMember save_file_type_; |
96 | 104 |
97 // Set of file extensions to open at download completion. | 105 // Set of file extensions to open at download completion. |
98 struct AutoOpenCompareFunctor { | 106 struct AutoOpenCompareFunctor { |
99 bool operator()(const base::FilePath::StringType& a, | 107 bool operator()(const base::FilePath::StringType& a, |
100 const base::FilePath::StringType& b) const; | 108 const base::FilePath::StringType& b) const; |
101 }; | 109 }; |
102 typedef std::set<base::FilePath::StringType, | 110 typedef std::set<base::FilePath::StringType, |
103 AutoOpenCompareFunctor> AutoOpenSet; | 111 AutoOpenCompareFunctor> AutoOpenSet; |
104 AutoOpenSet auto_open_; | 112 AutoOpenSet auto_open_; |
105 | 113 |
106 #if defined(OS_WIN) | 114 #if defined(OS_WIN) |
107 bool should_open_pdf_in_adobe_reader_; | 115 bool should_open_pdf_in_adobe_reader_; |
| 116 #elif defined(OS_MACOSX) || defined(OS_LINUX) |
| 117 bool should_open_pdf_in_system_reader_; |
108 #endif | 118 #endif |
109 | 119 |
110 DISALLOW_COPY_AND_ASSIGN(DownloadPrefs); | 120 DISALLOW_COPY_AND_ASSIGN(DownloadPrefs); |
111 }; | 121 }; |
112 | 122 |
113 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_PREFS_H_ | 123 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_PREFS_H_ |
OLD | NEW |