| 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_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 // download has started, but the TabConetnts has gone away. This lets an | 53 // download has started, but the TabConetnts has gone away. This lets an |
| 54 // delegate return an alternative WebContents. The delegate can return NULL. | 54 // delegate return an alternative WebContents. The delegate can return NULL. |
| 55 virtual WebContents* GetAlternativeWebContentsToNotifyForDownload(); | 55 virtual WebContents* GetAlternativeWebContentsToNotifyForDownload(); |
| 56 | 56 |
| 57 // Tests if a file type should be opened automatically. | 57 // Tests if a file type should be opened automatically. |
| 58 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path); | 58 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path); |
| 59 | 59 |
| 60 // Allows the delegate to override completion of the download. If this | 60 // Allows the delegate to override completion of the download. If this |
| 61 // function returns false, the download completion is delayed and the | 61 // function returns false, the download completion is delayed and the |
| 62 // delegate is responsible for making sure that | 62 // delegate is responsible for making sure that |
| 63 // DownloadItem::MaybeCompleteDownload is called at some point in the | 63 // |maybe_complete_download| is run at some point in the |
| 64 // future. Note that at that point this function will be called again, | 64 // future. Note that at that point this function will be called again, |
| 65 // and is responsible for returning true when it really is ok for the | 65 // and is responsible for returning true when it really is ok for the |
| 66 // download to complete. | 66 // download to complete. If this method returns true, then |
| 67 virtual bool ShouldCompleteDownload(DownloadItem* item); | 67 // |maybe_complete_download| will not be run. |
| 68 virtual bool ShouldCompleteDownload( |
| 69 DownloadItem* item, |
| 70 const base::Closure& maybe_complete_download); |
| 68 | 71 |
| 69 // Allows the delegate to override opening the download. If this function | 72 // Allows the delegate to override opening the download. If this function |
| 70 // returns false, the delegate needs to call | 73 // returns false, the delegate needs to call |
| 71 // DownloadItem::DelayedDownloadOpened when it's done with the item, | 74 // DownloadItem::DelayedDownloadOpened when it's done with the item, |
| 72 // and is responsible for opening it. This function is called | 75 // and is responsible for opening it. This function is called |
| 73 // after the final rename, but before the download state is set to COMPLETED. | 76 // after the final rename, but before the download state is set to COMPLETED. |
| 74 virtual bool ShouldOpenDownload(DownloadItem* item); | 77 virtual bool ShouldOpenDownload(DownloadItem* item); |
| 75 | 78 |
| 76 // Returns true if we need to generate a binary hash for downloads. | 79 // Returns true if we need to generate a binary hash for downloads. |
| 77 virtual bool GenerateFileHash(); | 80 virtual bool GenerateFileHash(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 virtual void ChooseSavePath(WebContents* web_contents, | 118 virtual void ChooseSavePath(WebContents* web_contents, |
| 116 const FilePath& suggested_path, | 119 const FilePath& suggested_path, |
| 117 const FilePath::StringType& default_extension, | 120 const FilePath::StringType& default_extension, |
| 118 bool can_save_as_complete, | 121 bool can_save_as_complete, |
| 119 SaveFilePathPickedCallback callback) {} | 122 SaveFilePathPickedCallback callback) {} |
| 120 }; | 123 }; |
| 121 | 124 |
| 122 } // namespace content | 125 } // namespace content |
| 123 | 126 |
| 124 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ | 127 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ |
| OLD | NEW |