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..4e782e1c05d59ee70c55559b2e9c89ef79368ec5 |
| --- /dev/null |
| +++ b/components/download/content/download_driver_impl.h |
| @@ -0,0 +1,60 @@ |
| +// 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 "base/files/file_path.h" |
| +#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, |
| + const base::FilePath& dir); |
|
David Trainor- moved to gerrit
2017/05/18 18:29:44
Elaborate on dir in a comment and/or rename?
xingliu
2017/05/18 22:21:49
Done. Comment added here.
|
| + ~DownloadDriverImpl() override; |
| + |
| + // DownloadDriver implementation. |
| + void Initialize(DownloadDriver::Client* client) override; |
| + 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; |
| + DriverEntry Find(const std::string& guid) override; |
| + |
| + 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_; |
| + |
| + // Target directory of download files. |
| + base::FilePath file_dir_; |
| + |
| + // The client that receives updates from low level download logic. |
| + DownloadDriver::Client* client_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(DownloadDriverImpl); |
| +}; |
| + |
| +} // namespace download |
| + |
| +#endif // COMPONENTS_DOWNLOAD_CONTENT_DOWNLOAD_DRIVER_IMPL_H_ |