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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 209 private: | 209 private: |
| 210 // Fine grained states of a download. | 210 // Fine grained states of a download. |
| 211 enum DownloadInternalState { | 211 enum DownloadInternalState { |
| 212 // Unless otherwise specified, state transitions are linear forward | 212 // Unless otherwise specified, state transitions are linear forward |
| 213 // in this list. | 213 // in this list. |
| 214 | 214 |
| 215 // Includes both before and after file name determination. | 215 // Includes both before and after file name determination. |
| 216 // TODO(rdsmith): Put in state variable for file name determination. | 216 // TODO(rdsmith): Put in state variable for file name determination. |
| 217 IN_PROGRESS_INTERNAL, | 217 IN_PROGRESS_INTERNAL, |
| 218 | 218 |
| 219 // Between commit point (dispatch of download file release) and | 219 // Between commit point (dispatch of download file release) and |
|
Randy Smith (Not in Mondays)
2012/10/16 18:19:19
Could you add a note here about how the Download i
asanka
2012/10/25 23:51:27
Done.
| |
| 220 // completed. Embedder may be opening the file in this state. | 220 // completed. Embedder may be opening the file in this state. |
| 221 // Note that the DownloadItem may be deleted (by shutdown) in this | 221 // Note that the DownloadItem may be deleted (by shutdown) in this |
| 222 // state. | 222 // state. |
| 223 COMPLETING_INTERNAL, | 223 COMPLETING_INTERNAL, |
| 224 | 224 |
| 225 // After embedder has had a chance to auto-open. User may now open | 225 // After embedder has had a chance to auto-open. User may now open |
| 226 // or auto-open based on extension. | 226 // or auto-open based on extension. |
| 227 COMPLETE_INTERNAL, | 227 COMPLETE_INTERNAL, |
| 228 | 228 |
| 229 // User has cancelled the download. | 229 // User has cancelled the download. |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 253 content::DownloadInterruptReason reason, const FilePath& full_path); | 253 content::DownloadInterruptReason reason, const FilePath& full_path); |
| 254 | 254 |
| 255 // If all pre-requisites have been met, complete download processing, i.e. do | 255 // If all pre-requisites have been met, complete download processing, i.e. do |
| 256 // internal cleanup, file rename, and potentially auto-open. (Dangerous | 256 // internal cleanup, file rename, and potentially auto-open. (Dangerous |
| 257 // downloads still may block on user acceptance after this point.) | 257 // downloads still may block on user acceptance after this point.) |
| 258 void MaybeCompleteDownload(); | 258 void MaybeCompleteDownload(); |
| 259 | 259 |
| 260 void OnDownloadRenamedToFinalName(content::DownloadInterruptReason reason, | 260 void OnDownloadRenamedToFinalName(content::DownloadInterruptReason reason, |
| 261 const FilePath& full_path); | 261 const FilePath& full_path); |
| 262 | 262 |
| 263 void OnDownloadFileReleased(); | 263 void OnDownloadFileReleased(content::DownloadInterruptReason reason); |
| 264 | 264 |
| 265 // Called when the entire download operation (including renaming etc) | 265 // Called when the entire download operation (including renaming etc) |
| 266 // is completed. | 266 // is completed. |
| 267 void Completed(); | 267 void Completed(); |
| 268 | 268 |
| 269 // Helper routines ----------------------------------------------------------- | 269 // Helper routines ----------------------------------------------------------- |
| 270 | 270 |
| 271 // Returns true if the download still needs to be renamed to | 271 // Returns true if the download still needs to be renamed to |
| 272 // GetTargetFilePath(). | 272 // GetTargetFilePath(). |
| 273 bool NeedsRename() const; | 273 bool NeedsRename() const; |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 452 | 452 |
| 453 // Net log to use for this download. | 453 // Net log to use for this download. |
| 454 const net::BoundNetLog bound_net_log_; | 454 const net::BoundNetLog bound_net_log_; |
| 455 | 455 |
| 456 base::WeakPtrFactory<DownloadItemImpl> weak_ptr_factory_; | 456 base::WeakPtrFactory<DownloadItemImpl> weak_ptr_factory_; |
| 457 | 457 |
| 458 DISALLOW_COPY_AND_ASSIGN(DownloadItemImpl); | 458 DISALLOW_COPY_AND_ASSIGN(DownloadItemImpl); |
| 459 }; | 459 }; |
| 460 | 460 |
| 461 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ | 461 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ |
| OLD | NEW |