Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(515)

Side by Side Diff: chrome/browser/download/download_prefs.h

Issue 10815024: Revert 147594 - NaCl: Remove two uses of '#include "nacl/nacl_log.h"' (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 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/file_path.h" 10 #include "base/file_path.h"
11 #include "chrome/browser/prefs/pref_member.h" 11 #include "chrome/browser/prefs/pref_member.h"
12 12
13 class PrefService; 13 class Profile;
14 14
15 namespace content { 15 namespace content {
16 class BrowserContext; 16 class BrowserContext;
17 class DownloadManager; 17 class DownloadManager;
18 } 18 }
19 19
20 // Stores all download-related preferences. 20 // Stores all download-related preferences.
21 class DownloadPrefs { 21 class DownloadPrefs {
22 public: 22 public:
23 explicit DownloadPrefs(PrefService* prefs); 23 explicit DownloadPrefs(Profile* profile);
24 ~DownloadPrefs(); 24 ~DownloadPrefs();
25 25
26 static void RegisterUserPrefs(PrefService* prefs); 26 static void RegisterUserPrefs(PrefService* prefs);
27 27
28 // Returns the DownloadPrefs corresponding to the given DownloadManager 28 // Returns the DownloadPrefs corresponding to the given DownloadManager
29 // or BrowserContext. 29 // or BrowserContext.
30 static DownloadPrefs* FromDownloadManager( 30 static DownloadPrefs* FromDownloadManager(
31 content::DownloadManager* download_manager); 31 content::DownloadManager* download_manager);
32 static DownloadPrefs* FromBrowserContext( 32 static DownloadPrefs* FromBrowserContext(
33 content::BrowserContext* browser_context); 33 content::BrowserContext* browser_context);
34 34
35 FilePath download_path() const { return *download_path_; } 35 FilePath DownloadPath() const;
36 int save_file_type() const { return *save_file_type_; } 36 int save_file_type() const { return *save_file_type_; }
37 37
38 // 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
39 // 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
40 // to choose another download location). 40 // to choose another download location).
41 bool PromptForDownload() const; 41 bool PromptForDownload() const;
42 42
43 // Returns true if the download path preference is managed. 43 // Returns true if the download path preference is managed.
44 bool IsDownloadPathManaged() const; 44 bool IsDownloadPathManaged() const;
45 45
46 // Returns true if there is at least one file extension registered 46 // Returns true if there is at least one file extension registered
47 // for auto-open. 47 // for auto-open.
48 bool IsAutoOpenUsed() const; 48 bool IsAutoOpenUsed() const;
49 49
50 bool IsAutoOpenEnabledForExtension( 50 bool IsAutoOpenEnabledForExtension(
51 const FilePath::StringType& extension) const; 51 const FilePath::StringType& extension) const;
52 52
53 // Enables auto-open based on file extension. Returns true on success. 53 // Enables auto-open based on file extension. Returns true on success.
54 // TODO(phajdan.jr): Add WARN_UNUSED_RESULT here. 54 // TODO(phajdan.jr): Add WARN_UNUSED_RESULT here.
55 bool EnableAutoOpenBasedOnExtension(const FilePath& file_name); 55 bool EnableAutoOpenBasedOnExtension(const FilePath& file_name);
56 56
57 // Disables auto-open based on file extension. 57 // Disables auto-open based on file extension.
58 void DisableAutoOpenBasedOnExtension(const FilePath& file_name); 58 void DisableAutoOpenBasedOnExtension(const FilePath& file_name);
59 59
60 void ResetAutoOpen(); 60 void ResetAutoOpen();
61 61
62 private: 62 private:
63 void SaveAutoOpenState(); 63 void SaveAutoOpenState();
64 64
65 PrefService* prefs_; 65 Profile* profile_;
66 66
67 BooleanPrefMember prompt_for_download_; 67 BooleanPrefMember prompt_for_download_;
68 FilePathPrefMember download_path_; 68 FilePathPrefMember download_path_;
69 IntegerPrefMember save_file_type_; 69 IntegerPrefMember save_file_type_;
70 70
71 // Set of file extensions to open at download completion. 71 // Set of file extensions to open at download completion.
72 struct AutoOpenCompareFunctor { 72 struct AutoOpenCompareFunctor {
73 bool operator()(const FilePath::StringType& a, 73 bool operator()(const FilePath::StringType& a,
74 const FilePath::StringType& b) const; 74 const FilePath::StringType& b) const;
75 }; 75 };
76 typedef std::set<FilePath::StringType, AutoOpenCompareFunctor> AutoOpenSet; 76 typedef std::set<FilePath::StringType, AutoOpenCompareFunctor> AutoOpenSet;
77 AutoOpenSet auto_open_; 77 AutoOpenSet auto_open_;
78 78
79 DISALLOW_COPY_AND_ASSIGN(DownloadPrefs); 79 DISALLOW_COPY_AND_ASSIGN(DownloadPrefs);
80 }; 80 };
81 81
82 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_PREFS_H_ 82 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_PREFS_H_
OLDNEW
« no previous file with comments | « chrome/browser/download/download_browsertest.cc ('k') | chrome/browser/download/download_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698