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