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_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ |
| 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 147 | 147 |
| 148 // Main entry points for regular downloads, in order ------------------------- | 148 // Main entry points for regular downloads, in order ------------------------- |
| 149 | 149 |
| 150 // TODO(rdsmith): Fold the process that uses these fully into | 150 // TODO(rdsmith): Fold the process that uses these fully into |
| 151 // DownloadItemImpl and pass callbacks to the delegate so that all of | 151 // DownloadItemImpl and pass callbacks to the delegate so that all of |
| 152 // these other than Start() can be made private. | 152 // these other than Start() can be made private. |
| 153 | 153 |
| 154 // Start the download | 154 // Start the download |
| 155 virtual void Start(scoped_ptr<DownloadFile> download_file); | 155 virtual void Start(scoped_ptr<DownloadFile> download_file); |
| 156 | 156 |
| 157 // If all pre-requisites have been met, complete download processing, i.e. do | |
| 158 // internal cleanup, file rename, and potentially auto-open. (Dangerous | |
| 159 // downloads still may block on user acceptance after this point.) | |
| 160 virtual void MaybeCompleteDownload(); | |
| 161 | |
| 162 // Needed because of interwining with DownloadManagerImpl -------------------- | 157 // Needed because of interwining with DownloadManagerImpl -------------------- |
| 163 | 158 |
| 164 // TODO(rdsmith): Unwind DownloadManagerImpl and DownloadItemImpl, | 159 // TODO(rdsmith): Unwind DownloadManagerImpl and DownloadItemImpl, |
| 165 // removing these from the public interface. | 160 // removing these from the public interface. |
| 166 | 161 |
| 167 // Notify observers that this item is being removed by the user. | 162 // Notify observers that this item is being removed by the user. |
| 168 virtual void NotifyRemoved(); | 163 virtual void NotifyRemoved(); |
| 169 | 164 |
| 170 virtual void OnDownloadedFileRemoved(); | 165 virtual void OnDownloadedFileRemoved(); |
| 171 | 166 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 253 TargetDisposition disposition, | 248 TargetDisposition disposition, |
| 254 DownloadDangerType danger_type, | 249 DownloadDangerType danger_type, |
| 255 const FilePath& intermediate_path); | 250 const FilePath& intermediate_path); |
| 256 | 251 |
| 257 // Callback from file thread when we initialize the DownloadFile. | 252 // Callback from file thread when we initialize the DownloadFile. |
| 258 void OnDownloadFileInitialized(DownloadInterruptReason result); | 253 void OnDownloadFileInitialized(DownloadInterruptReason result); |
| 259 | 254 |
| 260 void OnDownloadRenamedToIntermediateName( | 255 void OnDownloadRenamedToIntermediateName( |
| 261 DownloadInterruptReason reason, const FilePath& full_path); | 256 DownloadInterruptReason reason, const FilePath& full_path); |
| 262 | 257 |
| 258 // If all pre-requisites have been met, complete download processing, i.e. do | |
| 259 // internal cleanup, file rename, and potentially auto-open. (Dangerous | |
| 260 // downloads still may block on user acceptance after this point.) | |
| 261 virtual void MaybeCompleteDownload(); | |
|
asanka
2012/11/28 16:24:41
Does this need to be virtual anymore?
Randy Smith (Not in Mondays)
2012/11/28 20:28:26
Nope. Good catch. I nuked a couple of similar vi
| |
| 262 | |
| 263 // Called when the download is ready to complete. | 263 // Called when the download is ready to complete. |
| 264 // This may perform final rename if necessary and will eventually call | 264 // This may perform final rename if necessary and will eventually call |
| 265 // DownloadItem::Completed(). | 265 // DownloadItem::Completed(). |
| 266 virtual void OnDownloadCompleting(); | 266 virtual void OnDownloadCompleting(); |
| 267 | 267 |
| 268 // Called after the delegate has given the go-ahead to actually complete | 268 // Called after the delegate has given the go-ahead to actually complete |
| 269 // the download. | 269 // the download. |
| 270 void ReadyForDownloadCompletionDone(); | 270 void ReadyForDownloadCompletionDone(); |
| 271 | 271 |
| 272 void OnDownloadRenamedToFinalName(DownloadInterruptReason reason, | 272 void OnDownloadRenamedToFinalName(DownloadInterruptReason reason, |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 468 const net::BoundNetLog bound_net_log_; | 468 const net::BoundNetLog bound_net_log_; |
| 469 | 469 |
| 470 base::WeakPtrFactory<DownloadItemImpl> weak_ptr_factory_; | 470 base::WeakPtrFactory<DownloadItemImpl> weak_ptr_factory_; |
| 471 | 471 |
| 472 DISALLOW_COPY_AND_ASSIGN(DownloadItemImpl); | 472 DISALLOW_COPY_AND_ASSIGN(DownloadItemImpl); |
| 473 }; | 473 }; |
| 474 | 474 |
| 475 } // namespace content | 475 } // namespace content |
| 476 | 476 |
| 477 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ | 477 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ |
| OLD | NEW |