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

Side by Side Diff: content/browser/download/download_manager_impl.h

Issue 1418663010: Adding WebContent-free Download (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years 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
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 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_
6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 #include <vector>
11 12
12 #include "base/callback_forward.h" 13 #include "base/callback_forward.h"
13 #include "base/containers/hash_tables.h" 14 #include "base/containers/hash_tables.h"
15 #include "base/macros.h"
14 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
17 #include "base/observer_list.h" 19 #include "base/observer_list.h"
18 #include "base/sequenced_task_runner_helpers.h" 20 #include "base/sequenced_task_runner_helpers.h"
19 #include "base/synchronization/lock.h" 21 #include "base/synchronization/lock.h"
20 #include "content/browser/download/download_item_impl_delegate.h" 22 #include "content/browser/download/download_item_impl_delegate.h"
23 #include "content/browser/download/url_downloader.h"
21 #include "content/common/content_export.h" 24 #include "content/common/content_export.h"
22 #include "content/public/browser/download_manager.h" 25 #include "content/public/browser/download_manager.h"
23 #include "content/public/browser/download_manager_delegate.h" 26 #include "content/public/browser/download_manager_delegate.h"
24 #include "content/public/browser/download_url_parameters.h" 27 #include "content/public/browser/download_url_parameters.h"
25 28
26 namespace net { 29 namespace net {
27 class BoundNetLog; 30 class BoundNetLog;
28 } 31 }
29 32
30 namespace content { 33 namespace content {
31 class DownloadFileFactory; 34 class DownloadFileFactory;
32 class DownloadItemFactory; 35 class DownloadItemFactory;
33 class DownloadItemImpl; 36 class DownloadItemImpl;
34 class DownloadRequestHandleInterface; 37 class DownloadRequestHandleInterface;
35 38
36 class CONTENT_EXPORT DownloadManagerImpl : public DownloadManager, 39 class CONTENT_EXPORT DownloadManagerImpl : public DownloadManager,
37 private DownloadItemImplDelegate { 40 private DownloadItemImplDelegate {
38 public: 41 public:
39 typedef base::Callback<void(DownloadItemImpl*)> DownloadItemImplCreated; 42 typedef base::Callback<void(DownloadItemImpl*)> DownloadItemImplCreated;
40 43
44 class Core {
asanka 2015/12/08 16:58:32 Core classes are usually used when some core funct
svaldez 2015/12/08 20:39:26 Done.
45 public:
46 Core();
47 ~Core();
48
49 void AddUrlDownloader(scoped_ptr<UrlDownloader> downloader);
50 void Shutdown();
51
52 private:
53 std::vector<scoped_ptr<UrlDownloader>> url_downloaders_;
54
55 DISALLOW_COPY_AND_ASSIGN(Core);
56 };
57
41 // Caller guarantees that |net_log| will remain valid 58 // Caller guarantees that |net_log| will remain valid
42 // for the lifetime of DownloadManagerImpl (until Shutdown() is called). 59 // for the lifetime of DownloadManagerImpl (until Shutdown() is called).
43 DownloadManagerImpl(net::NetLog* net_log, BrowserContext* browser_context); 60 DownloadManagerImpl(net::NetLog* net_log, BrowserContext* browser_context);
44 ~DownloadManagerImpl() override; 61 ~DownloadManagerImpl() override;
45 62
46 // Implementation functions (not part of the DownloadManager interface). 63 // Implementation functions (not part of the DownloadManager interface).
47 64
48 // Creates a download item for the SavePackage system. 65 // Creates a download item for the SavePackage system.
49 // Must be called on the UI thread. Note that the DownloadManager 66 // Must be called on the UI thread. Note that the DownloadManager
50 // retains ownership. 67 // retains ownership.
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 bool ShouldOpenDownload(DownloadItemImpl* item, 178 bool ShouldOpenDownload(DownloadItemImpl* item,
162 const ShouldOpenDownloadCallback& callback) override; 179 const ShouldOpenDownloadCallback& callback) override;
163 void CheckForFileRemoval(DownloadItemImpl* download_item) override; 180 void CheckForFileRemoval(DownloadItemImpl* download_item) override;
164 void ResumeInterruptedDownload( 181 void ResumeInterruptedDownload(
165 scoped_ptr<content::DownloadUrlParameters> params, 182 scoped_ptr<content::DownloadUrlParameters> params,
166 uint32 id) override; 183 uint32 id) override;
167 void OpenDownload(DownloadItemImpl* download) override; 184 void OpenDownload(DownloadItemImpl* download) override;
168 void ShowDownloadInShell(DownloadItemImpl* download) override; 185 void ShowDownloadInShell(DownloadItemImpl* download) override;
169 void DownloadRemoved(DownloadItemImpl* download) override; 186 void DownloadRemoved(DownloadItemImpl* download) override;
170 187
188 Core* core_;
189
171 // Factory for creation of downloads items. 190 // Factory for creation of downloads items.
172 scoped_ptr<DownloadItemFactory> item_factory_; 191 scoped_ptr<DownloadItemFactory> item_factory_;
173 192
174 // Factory for the creation of download files. 193 // Factory for the creation of download files.
175 scoped_ptr<DownloadFileFactory> file_factory_; 194 scoped_ptr<DownloadFileFactory> file_factory_;
176 195
177 // |downloads_| is the owning set for all downloads known to the 196 // |downloads_| is the owning set for all downloads known to the
178 // DownloadManager. This includes downloads started by the user in 197 // DownloadManager. This includes downloads started by the user in
179 // this session, downloads initialized from the history system, and 198 // this session, downloads initialized from the history system, and
180 // "save page as" downloads. 199 // "save page as" downloads.
(...skipping 16 matching lines...) Expand all
197 net::NetLog* net_log_; 216 net::NetLog* net_log_;
198 217
199 base::WeakPtrFactory<DownloadManagerImpl> weak_factory_; 218 base::WeakPtrFactory<DownloadManagerImpl> weak_factory_;
200 219
201 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); 220 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl);
202 }; 221 };
203 222
204 } // namespace content 223 } // namespace content
205 224
206 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ 225 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698