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

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

Issue 7192016: chrome.experimental.downloads (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: merged db_handle, id; onCreated, onErased Created 9 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
« no previous file with comments | « chrome/browser/download/download_manager.cc ('k') | chrome/browser/download/download_prefs.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 PrefService; 14 class PrefService;
15 15
16 // Stores all download-related preferences. 16 // Stores all download-related preferences.
17 class DownloadPrefs { 17 class DownloadPrefs {
18 public: 18 public:
19 explicit DownloadPrefs(PrefService* prefs); 19 explicit DownloadPrefs(PrefService* prefs);
20 ~DownloadPrefs(); 20 ~DownloadPrefs();
21 21
22 static void RegisterUserPrefs(PrefService* prefs); 22 static void RegisterUserPrefs(PrefService* prefs);
23 23
24 // Return the next download id and increment the counter.
25 int GetNextId();
26
24 FilePath download_path() const { return *download_path_; } 27 FilePath download_path() const { return *download_path_; }
25 int save_file_type() const { return *save_file_type_; } 28 int save_file_type() const { return *save_file_type_; }
26 29
27 // Returns true if the prompt_for_download preference has been set and the 30 // Returns true if the prompt_for_download preference has been set and the
28 // download location is not managed (which means the user shouldn't be able 31 // download location is not managed (which means the user shouldn't be able
29 // to choose another download location). 32 // to choose another download location).
30 bool PromptForDownload() const; 33 bool PromptForDownload() const;
31 34
32 // Returns true if the download path preference is managed. 35 // Returns true if the download path preference is managed.
33 bool IsDownloadPathManaged() const; 36 bool IsDownloadPathManaged() const;
(...skipping 12 matching lines...) Expand all
46 // Disables auto-open based on file extension. 49 // Disables auto-open based on file extension.
47 void DisableAutoOpenBasedOnExtension(const FilePath& file_name); 50 void DisableAutoOpenBasedOnExtension(const FilePath& file_name);
48 51
49 void ResetAutoOpen(); 52 void ResetAutoOpen();
50 53
51 private: 54 private:
52 void SaveAutoOpenState(); 55 void SaveAutoOpenState();
53 56
54 PrefService* prefs_; 57 PrefService* prefs_;
55 58
59 IntegerPrefMember next_download_id_;
56 BooleanPrefMember prompt_for_download_; 60 BooleanPrefMember prompt_for_download_;
57 FilePathPrefMember download_path_; 61 FilePathPrefMember download_path_;
58 IntegerPrefMember save_file_type_; 62 IntegerPrefMember save_file_type_;
59 63
60 // Set of file extensions to open at download completion. 64 // Set of file extensions to open at download completion.
61 struct AutoOpenCompareFunctor { 65 struct AutoOpenCompareFunctor {
62 bool operator()(const FilePath::StringType& a, 66 bool operator()(const FilePath::StringType& a,
63 const FilePath::StringType& b) const; 67 const FilePath::StringType& b) const;
64 }; 68 };
65 typedef std::set<FilePath::StringType, AutoOpenCompareFunctor> AutoOpenSet; 69 typedef std::set<FilePath::StringType, AutoOpenCompareFunctor> AutoOpenSet;
66 AutoOpenSet auto_open_; 70 AutoOpenSet auto_open_;
67 71
68 DISALLOW_COPY_AND_ASSIGN(DownloadPrefs); 72 DISALLOW_COPY_AND_ASSIGN(DownloadPrefs);
69 }; 73 };
70 74
71 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_PREFS_H_ 75 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_PREFS_H_
OLDNEW
« no previous file with comments | « chrome/browser/download/download_manager.cc ('k') | chrome/browser/download/download_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698