| 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 protected: | 33 protected: |
| 35 // To allow subclasses for testing. | 34 // To allow subclasses for testing. |
| 36 virtual ~ShellDownloadManagerDelegate(); | 35 virtual ~ShellDownloadManagerDelegate(); |
| 37 | 36 |
| 38 private: | 37 private: |
| 39 friend class base::RefCountedThreadSafe<ShellDownloadManagerDelegate>; | 38 friend class base::RefCountedThreadSafe<ShellDownloadManagerDelegate>; |
| 40 | 39 |
| 41 | 40 |
| 42 void GenerateFilename(int32 download_id, | 41 void GenerateFilename(int32 download_id, |
| 43 const DownloadTargetCallback& callback, | 42 const DownloadTargetCallback& callback, |
| 44 const FilePath& generated_name, | 43 const FilePath& generated_name, |
| 45 const FilePath& suggested_directory); | 44 const FilePath& suggested_directory); |
| 46 void OnDownloadPathGenerated(int32 download_id, | 45 void OnDownloadPathGenerated(int32 download_id, |
| 47 const DownloadTargetCallback& callback, | 46 const DownloadTargetCallback& callback, |
| 48 const FilePath& suggested_path); | 47 const FilePath& suggested_path); |
| 49 void ChooseDownloadPath(int32 download_id, | 48 void ChooseDownloadPath(int32 download_id, |
| 50 const DownloadTargetCallback& callback, | 49 const DownloadTargetCallback& callback, |
| 51 const FilePath& suggested_path); | 50 const FilePath& suggested_path); |
| 52 | 51 |
| 53 DownloadManager* download_manager_; | 52 DownloadManager* download_manager_; |
| 54 FilePath default_download_path_; | 53 FilePath default_download_path_; |
| 55 bool suppress_prompting_; | 54 bool suppress_prompting_; |
| 56 int64 last_download_db_handle_; | |
| 57 | 55 |
| 58 DISALLOW_COPY_AND_ASSIGN(ShellDownloadManagerDelegate); | 56 DISALLOW_COPY_AND_ASSIGN(ShellDownloadManagerDelegate); |
| 59 }; | 57 }; |
| 60 | 58 |
| 61 } // namespace content | 59 } // namespace content |
| 62 | 60 |
| 63 #endif // CONTENT_SHELL_SHELL_DOWNLOAD_MANAGER_DELEGATE_H_ | 61 #endif // CONTENT_SHELL_SHELL_DOWNLOAD_MANAGER_DELEGATE_H_ |
| OLD | NEW |