OLD | NEW |
---|---|
(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 // Aggregates and handles all interaction between download service and content | |
19 // download logic. | |
20 class DownloadDriverImpl : public DownloadDriver, | |
21 public content::DownloadManager::Observer, | |
22 public content::DownloadItem::Observer { | |
23 public: | |
24 DownloadDriverImpl(content::DownloadManager* manager, | |
25 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.
| |
26 ~DownloadDriverImpl() override; | |
27 | |
28 // DownloadDriver implementation. | |
29 void Initialize(DownloadDriver::Client* client) override; | |
30 void Start(const DownloadParams& params) override; | |
31 void Cancel(const std::string& guid) override; | |
32 void Pause(const std::string& guid) override; | |
33 void Resume(const std::string& guid) override; | |
34 DriverEntry Find(const std::string& guid) override; | |
35 | |
36 private: | |
37 // content::DownloadItem::Observer implementation. | |
38 void OnDownloadUpdated(content::DownloadItem* item) override; | |
39 | |
40 // content::DownloadManager::Observer implementation. | |
41 void OnDownloadCreated(content::DownloadManager* manager, | |
42 content::DownloadItem* item) override; | |
43 void OnManagerInitialized() override; | |
44 void ManagerGoingDown(content::DownloadManager* manager) override; | |
45 | |
46 // Low level download handle. | |
47 content::DownloadManager* download_manager_; | |
48 | |
49 // Target directory of download files. | |
50 base::FilePath file_dir_; | |
51 | |
52 // The client that receives updates from low level download logic. | |
53 DownloadDriver::Client* client_; | |
54 | |
55 DISALLOW_COPY_AND_ASSIGN(DownloadDriverImpl); | |
56 }; | |
57 | |
58 } // namespace download | |
59 | |
60 #endif // COMPONENTS_DOWNLOAD_CONTENT_DOWNLOAD_DRIVER_IMPL_H_ | |
OLD | NEW |