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

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

Issue 11363222: Persist download interrupt reason, both target and current paths, and url_chain. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged to r180302 Created 7 years, 10 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 | Annotate | Revision Log
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 scoped_ptr<ByteStreamReader> stream) OVERRIDE; 61 scoped_ptr<ByteStreamReader> stream) OVERRIDE;
62 virtual void CancelDownload(int32 download_id) OVERRIDE; 62 virtual void CancelDownload(int32 download_id) OVERRIDE;
63 virtual int RemoveDownloadsBetween(base::Time remove_begin, 63 virtual int RemoveDownloadsBetween(base::Time remove_begin,
64 base::Time remove_end) OVERRIDE; 64 base::Time remove_end) OVERRIDE;
65 virtual int RemoveDownloads(base::Time remove_begin) OVERRIDE; 65 virtual int RemoveDownloads(base::Time remove_begin) OVERRIDE;
66 virtual int RemoveAllDownloads() OVERRIDE; 66 virtual int RemoveAllDownloads() OVERRIDE;
67 virtual void DownloadUrl(scoped_ptr<DownloadUrlParameters> params) OVERRIDE; 67 virtual void DownloadUrl(scoped_ptr<DownloadUrlParameters> params) OVERRIDE;
68 virtual void AddObserver(Observer* observer) OVERRIDE; 68 virtual void AddObserver(Observer* observer) OVERRIDE;
69 virtual void RemoveObserver(Observer* observer) OVERRIDE; 69 virtual void RemoveObserver(Observer* observer) OVERRIDE;
70 virtual content::DownloadItem* CreateDownloadItem( 70 virtual content::DownloadItem* CreateDownloadItem(
71 const FilePath& path, 71 const FilePath& current_path,
72 const GURL& url, 72 const FilePath& target_path,
73 const std::vector<GURL>& url_chain,
73 const GURL& referrer_url, 74 const GURL& referrer_url,
74 const base::Time& start_time, 75 const base::Time& start_time,
75 const base::Time& end_time, 76 const base::Time& end_time,
76 int64 received_bytes, 77 int64 received_bytes,
77 int64 total_bytes, 78 int64 total_bytes,
78 content::DownloadItem::DownloadState state, 79 content::DownloadItem::DownloadState state,
80 DownloadDangerType danger_type,
81 DownloadInterruptReason interrupt_reason,
79 bool opened) OVERRIDE; 82 bool opened) OVERRIDE;
80 virtual int InProgressCount() const OVERRIDE; 83 virtual int InProgressCount() const OVERRIDE;
81 virtual BrowserContext* GetBrowserContext() const OVERRIDE; 84 virtual BrowserContext* GetBrowserContext() const OVERRIDE;
82 virtual void CheckForHistoryFilesRemoval() OVERRIDE; 85 virtual void CheckForHistoryFilesRemoval() OVERRIDE;
83 virtual DownloadItem* GetDownload(int id) OVERRIDE; 86 virtual DownloadItem* GetDownload(int id) OVERRIDE;
84 87
85 // For testing; specifically, accessed from TestFileErrorInjector. 88 // For testing; specifically, accessed from TestFileErrorInjector.
86 void SetDownloadItemFactoryForTesting( 89 void SetDownloadItemFactoryForTesting(
87 scoped_ptr<DownloadItemFactory> item_factory); 90 scoped_ptr<DownloadItemFactory> item_factory);
88 void SetDownloadFileFactoryForTesting( 91 void SetDownloadFileFactoryForTesting(
89 scoped_ptr<DownloadFileFactory> file_factory); 92 scoped_ptr<DownloadFileFactory> file_factory);
90 virtual DownloadFileFactory* GetDownloadFileFactoryForTesting(); 93 virtual DownloadFileFactory* GetDownloadFileFactoryForTesting();
91 94
92 private: 95 private:
93 typedef std::set<DownloadItem*> DownloadSet; 96 typedef std::set<DownloadItem*> DownloadSet;
94 typedef base::hash_map<int32, DownloadItemImpl*> DownloadMap; 97 typedef base::hash_map<int32, DownloadItemImpl*> DownloadMap;
95 typedef std::vector<DownloadItemImpl*> DownloadItemImplVector; 98 typedef std::vector<DownloadItemImpl*> DownloadItemImplVector;
96 99
97 // For testing. 100 // For testing.
98 friend class DownloadManagerTest; 101 friend class DownloadManagerTest;
99 friend class DownloadTest; 102 friend class DownloadTest;
100 103
101 friend class base::RefCountedThreadSafe<DownloadManagerImpl>; 104 friend class base::RefCountedThreadSafe<DownloadManagerImpl>;
102 105
103 virtual ~DownloadManagerImpl(); 106 virtual ~DownloadManagerImpl();
104 107
105 // Retrieves the download item corresponding to the passed 108 // Retrieves the download item corresponding to the passed
106 // DownloadCreateInfo. This will create the download item 109 // DownloadCreateInfo (generated on the IO thread). This will create
107 // if this is a new download (common case) or retrieve an 110 // the download item if this is a new download (common case) or retrieve an
108 // existing download item if this is a resuming download. 111 // existing download item if this is a resuming download.
109 virtual DownloadItemImpl* GetOrCreateDownloadItem(DownloadCreateInfo* info); 112 virtual DownloadItemImpl* GetOrCreateDownloadItem(DownloadCreateInfo* info);
110 113
111 // Get next download id. 114 // Get next download id.
112 DownloadId GetNextId(); 115 DownloadId GetNextId();
113 116
114 // Called with the result of DownloadManagerDelegate::CheckForFileExistence. 117 // Called with the result of DownloadManagerDelegate::CheckForFileExistence.
115 // Updates the state of the file and then notifies this update to the file's 118 // Updates the state of the file and then notifies this update to the file's
116 // observer. 119 // observer.
117 void OnFileExistenceChecked(int32 download_id, bool result); 120 void OnFileExistenceChecked(int32 download_id, bool result);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 DownloadManagerDelegate* delegate_; 168 DownloadManagerDelegate* delegate_;
166 169
167 net::NetLog* net_log_; 170 net::NetLog* net_log_;
168 171
169 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); 172 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl);
170 }; 173 };
171 174
172 } // namespace content 175 } // namespace content
173 176
174 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ 177 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/download/download_item_impl.cc ('k') | content/browser/download/download_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698