Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1330)

Side by Side Diff: components/download/content/download_driver_impl.h

Issue 2880933002: Download driver for components/download. (Closed)
Patch Set: Polish comment. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/download/content/DEPS ('k') | components/download/content/download_driver_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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_CONTENT_DOWNLOAD_DRIVER_IMPL_H_
6 #define COMPONENTS_DOWNLOAD_CONTENT_DOWNLOAD_DRIVER_IMPL_H_
7
8 #include <string>
9
10 #include "base/files/file_path.h"
11 #include "components/download/internal/download_driver.h"
12 #include "components/download/public/download_params.h"
13 #include "content/public/browser/browser_context.h"
14 #include "content/public/browser/download_manager.h"
15
16 namespace download {
17
18 struct DriverEntry;
19
20 // Aggregates and handles all interaction between download service and content
21 // download logic.
22 class DownloadDriverImpl : public DownloadDriver,
23 public content::DownloadManager::Observer,
24 public content::DownloadItem::Observer {
25 public:
26 // Creates a driver entry based on a download item.
27 static DriverEntry CreateDriverEntry(const content::DownloadItem* item);
28
29 // Create the driver. All files downloaded will be saved to |dir|.
30 DownloadDriverImpl(content::DownloadManager* manager,
31 const base::FilePath& dir);
32 ~DownloadDriverImpl() override;
33
34 // DownloadDriver implementation.
35 void Initialize(DownloadDriver::Client* client) override;
36 bool IsReady() const override;
37 void Start(const DownloadParams& params) override;
38 void Cancel(const std::string& guid) override;
39 void Pause(const std::string& guid) override;
40 void Resume(const std::string& guid) override;
41 base::Optional<DriverEntry> Find(const std::string& guid) override;
42
43 private:
44 // content::DownloadItem::Observer implementation.
45 void OnDownloadUpdated(content::DownloadItem* item) override;
46
47 // content::DownloadManager::Observer implementation.
48 void OnDownloadCreated(content::DownloadManager* manager,
49 content::DownloadItem* item) override;
50 void OnManagerInitialized() override;
51 void ManagerGoingDown(content::DownloadManager* manager) override;
52
53 // Low level download handle.
54 content::DownloadManager* download_manager_;
55
56 // Target directory of download files.
57 base::FilePath file_dir_;
58
59 // The client that receives updates from low level download logic.
60 DownloadDriver::Client* client_;
61
62 DISALLOW_COPY_AND_ASSIGN(DownloadDriverImpl);
63 };
64
65 } // namespace download
66
67 #endif // COMPONENTS_DOWNLOAD_CONTENT_DOWNLOAD_DRIVER_IMPL_H_
OLDNEW
« no previous file with comments | « components/download/content/DEPS ('k') | components/download/content/download_driver_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698