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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 // Transitions to: | 269 // Transitions to: |
270 // IN_PROGRESS_INTERNAL Once a server response is received from a | 270 // IN_PROGRESS_INTERNAL Once a server response is received from a |
271 // resumption. | 271 // resumption. |
272 // INTERRUPTED_INTERNAL If the resumption request fails. | 272 // INTERRUPTED_INTERNAL If the resumption request fails. |
273 // CANCELLED_INTERNAL On cancel. | 273 // CANCELLED_INTERNAL On cancel. |
274 RESUMING_INTERNAL, | 274 RESUMING_INTERNAL, |
275 | 275 |
276 MAX_DOWNLOAD_INTERNAL_STATE, | 276 MAX_DOWNLOAD_INTERNAL_STATE, |
277 }; | 277 }; |
278 | 278 |
| 279 // Used with TransitionTo() to indicate whether or not to call |
| 280 // UpdateObservers() after the state transition. |
| 281 enum ShouldUpdateObservers { |
| 282 UPDATE_OBSERVERS, |
| 283 DONT_UPDATE_OBSERVERS |
| 284 }; |
| 285 |
279 // Normal progression of a download ------------------------------------------ | 286 // Normal progression of a download ------------------------------------------ |
280 | 287 |
281 // These are listed in approximately chronological order. There are also | 288 // These are listed in approximately chronological order. There are also |
282 // public methods involved in normal download progression; see | 289 // public methods involved in normal download progression; see |
283 // the implementation ordering in download_item_impl.cc. | 290 // the implementation ordering in download_item_impl.cc. |
284 | 291 |
285 // Construction common to all constructors. |active| should be true for new | 292 // Construction common to all constructors. |active| should be true for new |
286 // downloads and false for downloads from the history. | 293 // downloads and false for downloads from the history. |
287 // |download_type| indicates to the net log system what kind of download | 294 // |download_type| indicates to the net log system what kind of download |
288 // this is. | 295 // this is. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 // object destruction to prevent file destruction. Destroying the file also | 346 // object destruction to prevent file destruction. Destroying the file also |
340 // resets |current_path_|. | 347 // resets |current_path_|. |
341 void ReleaseDownloadFile(bool destroy_file); | 348 void ReleaseDownloadFile(bool destroy_file); |
342 | 349 |
343 // Check if a download is ready for completion. The callback provided | 350 // Check if a download is ready for completion. The callback provided |
344 // may be called at some point in the future if an external entity | 351 // may be called at some point in the future if an external entity |
345 // state has change s.t. this routine should be checked again. | 352 // state has change s.t. this routine should be checked again. |
346 bool IsDownloadReadyForCompletion(const base::Closure& state_change_notify); | 353 bool IsDownloadReadyForCompletion(const base::Closure& state_change_notify); |
347 | 354 |
348 // Call to transition state; all state transitions should go through this. | 355 // Call to transition state; all state transitions should go through this. |
349 void TransitionTo(DownloadInternalState new_state); | 356 // |notify_action| specifies whether or not to call UpdateObservers() after |
| 357 // the state transition. |
| 358 void TransitionTo(DownloadInternalState new_state, |
| 359 ShouldUpdateObservers notify_action); |
350 | 360 |
351 // Set the |danger_type_| and invoke obserers if necessary. | 361 // Set the |danger_type_| and invoke obserers if necessary. |
352 void SetDangerType(DownloadDangerType danger_type); | 362 void SetDangerType(DownloadDangerType danger_type); |
353 | 363 |
354 void SetFullPath(const base::FilePath& new_path); | 364 void SetFullPath(const base::FilePath& new_path); |
355 | 365 |
356 void AutoResumeIfValid(); | 366 void AutoResumeIfValid(); |
357 | 367 |
358 void ResumeInterruptedDownload(); | 368 void ResumeInterruptedDownload(); |
359 | 369 |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 const net::BoundNetLog bound_net_log_; | 537 const net::BoundNetLog bound_net_log_; |
528 | 538 |
529 base::WeakPtrFactory<DownloadItemImpl> weak_ptr_factory_; | 539 base::WeakPtrFactory<DownloadItemImpl> weak_ptr_factory_; |
530 | 540 |
531 DISALLOW_COPY_AND_ASSIGN(DownloadItemImpl); | 541 DISALLOW_COPY_AND_ASSIGN(DownloadItemImpl); |
532 }; | 542 }; |
533 | 543 |
534 } // namespace content | 544 } // namespace content |
535 | 545 |
536 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ | 546 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ |
OLD | NEW |