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

Side by Side Diff: components/download/internal/download_driver.h

Issue 2880933002: Download driver for components/download. (Closed)
Patch Set: Work on feedbacks. 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
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_INTERNAL_DOWNLOAD_DRIVER_H_
6 #define COMPONENTS_DOWNLOAD_INTERNAL_DOWNLOAD_DRIVER_H_
7
8 #include <string>
9
10 #include "components/download/content/driver_entry.h"
11
12 namespace base {
13 class FilePath;
14 } // namespace base
15
16 namespace download {
17
18 struct DownloadParams;
19
20 // The interface that includes all the operations to interact with low level
21 // download library functionalities.
22 class DownloadDriver {
23 public:
24 // The client to receive updates from content download library.
25 // The update events for all downloads will pass through, so it's the
26 // client's responsibility to filter the events it needs to handle.
27 class Client {
28 public:
29 // Called when the low level download library is ready.
30 virtual void OnDriverReady() = 0;
31
32 // Called when any download is created.
33 virtual void OnDownloadCreated(const DriverEntry& download) = 0;
34
35 // Called when any download is failed.
36 virtual void OnDownloadFailed(const DriverEntry& download, int reason) = 0;
37
38 // Called when any download is successfully completed.
39 virtual void OnDownloadSucceeded(const DriverEntry& download,
40 const base::FilePath& path) = 0;
41
42 // Called when any download is updated.
43 virtual void OnDownloadUpdated(const DriverEntry& download) = 0;
44 };
45
46 // Initialize the driver to receive download updates.
47 virtual void Initialize(Client* client) = 0;
48
49 // Starts a new download.
50 virtual void Start(const DownloadParams& params) = 0;
51
52 // Cancels an existing download, all data associated with this download should
53 // be removed.
54 virtual void Cancel(const std::string& guid) = 0;
55
56 // Pauses the download.
57 virtual void Pause(const std::string& guid) = 0;
58
59 // Resumes the download
60 virtual void Resume(const std::string& guid) = 0;
61
62 // Find a download record from low level download library.
63 virtual DriverEntry Find(const std::string& guid) = 0;
64 };
65
66 } // namespace download
67
68 #endif // COMPONENTS_DOWNLOAD_INTERNAL_DOWNLOAD_DRIVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698