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 17 matching lines...) Expand all Loading... |
28 static void RegisterUserPrefs(PrefRegistrySyncable* registry); | 28 static void RegisterUserPrefs(PrefRegistrySyncable* registry); |
29 | 29 |
30 // Returns the DownloadPrefs corresponding to the given DownloadManager | 30 // Returns the DownloadPrefs corresponding to the given DownloadManager |
31 // or BrowserContext. | 31 // or BrowserContext. |
32 static DownloadPrefs* FromDownloadManager( | 32 static DownloadPrefs* FromDownloadManager( |
33 content::DownloadManager* download_manager); | 33 content::DownloadManager* download_manager); |
34 static DownloadPrefs* FromBrowserContext( | 34 static DownloadPrefs* FromBrowserContext( |
35 content::BrowserContext* browser_context); | 35 content::BrowserContext* browser_context); |
36 | 36 |
37 base::FilePath DownloadPath() const; | 37 base::FilePath DownloadPath() const; |
| 38 base::FilePath SaveFilePath() const; |
| 39 void SetSaveFilePath(const base::FilePath& path); |
38 int save_file_type() const { return *save_file_type_; } | 40 int save_file_type() const { return *save_file_type_; } |
| 41 void SetSaveFileType(int type); |
39 | 42 |
40 // Returns true if the prompt_for_download preference has been set and the | 43 // Returns true if the prompt_for_download preference has been set and the |
41 // download location is not managed (which means the user shouldn't be able | 44 // download location is not managed (which means the user shouldn't be able |
42 // to choose another download location). | 45 // to choose another download location). |
43 bool PromptForDownload() const; | 46 bool PromptForDownload() const; |
44 | 47 |
45 // Returns true if the download path preference is managed. | 48 // Returns true if the download path preference is managed. |
46 bool IsDownloadPathManaged() const; | 49 bool IsDownloadPathManaged() const; |
47 | 50 |
48 // Returns true if there is at least one file extension registered | 51 // Returns true if there is at least one file extension registered |
(...skipping 12 matching lines...) Expand all Loading... |
61 | 64 |
62 void ResetAutoOpen(); | 65 void ResetAutoOpen(); |
63 | 66 |
64 private: | 67 private: |
65 void SaveAutoOpenState(); | 68 void SaveAutoOpenState(); |
66 | 69 |
67 Profile* profile_; | 70 Profile* profile_; |
68 | 71 |
69 BooleanPrefMember prompt_for_download_; | 72 BooleanPrefMember prompt_for_download_; |
70 FilePathPrefMember download_path_; | 73 FilePathPrefMember download_path_; |
| 74 FilePathPrefMember save_file_path_; |
71 IntegerPrefMember save_file_type_; | 75 IntegerPrefMember save_file_type_; |
72 | 76 |
73 // Set of file extensions to open at download completion. | 77 // Set of file extensions to open at download completion. |
74 struct AutoOpenCompareFunctor { | 78 struct AutoOpenCompareFunctor { |
75 bool operator()(const base::FilePath::StringType& a, | 79 bool operator()(const base::FilePath::StringType& a, |
76 const base::FilePath::StringType& b) const; | 80 const base::FilePath::StringType& b) const; |
77 }; | 81 }; |
78 typedef std::set<base::FilePath::StringType, | 82 typedef std::set<base::FilePath::StringType, |
79 AutoOpenCompareFunctor> AutoOpenSet; | 83 AutoOpenCompareFunctor> AutoOpenSet; |
80 AutoOpenSet auto_open_; | 84 AutoOpenSet auto_open_; |
81 | 85 |
82 DISALLOW_COPY_AND_ASSIGN(DownloadPrefs); | 86 DISALLOW_COPY_AND_ASSIGN(DownloadPrefs); |
83 }; | 87 }; |
84 | 88 |
85 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_PREFS_H_ | 89 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_PREFS_H_ |
OLD | NEW |