| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_DELEGATE_H_ | |
| 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_DELEGATE_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "base/basictypes.h" | |
| 10 #include "base/memory/weak_ptr.h" | |
| 11 | |
| 12 class FilePath; | |
| 13 class TabContents; | |
| 14 class SavePackage; | |
| 15 | |
| 16 // Browser's download manager: manages all downloads and destination view. | |
| 17 class DownloadManagerDelegate { | |
| 18 public: | |
| 19 // Notifies the delegate that a download is starting. The delegate can return | |
| 20 // false to delay the start of the download, in which case it should call | |
| 21 // DownloadManager::RestartDownload when it's ready. | |
| 22 virtual bool ShouldStartDownload(int32 download_id) = 0; | |
| 23 | |
| 24 // Asks the user for the path for a download. The delegate calls | |
| 25 // DownloadManager::FileSelected or DownloadManager::FileSelectionCanceled to | |
| 26 // give the answer. | |
| 27 virtual void ChooseDownloadPath(TabContents* tab_contents, | |
| 28 const FilePath& suggested_path, | |
| 29 void* data) = 0; | |
| 30 | |
| 31 // Called when the download system wants to alert a TabContents that a | |
| 32 // download has started, but the TabConetnts has gone away. This lets an | |
| 33 // embedder return an alternative TabContents. The embedder can return NULL. | |
| 34 virtual TabContents* GetAlternativeTabContentsToNotifyForDownload() = 0; | |
| 35 | |
| 36 // Tests if a file type should be opened automatically. | |
| 37 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path) = 0; | |
| 38 | |
| 39 // Retrieve the directories to save html pages and downloads to. | |
| 40 virtual void GetSaveDir(TabContents* tab_contents, | |
| 41 FilePath* website_save_dir, | |
| 42 FilePath* download_save_dir) = 0; | |
| 43 | |
| 44 // Asks the user for the path to save a page. The delegate calls | |
| 45 // SavePackage::OnPathPicked to give the answer. | |
| 46 virtual void ChooseSavePath(const base::WeakPtr<SavePackage>& save_package, | |
| 47 const FilePath& suggested_path, | |
| 48 bool can_save_as_complete) = 0; | |
| 49 | |
| 50 protected: | |
| 51 DownloadManagerDelegate() {} | |
| 52 virtual ~DownloadManagerDelegate() {} | |
| 53 | |
| 54 DISALLOW_COPY_AND_ASSIGN(DownloadManagerDelegate); | |
| 55 }; | |
| 56 | |
| 57 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_DELEGATE_H_ | |
| OLD | NEW |