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_CONFIG_H_ |
| 6 #define COMPONENTS_DOWNLOAD_INTERNAL_CONFIG_H_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "base/time/time.h" |
| 12 |
| 13 namespace download { |
| 14 |
| 15 // Configuration name for max concurrent downloads. |
| 16 constexpr char kMaxConcurrentDownloadsConfig[] = "max_concurrent_downloads"; |
| 17 |
| 18 // Configuration name for maximum running downloads. |
| 19 constexpr char kMaxRunningDownloadsConfig[] = "max_running_downloads"; |
| 20 |
| 21 // Configuration name for maximum scheduled downloads. |
| 22 constexpr char kMaxScheduledDownloadsConfig[] = "max_scheduled_downloads"; |
| 23 |
| 24 // Configuration name for maximum retry count. |
| 25 constexpr char kMaxRetryCountConfig[] = "max_retry_count"; |
| 26 |
| 27 // Configuration name for file keep alive time. |
| 28 constexpr char kFileKeepAliveTimeMinutesConfig[] = "file_keep_alive_time"; |
| 29 |
| 30 // Download service configuration. |
| 31 // |
| 32 // Loaded based on experiment parameters from the server. Use default values if |
| 33 // no server configuration was detected. |
| 34 struct Configuration { |
| 35 public: |
| 36 // Create the configuration. |
| 37 static std::unique_ptr<Configuration> CreateFromFinch(); |
| 38 Configuration(); |
| 39 |
| 40 // The maximum number of downloads the DownloadService can have currently in |
| 41 // Active or Paused states. |
| 42 int max_concurrent_downloads; |
| 43 |
| 44 // The maximum number of downloads the DownloadService can have currently in |
| 45 // only Active state. |
| 46 int max_running_downloads; |
| 47 |
| 48 // The maximum number of downloads that are scheduled but not yet in Active |
| 49 // state, for each client using the download service. |
| 50 int max_scheduled_downloads; |
| 51 |
| 52 // The maximum number of retries before the download is aborted. |
| 53 int max_retry_count; |
| 54 |
| 55 // The time that the download service will keep the files around before |
| 56 // deleting them if the client hasn't handle the files. |
| 57 base::TimeDelta file_keep_alive_time; |
| 58 |
| 59 private: |
| 60 DISALLOW_COPY_AND_ASSIGN(Configuration); |
| 61 }; |
| 62 |
| 63 } // namespace download |
| 64 |
| 65 #endif // COMPONENTS_DOWNLOAD_INTERNAL_CONFIG_H_ |
OLD | NEW |