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 | 28 |
30 // Inhibits prompting and sets the default download path. | 29 // Inhibits prompting and sets the default download path. |
31 void SetDownloadBehaviorForTesting( | 30 void SetDownloadBehaviorForTesting( |
32 const FilePath& default_download_path); | 31 const FilePath& default_download_path); |
33 | 32 |
34 private: | 33 private: |
35 friend class base::RefCountedThreadSafe<ShellDownloadManagerDelegate>; | 34 friend class base::RefCountedThreadSafe<ShellDownloadManagerDelegate>; |
36 | 35 |
37 virtual ~ShellDownloadManagerDelegate(); | 36 virtual ~ShellDownloadManagerDelegate(); |
38 | 37 |
39 void GenerateFilename(int32 download_id, | 38 void GenerateFilename(int32 download_id, |
40 const DownloadTargetCallback& callback, | 39 const DownloadTargetCallback& callback, |
41 const FilePath& generated_name, | 40 const FilePath& generated_name, |
42 const FilePath& suggested_directory); | 41 const FilePath& suggested_directory); |
43 void OnDownloadPathGenerated(int32 download_id, | 42 void OnDownloadPathGenerated(int32 download_id, |
44 const DownloadTargetCallback& callback, | 43 const DownloadTargetCallback& callback, |
45 const FilePath& suggested_path); | 44 const FilePath& suggested_path); |
46 void ChooseDownloadPath(int32 download_id, | 45 void ChooseDownloadPath(int32 download_id, |
47 const DownloadTargetCallback& callback, | 46 const DownloadTargetCallback& callback, |
48 const FilePath& suggested_path); | 47 const FilePath& suggested_path); |
49 | 48 |
50 DownloadManager* download_manager_; | 49 DownloadManager* download_manager_; |
51 FilePath default_download_path_; | 50 FilePath default_download_path_; |
52 bool suppress_prompting_; | 51 bool suppress_prompting_; |
53 int64 last_download_db_handle_; | |
54 | 52 |
55 DISALLOW_COPY_AND_ASSIGN(ShellDownloadManagerDelegate); | 53 DISALLOW_COPY_AND_ASSIGN(ShellDownloadManagerDelegate); |
56 }; | 54 }; |
57 | 55 |
58 } // namespace content | 56 } // namespace content |
59 | 57 |
60 #endif // CONTENT_SHELL_SHELL_DOWNLOAD_MANAGER_DELEGATE_H_ | 58 #endif // CONTENT_SHELL_SHELL_DOWNLOAD_MANAGER_DELEGATE_H_ |
OLD | NEW |