| 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_CONTROLLER_H_ |
| 6 #define COMPONENTS_DOWNLOAD_INTERNAL_CONTROLLER_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "components/download/public/clients.h" |
| 12 |
| 13 namespace download { |
| 14 |
| 15 struct DownloadParams; |
| 16 struct SchedulingParams; |
| 17 struct StartupStatus; |
| 18 |
| 19 // The core Controller responsible for gluing various DownloadService components |
| 20 // together to manage the active downloads. |
| 21 class Controller { |
| 22 public: |
| 23 Controller() = default; |
| 24 virtual ~Controller() = default; |
| 25 |
| 26 // Initializes the controller. Initialization may be asynchronous. |
| 27 virtual void Initialize() = 0; |
| 28 |
| 29 // Returns the status of Controller. |
| 30 virtual const StartupStatus& GetStartupStatus() = 0; |
| 31 |
| 32 // Starts a download with |params|. See DownloadParams::StartCallback and |
| 33 // DownloadParams::StartResponse for information on how a caller can determine |
| 34 // whether or not the download was successfully accepted and queued. |
| 35 virtual void StartDownload(const DownloadParams& params) = 0; |
| 36 |
| 37 // Pauses a download request associated with |guid| if one exists. |
| 38 virtual void PauseDownload(const std::string& guid) = 0; |
| 39 |
| 40 // Resumes a download request associated with |guid| if one exists. The |
| 41 // download request may or may not start downloading at this time, but it will |
| 42 // no longer be blocked by any prior PauseDownload() actions. |
| 43 virtual void ResumeDownload(const std::string& guid) = 0; |
| 44 |
| 45 // Cancels a download request associated with |guid| if one exists. |
| 46 virtual void CancelDownload(const std::string& guid) = 0; |
| 47 |
| 48 // Changes the SchedulingParams of a download request associated with |guid| |
| 49 // to |params|. |
| 50 virtual void ChangeDownloadCriteria(const std::string& guid, |
| 51 const SchedulingParams& params) = 0; |
| 52 |
| 53 // Exposes the owner of the download request for |guid| if one exists. |
| 54 // Otherwise returns DownloadClient::INVALID for an unowned entry. |
| 55 virtual DownloadClient GetOwnerOfDownload(const std::string& guid) = 0; |
| 56 |
| 57 private: |
| 58 DISALLOW_COPY_AND_ASSIGN(Controller); |
| 59 }; |
| 60 |
| 61 } // namespace download |
| 62 |
| 63 #endif // COMPONENTS_DOWNLOAD_INTERNAL_CONTROLLER_H_ |
| OLD | NEW |