OLD | NEW |
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 CONTENT_SHELL_SHELL_DOWNLOAD_MANAGER_DELEGATE_H_ | 5 #ifndef CONTENT_SHELL_SHELL_DOWNLOAD_MANAGER_DELEGATE_H_ |
6 #define CONTENT_SHELL_SHELL_DOWNLOAD_MANAGER_DELEGATE_H_ | 6 #define CONTENT_SHELL_SHELL_DOWNLOAD_MANAGER_DELEGATE_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "content/public/browser/download_manager_delegate.h" | 10 #include "content/public/browser/download_manager_delegate.h" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 | 13 |
14 class DownloadManager; | 14 class DownloadManager; |
15 | 15 |
16 class ShellDownloadManagerDelegate | 16 class ShellDownloadManagerDelegate |
17 : public DownloadManagerDelegate, | 17 : public DownloadManagerDelegate, |
18 public base::RefCountedThreadSafe<ShellDownloadManagerDelegate> { | 18 public base::RefCountedThreadSafe<ShellDownloadManagerDelegate> { |
19 public: | 19 public: |
20 ShellDownloadManagerDelegate(); | 20 ShellDownloadManagerDelegate(); |
21 | 21 |
22 void SetDownloadManager(DownloadManager* manager); | 22 void SetDownloadManager(DownloadManager* manager); |
23 | 23 |
24 virtual void Shutdown() OVERRIDE; | 24 virtual void Shutdown() OVERRIDE; |
25 virtual bool DetermineDownloadTarget( | 25 virtual bool DetermineDownloadTarget( |
26 DownloadItem* download, | 26 DownloadItem* download, |
27 const DownloadTargetCallback& callback) OVERRIDE; | 27 const DownloadTargetCallback& callback) OVERRIDE; |
| 28 virtual void AddItemToPersistentStore(DownloadItem* item) OVERRIDE; |
| 29 |
| 30 // Inhibits prompting and sets the default download path. |
| 31 void SetDownloadBehaviorForTesting( |
| 32 const FilePath& default_download_path); |
28 | 33 |
29 private: | 34 private: |
30 friend class base::RefCountedThreadSafe<ShellDownloadManagerDelegate>; | 35 friend class base::RefCountedThreadSafe<ShellDownloadManagerDelegate>; |
31 | 36 |
32 virtual ~ShellDownloadManagerDelegate(); | 37 virtual ~ShellDownloadManagerDelegate(); |
33 | 38 |
34 void GenerateFilename(int32 download_id, | 39 void GenerateFilename(int32 download_id, |
35 const DownloadTargetCallback& callback, | 40 const DownloadTargetCallback& callback, |
36 const FilePath& generated_name); | 41 const FilePath& generated_name, |
| 42 const FilePath& suggested_directory); |
| 43 void OnDownloadPathGenerated(int32 download_id, |
| 44 const DownloadTargetCallback& callback, |
| 45 const FilePath& suggested_path); |
37 void ChooseDownloadPath(int32 download_id, | 46 void ChooseDownloadPath(int32 download_id, |
38 const DownloadTargetCallback& callback, | 47 const DownloadTargetCallback& callback, |
39 const FilePath& suggested_path); | 48 const FilePath& suggested_path); |
40 | 49 |
41 DownloadManager* download_manager_; | 50 DownloadManager* download_manager_; |
| 51 FilePath default_download_path_; |
| 52 bool suppress_prompting_; |
| 53 int64 last_download_db_handle_; |
42 | 54 |
43 DISALLOW_COPY_AND_ASSIGN(ShellDownloadManagerDelegate); | 55 DISALLOW_COPY_AND_ASSIGN(ShellDownloadManagerDelegate); |
44 }; | 56 }; |
45 | 57 |
46 } // namespace content | 58 } // namespace content |
47 | 59 |
48 #endif // CONTENT_SHELL_SHELL_DOWNLOAD_MANAGER_DELEGATE_H_ | 60 #endif // CONTENT_SHELL_SHELL_DOWNLOAD_MANAGER_DELEGATE_H_ |
OLD | NEW |