Chromium Code Reviews| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 | 62 |
| 63 // Called when the download system wants to alert a WebContents that a | 63 // Called when the download system wants to alert a WebContents that a |
| 64 // download has started, but the TabConetnts has gone away. This lets an | 64 // download has started, but the TabConetnts has gone away. This lets an |
| 65 // delegate return an alternative WebContents. The delegate can return NULL. | 65 // delegate return an alternative WebContents. The delegate can return NULL. |
| 66 virtual WebContents* GetAlternativeWebContentsToNotifyForDownload(); | 66 virtual WebContents* GetAlternativeWebContentsToNotifyForDownload(); |
| 67 | 67 |
| 68 // Tests if a file type should be opened automatically. | 68 // Tests if a file type should be opened automatically. |
| 69 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path); | 69 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path); |
| 70 | 70 |
| 71 // Allows the delegate to override completion of the download. If this | 71 // Allows the delegate to override completion of the download. If this |
| 72 // function returns false, the download completion is delayed and the | 72 // function returns false, the download completion is delayed and the delegate |
| 73 // delegate is responsible for making sure that | 73 // is responsible for making sure that |complete_callback| is run at some |
| 74 // DownloadItem::MaybeCompleteDownload is called at some point in the | 74 // point in the future. Note that at that point this function will be called |
| 75 // future. Note that at that point this function will be called again, | 75 // again, and is responsible for returning true when it really is ok for the |
| 76 // and is responsible for returning true when it really is ok for the | 76 // download to complete. If this method returns true, then |complete_callback| |
| 77 // download to complete. | 77 // will not be run. It is safe to call this method any number of times both |
| 78 virtual bool ShouldCompleteDownload(DownloadItem* item); | 78 // before and after |complete_callback| runs; this method will return false |
| 79 // until the download should complete, then it will run the last | |
| 80 // |complete_callback| passed to it and begin returning true when called. | |
| 81 // The last complete_callback will be run when the return value of this | |
| 82 // function may have changed to true, but that complete_callback being run | |
| 83 // doesn't actually indicate that the download is ready for completion; the | |
| 84 // function needs to be called again to check. If the | |
|
Randy Smith (Not in Mondays)
2012/05/09 00:50:56
Minor point: This is false to how this interface i
benjhayden
2012/05/14 15:35:05
LGTM Thanks!
| |
| 85 // method returns true, complete_callback will not be run. | |
| 86 virtual bool ShouldCompleteDownload( | |
| 87 DownloadItem* item, | |
| 88 const base::Closure& complete_callback); | |
| 79 | 89 |
| 80 // Allows the delegate to override opening the download. If this function | 90 // Allows the delegate to override opening the download. If this function |
| 81 // returns false, the delegate needs to call | 91 // returns false, the delegate needs to call |
| 82 // DownloadItem::DelayedDownloadOpened when it's done with the item, | 92 // DownloadItem::DelayedDownloadOpened when it's done with the item, |
| 83 // and is responsible for opening it. This function is called | 93 // and is responsible for opening it. This function is called |
| 84 // after the final rename, but before the download state is set to COMPLETED. | 94 // after the final rename, but before the download state is set to COMPLETED. |
| 85 virtual bool ShouldOpenDownload(DownloadItem* item); | 95 virtual bool ShouldOpenDownload(DownloadItem* item); |
| 86 | 96 |
| 87 // Returns true if we need to generate a binary hash for downloads. | 97 // Returns true if we need to generate a binary hash for downloads. |
| 88 virtual bool GenerateFileHash(); | 98 virtual bool GenerateFileHash(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 125 const FilePath& suggested_path, | 135 const FilePath& suggested_path, |
| 126 const FilePath::StringType& default_extension, | 136 const FilePath::StringType& default_extension, |
| 127 bool can_save_as_complete, | 137 bool can_save_as_complete, |
| 128 const SavePackagePathPickedCallback& callback) { | 138 const SavePackagePathPickedCallback& callback) { |
| 129 } | 139 } |
| 130 }; | 140 }; |
| 131 | 141 |
| 132 } // namespace content | 142 } // namespace content |
| 133 | 143 |
| 134 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ | 144 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ |
| OLD | NEW |