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) |
| 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. |
| 79 void SetShouldOpenPdfInAdobeReader(bool should_open); |
| 80 |
| 81 // Return whether the user prefers to open PDF downloads in Adobe Reader. |
| 82 bool ShouldOpenPdfInAdobeReader() const; |
| 83 #endif |
| 84 |
76 void ResetAutoOpen(); | 85 void ResetAutoOpen(); |
77 | 86 |
78 private: | 87 private: |
79 void SaveAutoOpenState(); | 88 void SaveAutoOpenState(); |
80 | 89 |
81 Profile* profile_; | 90 Profile* profile_; |
82 | 91 |
83 BooleanPrefMember prompt_for_download_; | 92 BooleanPrefMember prompt_for_download_; |
84 FilePathPrefMember download_path_; | 93 FilePathPrefMember download_path_; |
85 FilePathPrefMember save_file_path_; | 94 FilePathPrefMember save_file_path_; |
86 IntegerPrefMember save_file_type_; | 95 IntegerPrefMember save_file_type_; |
87 | 96 |
88 // Set of file extensions to open at download completion. | 97 // Set of file extensions to open at download completion. |
89 struct AutoOpenCompareFunctor { | 98 struct AutoOpenCompareFunctor { |
90 bool operator()(const base::FilePath::StringType& a, | 99 bool operator()(const base::FilePath::StringType& a, |
91 const base::FilePath::StringType& b) const; | 100 const base::FilePath::StringType& b) const; |
92 }; | 101 }; |
93 typedef std::set<base::FilePath::StringType, | 102 typedef std::set<base::FilePath::StringType, |
94 AutoOpenCompareFunctor> AutoOpenSet; | 103 AutoOpenCompareFunctor> AutoOpenSet; |
95 AutoOpenSet auto_open_; | 104 AutoOpenSet auto_open_; |
96 | 105 |
| 106 #if defined(OS_WIN) |
| 107 bool should_open_pdf_in_adobe_reader_; |
| 108 #endif |
| 109 |
97 DISALLOW_COPY_AND_ASSIGN(DownloadPrefs); | 110 DISALLOW_COPY_AND_ASSIGN(DownloadPrefs); |
98 }; | 111 }; |
99 | 112 |
100 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_PREFS_H_ | 113 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_PREFS_H_ |
OLD | NEW |