Chromium Code Reviews| Index: components/download/content/download_driver_impl.h |
| diff --git a/components/download/content/download_driver_impl.h b/components/download/content/download_driver_impl.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8d3a6b312615f52970f0c704c5e292b4d3ae2a71 |
| --- /dev/null |
| +++ b/components/download/content/download_driver_impl.h |
| @@ -0,0 +1,56 @@ |
| +// 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_CONTENT_DOWNLOAD_DRIVER_IMPL_H_ |
| +#define COMPONENTS_DOWNLOAD_CONTENT_DOWNLOAD_DRIVER_IMPL_H_ |
| + |
| +#include <string> |
| + |
| +#include "components/download/internal/download_driver.h" |
| +#include "components/download/public/download_params.h" |
| +#include "content/public/browser/browser_context.h" |
| +#include "content/public/browser/download_manager.h" |
| + |
| +namespace download { |
| + |
| +// Aggregates and handles all interaction between download service and content |
| +// download logic. |
| +class DownloadDriverImpl : public DownloadDriver, |
| + public content::DownloadManager::Observer, |
| + public content::DownloadItem::Observer { |
| + public: |
| + DownloadDriverImpl(content::DownloadManager* manager); |
| + ~DownloadDriverImpl() override; |
| + |
| + // DownloadDriver implementation. |
| + void Start(const DownloadParams& params) override; |
| + void Cancel(const std::string& guid) override; |
| + void Pause(const std::string& guid) override; |
| + void Resume(const std::string& guid) override; |
| + bool IsReady() const override; |
| + void SetObserver(DownloadDriver::Observer* observer) override; |
|
David Trainor- moved to gerrit
2017/05/15 20:08:14
Should we just have an initialize method that take
xingliu
2017/05/17 19:34:52
Done.
|
| + |
| + private: |
| + // content::DownloadItem::Observer implementation. |
| + void OnDownloadUpdated(content::DownloadItem* item) override; |
| + |
| + // content::DownloadManager::Observer implementation. |
| + void OnDownloadCreated(content::DownloadManager* manager, |
| + content::DownloadItem* item) override; |
| + void OnManagerInitialized() override; |
| + void ManagerGoingDown(content::DownloadManager* manager) override; |
| + |
| + // Low level download handle. |
| + content::DownloadManager* download_manager_; |
| + |
| + // The observer that receives updates from low level download logic. |
| + // Can be nullptr when no updates are needed by the download service. |
| + DownloadDriver::Observer* observer_; |
|
David Trainor- moved to gerrit
2017/05/15 20:08:14
Can this be called Client or something non-observe
xingliu
2017/05/17 19:34:52
Done.
|
| + |
| + DISALLOW_COPY_AND_ASSIGN(DownloadDriverImpl); |
| +}; |
| + |
| +} // namespace download |
| + |
| +#endif // COMPONENTS_DOWNLOAD_CONTENT_DOWNLOAD_DRIVER_IMPL_H_ |