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 "components/download/internal/download_driver.h" | |
11 #include "components/download/public/download_params.h" | |
12 #include "content/public/browser/browser_context.h" | |
13 #include "content/public/browser/download_manager.h" | |
14 | |
15 namespace download { | |
16 | |
17 // Aggregates and handles all interaction between download service and content | |
18 // download logic. | |
19 class DownloadDriverImpl : public DownloadDriver, | |
20 public content::DownloadManager::Observer, | |
21 public content::DownloadItem::Observer { | |
22 public: | |
23 DownloadDriverImpl(content::DownloadManager* manager); | |
24 ~DownloadDriverImpl() override; | |
25 | |
26 // DownloadDriver implementation. | |
27 void Start(const DownloadParams& params) override; | |
28 void Cancel(const std::string& guid) override; | |
29 void Pause(const std::string& guid) override; | |
30 void Resume(const std::string& guid) override; | |
31 bool IsReady() const override; | |
32 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.
| |
33 | |
34 private: | |
35 // content::DownloadItem::Observer implementation. | |
36 void OnDownloadUpdated(content::DownloadItem* item) override; | |
37 | |
38 // content::DownloadManager::Observer implementation. | |
39 void OnDownloadCreated(content::DownloadManager* manager, | |
40 content::DownloadItem* item) override; | |
41 void OnManagerInitialized() override; | |
42 void ManagerGoingDown(content::DownloadManager* manager) override; | |
43 | |
44 // Low level download handle. | |
45 content::DownloadManager* download_manager_; | |
46 | |
47 // The observer that receives updates from low level download logic. | |
48 // Can be nullptr when no updates are needed by the download service. | |
49 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.
| |
50 | |
51 DISALLOW_COPY_AND_ASSIGN(DownloadDriverImpl); | |
52 }; | |
53 | |
54 } // namespace download | |
55 | |
56 #endif // COMPONENTS_DOWNLOAD_CONTENT_DOWNLOAD_DRIVER_IMPL_H_ | |
OLD | NEW |