OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // The DownloadManager object manages the process of downloading, including | 5 // The DownloadManager object manages the process of downloading, including |
6 // updates to the history system and providing the information for displaying | 6 // updates to the history system and providing the information for displaying |
7 // the downloads view in the Destinations tab. There is one DownloadManager per | 7 // the downloads view in the Destinations tab. There is one DownloadManager per |
8 // active browser context in Chrome. | 8 // active browser context in Chrome. |
9 // | 9 // |
10 // Download observers: | 10 // Download observers: |
11 // Objects that are interested in notifications about new downloads, or progress | 11 // Objects that are interested in notifications about new downloads, or progress |
12 // updates for a given download must implement one of the download observer | 12 // updates for a given download must implement one of the download observer |
13 // interfaces: | 13 // interfaces: |
14 // DownloadManager::Observer: | 14 // DownloadManager::Observer: |
15 // - allows observers, primarily views, to be notified when changes to the | 15 // - allows observers, primarily views, to be notified when changes to the |
16 // set of all downloads (such as new downloads, or deletes) occur | 16 // set of all downloads (such as new downloads, or deletes) occur |
17 // Use AddObserver() / RemoveObserver() on the appropriate download object to | 17 // Use AddObserver() / RemoveObserver() on the appropriate download object to |
18 // receive state updates. | 18 // receive state updates. |
19 // | 19 // |
20 // Download state persistence: | 20 // Download state persistence: |
21 // The DownloadManager uses the history service for storing persistent | 21 // The DownloadManager uses the history service for storing persistent |
22 // information about the state of all downloads. The history system maintains a | 22 // information about the state of all downloads. The history system maintains a |
23 // separate table for this called 'downloads'. At the point that the | 23 // separate table for this called 'downloads'. At the point that the |
24 // DownloadManager is constructed, we query the history service for the state of | 24 // DownloadManager is constructed, we query the history service for the state of |
25 // all persisted downloads. | 25 // all persisted downloads. |
26 | 26 |
27 #ifndef CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_ | 27 #ifndef CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_ |
28 #define CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_ | 28 #define CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_ |
29 | 29 |
30 #include <set> | |
30 #include <string> | 31 #include <string> |
31 #include <vector> | 32 #include <vector> |
32 | 33 |
33 #include "base/basictypes.h" | 34 #include "base/basictypes.h" |
34 #include "base/callback.h" | 35 #include "base/callback.h" |
35 #include "base/files/file_path.h" | 36 #include "base/files/file_path.h" |
36 #include "base/gtest_prod_util.h" | 37 #include "base/gtest_prod_util.h" |
37 #include "base/sequenced_task_runner_helpers.h" | 38 #include "base/sequenced_task_runner_helpers.h" |
38 #include "base/time/time.h" | 39 #include "base/time/time.h" |
39 #include "content/public/browser/download_interrupt_reasons.h" | 40 #include "content/public/browser/download_interrupt_reasons.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
103 | 104 |
104 // Called by a download source (Currently DownloadResourceHandler) | 105 // Called by a download source (Currently DownloadResourceHandler) |
105 // to initiate the non-source portions of a download. | 106 // to initiate the non-source portions of a download. |
106 // Returns the id assigned to the download. If the DownloadCreateInfo | 107 // Returns the id assigned to the download. If the DownloadCreateInfo |
107 // specifies an id, that id will be used. | 108 // specifies an id, that id will be used. |
108 virtual void StartDownload( | 109 virtual void StartDownload( |
109 scoped_ptr<DownloadCreateInfo> info, | 110 scoped_ptr<DownloadCreateInfo> info, |
110 scoped_ptr<ByteStreamReader> stream, | 111 scoped_ptr<ByteStreamReader> stream, |
111 const DownloadUrlParameters::OnStartedCallback& on_started) = 0; | 112 const DownloadUrlParameters::OnStartedCallback& on_started) = 0; |
112 | 113 |
113 // Remove downloads after remove_begin (inclusive) and before remove_end | 114 // Remove downloads after remove_begin (inclusive) and before remove_end |
Mike West
2015/07/22 20:16:03
Poke at the comment to describe the new parameter.
Timo Reimann
2015/07/23 23:11:07
Done.
| |
114 // (exclusive). You may pass in null Time values to do an unbounded delete | 115 // (exclusive). You may pass in null Time values to do an unbounded delete |
115 // in either direction. | 116 // in either direction. |
116 virtual int RemoveDownloadsBetween(base::Time remove_begin, | 117 virtual int RemoveDownloadsBetween(const std::set<GURL>& restricted_urls, |
118 base::Time remove_begin, | |
117 base::Time remove_end) = 0; | 119 base::Time remove_end) = 0; |
118 | 120 |
119 // Remove downloads will delete all downloads that have a timestamp that is | 121 // Remove downloads will delete all downloads that have a timestamp that is |
120 // the same or more recent than |remove_begin|. The number of downloads | 122 // the same or more recent than |remove_begin|. The number of downloads |
121 // deleted is returned back to the caller. | 123 // deleted is returned back to the caller. |
122 virtual int RemoveDownloads(base::Time remove_begin) = 0; | 124 virtual int RemoveDownloads(base::Time remove_begin) = 0; |
123 | 125 |
124 // Remove all downloads will delete all downloads. The number of downloads | 126 // Remove all downloads will delete all downloads. The number of downloads |
125 // deleted is returned back to the caller. | 127 // deleted is returned back to the caller. |
126 virtual int RemoveAllDownloads() = 0; | 128 virtual int RemoveAllDownloads() = 0; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
174 virtual void CheckForHistoryFilesRemoval() = 0; | 176 virtual void CheckForHistoryFilesRemoval() = 0; |
175 | 177 |
176 // Get the download item for |id| if present, no matter what type of download | 178 // Get the download item for |id| if present, no matter what type of download |
177 // it is or state it's in. | 179 // it is or state it's in. |
178 virtual DownloadItem* GetDownload(uint32 id) = 0; | 180 virtual DownloadItem* GetDownload(uint32 id) = 0; |
179 }; | 181 }; |
180 | 182 |
181 } // namespace content | 183 } // namespace content |
182 | 184 |
183 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_ | 185 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_ |
OLD | NEW |