| Index: components/download/internal/download_driver.h
|
| diff --git a/components/download/internal/download_driver.h b/components/download/internal/download_driver.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..9d2006951523d3dbfb97c1158f27d9fd75f14530
|
| --- /dev/null
|
| +++ b/components/download/internal/download_driver.h
|
| @@ -0,0 +1,68 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef COMPONENTS_DOWNLOAD_INTERNAL_DOWNLOAD_DRIVER_H_
|
| +#define COMPONENTS_DOWNLOAD_INTERNAL_DOWNLOAD_DRIVER_H_
|
| +
|
| +#include <string>
|
| +
|
| +#include "components/download/internal/driver_entry.h"
|
| +
|
| +namespace base {
|
| +class FilePath;
|
| +} // namespace base
|
| +
|
| +namespace download {
|
| +
|
| +struct DownloadParams;
|
| +
|
| +// The interface that includes all the operations to interact with low level
|
| +// download library functionalities.
|
| +class DownloadDriver {
|
| + public:
|
| + // The client to receive updates from content download library.
|
| + // The update events for all downloads will pass through, so it's the
|
| + // client's responsibility to filter the events it needs to handle.
|
| + class Client {
|
| + public:
|
| + // Called when the low level download library is ready.
|
| + virtual void OnDriverReady() = 0;
|
| +
|
| + // Called when any download is created.
|
| + virtual void OnDownloadCreated(const DriverEntry& download) = 0;
|
| +
|
| + // Called when any download is failed.
|
| + virtual void OnDownloadFailed(const DriverEntry& download, int reason) = 0;
|
| +
|
| + // Called when any download is successfully completed.
|
| + virtual void OnDownloadSucceeded(const DriverEntry& download,
|
| + const base::FilePath& path) = 0;
|
| +
|
| + // Called when any download is updated.
|
| + virtual void OnDownloadUpdated(const DriverEntry& download) = 0;
|
| + };
|
| +
|
| + // Initialize the driver to receive download updates.
|
| + virtual void Initialize(Client* client) = 0;
|
| +
|
| + // Starts a new download.
|
| + virtual void Start(const DownloadParams& params) = 0;
|
| +
|
| + // Cancels an existing download, all data associated with this download should
|
| + // be removed.
|
| + virtual void Cancel(const std::string& guid) = 0;
|
| +
|
| + // Pauses the download.
|
| + virtual void Pause(const std::string& guid) = 0;
|
| +
|
| + // Resumes the download
|
| + virtual void Resume(const std::string& guid) = 0;
|
| +
|
| + // Find a download record from low level download library.
|
| + virtual DriverEntry Find(const std::string& guid) = 0;
|
| +};
|
| +
|
| +} // namespace download
|
| +
|
| +#endif // COMPONENTS_DOWNLOAD_INTERNAL_DOWNLOAD_DRIVER_H_
|
|
|