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

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

Issue 14593012: BrowserContext should simply own DownloadManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 7 months 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 10
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 virtual void CheckForHistoryFilesRemoval() OVERRIDE; 86 virtual void CheckForHistoryFilesRemoval() OVERRIDE;
87 virtual DownloadItem* GetDownload(int id) OVERRIDE; 87 virtual DownloadItem* GetDownload(int id) OVERRIDE;
88 88
89 // For testing; specifically, accessed from TestFileErrorInjector. 89 // For testing; specifically, accessed from TestFileErrorInjector.
90 void SetDownloadItemFactoryForTesting( 90 void SetDownloadItemFactoryForTesting(
91 scoped_ptr<DownloadItemFactory> item_factory); 91 scoped_ptr<DownloadItemFactory> item_factory);
92 void SetDownloadFileFactoryForTesting( 92 void SetDownloadFileFactoryForTesting(
93 scoped_ptr<DownloadFileFactory> file_factory); 93 scoped_ptr<DownloadFileFactory> file_factory);
94 virtual DownloadFileFactory* GetDownloadFileFactoryForTesting(); 94 virtual DownloadFileFactory* GetDownloadFileFactoryForTesting();
95 95
96 virtual ~DownloadManagerImpl();
97
96 private: 98 private:
97 typedef std::set<DownloadItem*> DownloadSet; 99 typedef std::set<DownloadItem*> DownloadSet;
98 typedef base::hash_map<int32, DownloadItemImpl*> DownloadMap; 100 typedef base::hash_map<int32, DownloadItemImpl*> DownloadMap;
99 typedef std::vector<DownloadItemImpl*> DownloadItemImplVector; 101 typedef std::vector<DownloadItemImpl*> DownloadItemImplVector;
100 102
101 // For testing. 103 // For testing.
102 friend class DownloadManagerTest; 104 friend class DownloadManagerTest;
103 friend class DownloadTest; 105 friend class DownloadTest;
104 106
105 friend class base::RefCountedThreadSafe<DownloadManagerImpl>;
106
107 virtual ~DownloadManagerImpl();
108
109 // Create a new active item based on the info. Separate from 107 // Create a new active item based on the info. Separate from
110 // StartDownload() for testing. 108 // StartDownload() for testing.
111 DownloadItemImpl* CreateActiveItem(DownloadId id, 109 DownloadItemImpl* CreateActiveItem(DownloadId id,
112 const DownloadCreateInfo& info); 110 const DownloadCreateInfo& info);
113 111
114 // Get next download id. 112 // Get next download id.
115 DownloadId GetNextId(); 113 DownloadId GetNextId();
116 114
117 // Called with the result of DownloadManagerDelegate::CheckForFileExistence. 115 // Called with the result of DownloadManagerDelegate::CheckForFileExistence.
118 // Updates the state of the file and then notifies this update to the file's 116 // Updates the state of the file and then notifies this update to the file's
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 ObserverList<Observer> observers_; 157 ObserverList<Observer> observers_;
160 158
161 // The current active browser context. 159 // The current active browser context.
162 BrowserContext* browser_context_; 160 BrowserContext* browser_context_;
163 161
164 // Allows an embedder to control behavior. Guaranteed to outlive this object. 162 // Allows an embedder to control behavior. Guaranteed to outlive this object.
165 DownloadManagerDelegate* delegate_; 163 DownloadManagerDelegate* delegate_;
166 164
167 net::NetLog* net_log_; 165 net::NetLog* net_log_;
168 166
167 base::WeakPtrFactory<DownloadManagerImpl> weak_factory_;
168
169 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); 169 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl);
170 }; 170 };
171 171
172 } // namespace content 172 } // namespace content
173 173
174 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ 174 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698