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: |
(...skipping 16 matching lines...) Expand all Loading... |
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 <stdint.h> | 30 #include <stdint.h> |
31 | 31 |
32 #include <string> | 32 #include <string> |
33 #include <vector> | 33 #include <vector> |
34 | 34 |
35 #include "base/callback.h" | 35 #include "base/callback.h" |
36 #include "base/files/file_path.h" | 36 #include "base/files/file_path.h" |
37 #include "base/sequenced_task_runner_helpers.h" | 37 #include "base/sequenced_task_runner.h" |
38 #include "base/time/time.h" | 38 #include "base/time/time.h" |
39 #include "content/public/browser/download_interrupt_reasons.h" | 39 #include "content/public/browser/download_interrupt_reasons.h" |
40 #include "content/public/browser/download_item.h" | 40 #include "content/public/browser/download_item.h" |
41 #include "content/public/browser/download_url_parameters.h" | 41 #include "content/public/browser/download_url_parameters.h" |
42 #include "net/base/net_errors.h" | 42 #include "net/base/net_errors.h" |
43 | 43 |
44 class GURL; | 44 class GURL; |
45 | 45 |
46 namespace content { | 46 namespace content { |
47 | 47 |
48 class BrowserContext; | 48 class BrowserContext; |
49 class ByteStreamReader; | 49 class ByteStreamReader; |
50 class DownloadManagerDelegate; | 50 class DownloadManagerDelegate; |
51 struct DownloadCreateInfo; | 51 struct DownloadCreateInfo; |
52 | 52 |
53 // Browser's download manager: manages all downloads and destination view. | 53 // Browser's download manager: manages all downloads and destination view. |
54 class CONTENT_EXPORT DownloadManager : public base::SupportsUserData::Data { | 54 class CONTENT_EXPORT DownloadManager : public base::SupportsUserData::Data { |
55 public: | 55 public: |
56 ~DownloadManager() override {} | 56 ~DownloadManager() override {} |
57 | 57 |
| 58 // Returns the task runner that's used for all download-related blocking |
| 59 // tasks, such as file IO. |
| 60 static scoped_refptr<base::SequencedTaskRunner> GetTaskRunner(); |
| 61 |
58 // Sets/Gets the delegate for this DownloadManager. The delegate has to live | 62 // Sets/Gets the delegate for this DownloadManager. The delegate has to live |
59 // past its Shutdown method being called (by the DownloadManager). | 63 // past its Shutdown method being called (by the DownloadManager). |
60 virtual void SetDelegate(DownloadManagerDelegate* delegate) = 0; | 64 virtual void SetDelegate(DownloadManagerDelegate* delegate) = 0; |
61 virtual DownloadManagerDelegate* GetDelegate() const = 0; | 65 virtual DownloadManagerDelegate* GetDelegate() const = 0; |
62 | 66 |
63 // Shutdown the download manager. Content calls this when BrowserContext is | 67 // Shutdown the download manager. Content calls this when BrowserContext is |
64 // being destructed. If the embedder needs this to be called earlier, it can | 68 // being destructed. If the embedder needs this to be called earlier, it can |
65 // call it. In that case, the delegate's Shutdown() method will only be called | 69 // call it. In that case, the delegate's Shutdown() method will only be called |
66 // once. | 70 // once. |
67 virtual void Shutdown() = 0; | 71 virtual void Shutdown() = 0; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 // if you need to keep track of a specific download. (http://crbug.com/593020) | 189 // if you need to keep track of a specific download. (http://crbug.com/593020) |
186 virtual DownloadItem* GetDownload(uint32_t id) = 0; | 190 virtual DownloadItem* GetDownload(uint32_t id) = 0; |
187 | 191 |
188 // Get the download item for |guid|. | 192 // Get the download item for |guid|. |
189 virtual DownloadItem* GetDownloadByGuid(const std::string& guid) = 0; | 193 virtual DownloadItem* GetDownloadByGuid(const std::string& guid) = 0; |
190 }; | 194 }; |
191 | 195 |
192 } // namespace content | 196 } // namespace content |
193 | 197 |
194 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_ | 198 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_ |
OLD | NEW |