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