| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 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 COMPONENTS_DOWNLOAD_INTERNAL_DOWNLOAD_DRIVER_H_ | 5 #ifndef COMPONENTS_DOWNLOAD_INTERNAL_DOWNLOAD_DRIVER_H_ |
| 6 #define COMPONENTS_DOWNLOAD_INTERNAL_DOWNLOAD_DRIVER_H_ | 6 #define COMPONENTS_DOWNLOAD_INTERNAL_DOWNLOAD_DRIVER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/optional.h" | 10 #include "base/optional.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 virtual void OnDownloadFailed(const DriverEntry& download, int reason) = 0; | 39 virtual void OnDownloadFailed(const DriverEntry& download, int reason) = 0; |
| 40 | 40 |
| 41 // Called when any download is successfully completed. | 41 // Called when any download is successfully completed. |
| 42 virtual void OnDownloadSucceeded(const DriverEntry& download, | 42 virtual void OnDownloadSucceeded(const DriverEntry& download, |
| 43 const base::FilePath& path) = 0; | 43 const base::FilePath& path) = 0; |
| 44 | 44 |
| 45 // Called when any download is updated. | 45 // Called when any download is updated. |
| 46 virtual void OnDownloadUpdated(const DriverEntry& download) = 0; | 46 virtual void OnDownloadUpdated(const DriverEntry& download) = 0; |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 virtual ~DownloadDriver() = default; |
| 50 |
| 49 // Initialize the driver to receive download updates. | 51 // Initialize the driver to receive download updates. |
| 50 virtual void Initialize(Client* client) = 0; | 52 virtual void Initialize(Client* client) = 0; |
| 51 | 53 |
| 52 // Returns if the driver is ready. Returns false when the driver is not | 54 // Returns if the driver is ready. Returns false when the driver is not |
| 53 // initialized by the client, or low level download library has been shut | 55 // initialized by the client, or low level download library has been shut |
| 54 // down. | 56 // down. |
| 55 virtual bool IsReady() const = 0; | 57 virtual bool IsReady() const = 0; |
| 56 | 58 |
| 57 // Starts a new download. | 59 // Starts a new download. |
| 58 virtual void Start(const DownloadParams& params) = 0; | 60 virtual void Start(const DownloadParams& params) = 0; |
| 59 | 61 |
| 60 // Cancels an existing download, all data associated with this download should | 62 // Cancels an existing download, all data associated with this download should |
| 61 // be removed. | 63 // be removed. |
| 62 virtual void Cancel(const std::string& guid) = 0; | 64 virtual void Cancel(const std::string& guid) = 0; |
| 63 | 65 |
| 64 // Pauses the download. | 66 // Pauses the download. |
| 65 virtual void Pause(const std::string& guid) = 0; | 67 virtual void Pause(const std::string& guid) = 0; |
| 66 | 68 |
| 67 // Resumes the download | 69 // Resumes the download |
| 68 virtual void Resume(const std::string& guid) = 0; | 70 virtual void Resume(const std::string& guid) = 0; |
| 69 | 71 |
| 70 // Find a download record from low level download library. | 72 // Find a download record from low level download library. |
| 71 virtual base::Optional<DriverEntry> Find(const std::string& guid) = 0; | 73 virtual base::Optional<DriverEntry> Find(const std::string& guid) = 0; |
| 72 }; | 74 }; |
| 73 | 75 |
| 74 } // namespace download | 76 } // namespace download |
| 75 | 77 |
| 76 #endif // COMPONENTS_DOWNLOAD_INTERNAL_DOWNLOAD_DRIVER_H_ | 78 #endif // COMPONENTS_DOWNLOAD_INTERNAL_DOWNLOAD_DRIVER_H_ |
| OLD | NEW |