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" |
11 #include "base/gtest_prod_util.h" | |
12 #include "base/macros.h" | 11 #include "base/macros.h" |
13 #include "build/build_config.h" | 12 #include "build/build_config.h" |
14 #include "components/prefs/pref_member.h" | 13 #include "components/prefs/pref_member.h" |
15 | 14 |
16 class Profile; | 15 class Profile; |
17 | 16 |
18 namespace content { | 17 namespace content { |
19 class BrowserContext; | 18 class BrowserContext; |
20 class DownloadManager; | 19 class DownloadManager; |
21 } | 20 } |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 void DisableAutoOpenBasedOnExtension(const base::FilePath& file_name); | 79 void DisableAutoOpenBasedOnExtension(const base::FilePath& file_name); |
81 | 80 |
82 #if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_MACOSX) | 81 #if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_MACOSX) |
83 // Store the user preference to disk. If |should_open| is true, also disable | 82 // Store the user preference to disk. If |should_open| is true, also disable |
84 // the built-in PDF plugin. If |should_open| is false, enable the PDF plugin. | 83 // the built-in PDF plugin. If |should_open| is false, enable the PDF plugin. |
85 void SetShouldOpenPdfInSystemReader(bool should_open); | 84 void SetShouldOpenPdfInSystemReader(bool should_open); |
86 | 85 |
87 // Return whether the user prefers to open PDF downloads in the platform's | 86 // Return whether the user prefers to open PDF downloads in the platform's |
88 // default reader. | 87 // default reader. |
89 bool ShouldOpenPdfInSystemReader() const; | 88 bool ShouldOpenPdfInSystemReader() const; |
90 | |
91 // Used by tests to disable version checks for Adobe. | |
92 void DisableAdobeVersionCheckForTests(); | |
93 #endif | 89 #endif |
94 | 90 |
95 | |
96 void ResetAutoOpen(); | 91 void ResetAutoOpen(); |
97 | 92 |
98 private: | 93 private: |
99 void SaveAutoOpenState(); | 94 void SaveAutoOpenState(); |
100 | 95 |
101 Profile* profile_; | 96 Profile* profile_; |
102 | 97 |
103 BooleanPrefMember prompt_for_download_; | 98 BooleanPrefMember prompt_for_download_; |
104 FilePathPrefMember download_path_; | 99 FilePathPrefMember download_path_; |
105 FilePathPrefMember save_file_path_; | 100 FilePathPrefMember save_file_path_; |
106 IntegerPrefMember save_file_type_; | 101 IntegerPrefMember save_file_type_; |
107 | 102 |
108 // Set of file extensions to open at download completion. | 103 // Set of file extensions to open at download completion. |
109 struct AutoOpenCompareFunctor { | 104 struct AutoOpenCompareFunctor { |
110 bool operator()(const base::FilePath::StringType& a, | 105 bool operator()(const base::FilePath::StringType& a, |
111 const base::FilePath::StringType& b) const; | 106 const base::FilePath::StringType& b) const; |
112 }; | 107 }; |
113 typedef std::set<base::FilePath::StringType, | 108 typedef std::set<base::FilePath::StringType, |
114 AutoOpenCompareFunctor> AutoOpenSet; | 109 AutoOpenCompareFunctor> AutoOpenSet; |
115 AutoOpenSet auto_open_; | 110 AutoOpenSet auto_open_; |
116 | 111 |
117 #if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_MACOSX) | 112 #if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_MACOSX) |
118 bool should_open_pdf_in_system_reader_; | 113 bool should_open_pdf_in_system_reader_; |
119 bool disable_adobe_version_check_for_tests_; | |
120 #endif | 114 #endif |
121 | 115 |
122 DISALLOW_COPY_AND_ASSIGN(DownloadPrefs); | 116 DISALLOW_COPY_AND_ASSIGN(DownloadPrefs); |
123 }; | 117 }; |
124 | 118 |
125 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_PREFS_H_ | 119 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_PREFS_H_ |
OLD | NEW |