OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 | 10 |
11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
12 #include "chrome/browser/prefs/pref_member.h" | 12 #include "chrome/browser/prefs/pref_member.h" |
13 | 13 |
14 class DownloadManager; | 14 class DownloadManager; |
15 class PrefService; | 15 class PrefService; |
16 | 16 |
| 17 namespace content { |
| 18 class BrowserContext; |
| 19 } |
| 20 |
17 // Stores all download-related preferences. | 21 // Stores all download-related preferences. |
18 class DownloadPrefs { | 22 class DownloadPrefs { |
19 public: | 23 public: |
20 explicit DownloadPrefs(PrefService* prefs); | 24 explicit DownloadPrefs(PrefService* prefs); |
21 ~DownloadPrefs(); | 25 ~DownloadPrefs(); |
22 | 26 |
23 static void RegisterUserPrefs(PrefService* prefs); | 27 static void RegisterUserPrefs(PrefService* prefs); |
24 | 28 |
25 // Returns the DownloadPrefs corresponding to the given DownloadManager. | 29 // Returns the DownloadPrefs corresponding to the given DownloadManager |
| 30 // or BrowserContext. |
26 static DownloadPrefs* FromDownloadManager(DownloadManager* download_manager); | 31 static DownloadPrefs* FromDownloadManager(DownloadManager* download_manager); |
| 32 static DownloadPrefs* FromBrowserContext( |
| 33 content::BrowserContext* browser_context); |
27 | 34 |
28 FilePath download_path() const { return *download_path_; } | 35 FilePath download_path() const { return *download_path_; } |
29 int save_file_type() const { return *save_file_type_; } | 36 int save_file_type() const { return *save_file_type_; } |
30 | 37 |
31 // Returns true if the prompt_for_download preference has been set and the | 38 // Returns true if the prompt_for_download preference has been set and the |
32 // download location is not managed (which means the user shouldn't be able | 39 // download location is not managed (which means the user shouldn't be able |
33 // to choose another download location). | 40 // to choose another download location). |
34 bool PromptForDownload() const; | 41 bool PromptForDownload() const; |
35 | 42 |
36 // Returns true if the download path preference is managed. | 43 // Returns true if the download path preference is managed. |
(...skipping 29 matching lines...) Expand all Loading... |
66 bool operator()(const FilePath::StringType& a, | 73 bool operator()(const FilePath::StringType& a, |
67 const FilePath::StringType& b) const; | 74 const FilePath::StringType& b) const; |
68 }; | 75 }; |
69 typedef std::set<FilePath::StringType, AutoOpenCompareFunctor> AutoOpenSet; | 76 typedef std::set<FilePath::StringType, AutoOpenCompareFunctor> AutoOpenSet; |
70 AutoOpenSet auto_open_; | 77 AutoOpenSet auto_open_; |
71 | 78 |
72 DISALLOW_COPY_AND_ASSIGN(DownloadPrefs); | 79 DISALLOW_COPY_AND_ASSIGN(DownloadPrefs); |
73 }; | 80 }; |
74 | 81 |
75 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_PREFS_H_ | 82 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_PREFS_H_ |
OLD | NEW |