OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_DOWNLOAD_INTERNAL_ENTRY_H_ |
| 6 #define COMPONENTS_DOWNLOAD_INTERNAL_ENTRY_H_ |
| 7 |
| 8 #include "components/download/public/client.h" |
| 9 #include "components/download/public/clients.h" |
| 10 #include "components/download/public/download_params.h" |
| 11 |
| 12 namespace download { |
| 13 |
| 14 // An entry in the Model that represents a scheduled download. |
| 15 struct Entry { |
| 16 public: |
| 17 enum class State { |
| 18 // A newly added download. The Entry is not guaranteed to be persisted in |
| 19 // the model yet. |
| 20 NEW = 0, |
| 21 |
| 22 // The download has been persisted and is available to start, pending |
| 23 // scheduler criteria. |
| 24 AVAILABLE = 1, |
| 25 |
| 26 // The download is active. The DownloadDriver is aware of it and it is |
| 27 // either being downloaded or suspended by the scheduler due to device |
| 28 // characteristics or throttling. |
| 29 ACTIVE = 2, |
| 30 |
| 31 // The download has been paused by the owning Client. The download will not |
| 32 // be run until it is resumed by the Client. |
| 33 PAUSED = 3, |
| 34 |
| 35 // The download is 'complete' by some definition of that term (could have |
| 36 // failed, could have succeeded, etc.). It is ready to have UMA logs saved. |
| 37 COMPLETE = 4, |
| 38 |
| 39 // The download is finished. We are leaving this entry around to make sure |
| 40 // the files on disk are cleaned up. |
| 41 WATCHDOG = 5, |
| 42 }; |
| 43 |
| 44 Entry(); |
| 45 Entry(const Entry& other); |
| 46 ~Entry(); |
| 47 |
| 48 // The feature that is requesting this download. |
| 49 DownloadClient client = DownloadClient::INVALID; |
| 50 |
| 51 // A unique GUID that represents this download. See | base::GenerateGUID()|. |
| 52 std::string guid; |
| 53 |
| 54 // The parameters that determine under what device conditions this download |
| 55 // will occur. |
| 56 SchedulingParams scheduling_params; |
| 57 |
| 58 // The parameters that define the actual download request to make. |
| 59 RequestParams request_params; |
| 60 |
| 61 // The state of the download to help the scheduler and loggers make the right |
| 62 // decisions about the download object. |
| 63 State state = State::NEW; |
| 64 }; |
| 65 |
| 66 } // namespace download |
| 67 |
| 68 #endif // COMPONENTS_DOWNLOAD_INTERNAL_ENTRY_H_ |
OLD | NEW |