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

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

Issue 12662032: Merge SavePackageFilePicker{,ChromeOS} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: @r198452 Created 7 years, 7 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) 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_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_ 5 #ifndef CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_
6 #define CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_ 6 #define CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/hash_tables.h" 9 #include "base/hash_tables.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 // This is the Chrome side helper for the download system. 47 // This is the Chrome side helper for the download system.
48 class ChromeDownloadManagerDelegate 48 class ChromeDownloadManagerDelegate
49 : public base::RefCountedThreadSafe<ChromeDownloadManagerDelegate>, 49 : public base::RefCountedThreadSafe<ChromeDownloadManagerDelegate>,
50 public content::DownloadManagerDelegate, 50 public content::DownloadManagerDelegate,
51 public content::NotificationObserver, 51 public content::NotificationObserver,
52 public DownloadTargetDeterminerDelegate { 52 public DownloadTargetDeterminerDelegate {
53 public: 53 public:
54 explicit ChromeDownloadManagerDelegate(Profile* profile); 54 explicit ChromeDownloadManagerDelegate(Profile* profile);
55 55
56 static void RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry);
57
58 // Should be called before the first call to ShouldCompleteDownload() to 56 // Should be called before the first call to ShouldCompleteDownload() to
59 // disable SafeBrowsing checks for |item|. 57 // disable SafeBrowsing checks for |item|.
60 static void DisableSafeBrowsing(content::DownloadItem* item); 58 static void DisableSafeBrowsing(content::DownloadItem* item);
61 59
62 void SetDownloadManager(content::DownloadManager* dm); 60 void SetDownloadManager(content::DownloadManager* dm);
63 61
64 // content::DownloadManagerDelegate 62 // content::DownloadManagerDelegate
65 virtual void Shutdown() OVERRIDE; 63 virtual void Shutdown() OVERRIDE;
66 virtual content::DownloadId GetNextId() OVERRIDE; 64 virtual content::DownloadId GetNextId() OVERRIDE;
67 virtual bool DetermineDownloadTarget( 65 virtual bool DetermineDownloadTarget(
(...skipping 17 matching lines...) Expand all
85 const base::FilePath& suggested_path, 83 const base::FilePath& suggested_path,
86 const base::FilePath::StringType& default_extension, 84 const base::FilePath::StringType& default_extension,
87 bool can_save_as_complete, 85 bool can_save_as_complete,
88 const content::SavePackagePathPickedCallback& callback) OVERRIDE; 86 const content::SavePackagePathPickedCallback& callback) OVERRIDE;
89 virtual void OpenDownload(content::DownloadItem* download) OVERRIDE; 87 virtual void OpenDownload(content::DownloadItem* download) OVERRIDE;
90 virtual void ShowDownloadInShell(content::DownloadItem* download) OVERRIDE; 88 virtual void ShowDownloadInShell(content::DownloadItem* download) OVERRIDE;
91 virtual void CheckForFileExistence( 89 virtual void CheckForFileExistence(
92 content::DownloadItem* download, 90 content::DownloadItem* download,
93 const content::CheckForFileExistenceCallback& callback) OVERRIDE; 91 const content::CheckForFileExistenceCallback& callback) OVERRIDE;
94 92
95 // Clears the last directory chosen by the user in response to a file chooser
96 // prompt. Called when clearing recent history.
97 void ClearLastDownloadPath();
98
99 DownloadPrefs* download_prefs() { return download_prefs_.get(); } 93 DownloadPrefs* download_prefs() { return download_prefs_.get(); }
100 94
101 protected: 95 protected:
102 // So that test classes can inherit from this for override purposes. 96 // So that test classes can inherit from this for override purposes.
103 virtual ~ChromeDownloadManagerDelegate(); 97 virtual ~ChromeDownloadManagerDelegate();
104 98
105 // So that test classes that inherit from this for override purposes 99 // So that test classes that inherit from this for override purposes
106 // can call back into the DownloadManager. 100 // can call back into the DownloadManager.
107 scoped_refptr<content::DownloadManager> download_manager_; 101 scoped_refptr<content::DownloadManager> download_manager_;
108 102
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 int next_download_id_; 157 int next_download_id_;
164 scoped_ptr<DownloadPrefs> download_prefs_; 158 scoped_ptr<DownloadPrefs> download_prefs_;
165 159
166 // Maps from pending extension installations to DownloadItem IDs. 160 // Maps from pending extension installations to DownloadItem IDs.
167 typedef base::hash_map<extensions::CrxInstaller*, 161 typedef base::hash_map<extensions::CrxInstaller*,
168 content::DownloadOpenDelayedCallback> CrxInstallerMap; 162 content::DownloadOpenDelayedCallback> CrxInstallerMap;
169 CrxInstallerMap crx_installers_; 163 CrxInstallerMap crx_installers_;
170 164
171 content::NotificationRegistrar registrar_; 165 content::NotificationRegistrar registrar_;
172 166
173 // The directory most recently chosen by the user in response to a Save As
174 // dialog for a regular download.
175 base::FilePath last_download_path_;
176
177 DISALLOW_COPY_AND_ASSIGN(ChromeDownloadManagerDelegate); 167 DISALLOW_COPY_AND_ASSIGN(ChromeDownloadManagerDelegate);
178 }; 168 };
179 169
180 #endif // CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_ 170 #endif // CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698