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