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

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

Issue 1549113002: Switch to standard integer types in content/browser/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 12 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 <stdint.h>
9
8 #include <map> 10 #include <map>
9 #include <set> 11 #include <set>
10 #include <string> 12 #include <string>
11 #include <vector> 13 #include <vector>
12 14
13 #include "base/callback_forward.h" 15 #include "base/callback_forward.h"
14 #include "base/containers/hash_tables.h" 16 #include "base/containers/hash_tables.h"
15 #include "base/macros.h" 17 #include "base/macros.h"
16 #include "base/memory/ref_counted.h" 18 #include "base/memory/ref_counted.h"
17 #include "base/memory/scoped_ptr.h" 19 #include "base/memory/scoped_ptr.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 base::Time remove_begin, 78 base::Time remove_begin,
77 base::Time remove_end) override; 79 base::Time remove_end) override;
78 int RemoveDownloadsBetween(base::Time remove_begin, 80 int RemoveDownloadsBetween(base::Time remove_begin,
79 base::Time remove_end) override; 81 base::Time remove_end) override;
80 int RemoveDownloads(base::Time remove_begin) override; 82 int RemoveDownloads(base::Time remove_begin) override;
81 int RemoveAllDownloads() override; 83 int RemoveAllDownloads() override;
82 void DownloadUrl(scoped_ptr<DownloadUrlParameters> params) override; 84 void DownloadUrl(scoped_ptr<DownloadUrlParameters> params) override;
83 void AddObserver(Observer* observer) override; 85 void AddObserver(Observer* observer) override;
84 void RemoveObserver(Observer* observer) override; 86 void RemoveObserver(Observer* observer) override;
85 content::DownloadItem* CreateDownloadItem( 87 content::DownloadItem* CreateDownloadItem(
86 uint32 id, 88 uint32_t id,
87 const base::FilePath& current_path, 89 const base::FilePath& current_path,
88 const base::FilePath& target_path, 90 const base::FilePath& target_path,
89 const std::vector<GURL>& url_chain, 91 const std::vector<GURL>& url_chain,
90 const GURL& referrer_url, 92 const GURL& referrer_url,
91 const std::string& mime_type, 93 const std::string& mime_type,
92 const std::string& original_mime_type, 94 const std::string& original_mime_type,
93 const base::Time& start_time, 95 const base::Time& start_time,
94 const base::Time& end_time, 96 const base::Time& end_time,
95 const std::string& etag, 97 const std::string& etag,
96 const std::string& last_modified, 98 const std::string& last_modified,
97 int64 received_bytes, 99 int64_t received_bytes,
98 int64 total_bytes, 100 int64_t total_bytes,
99 content::DownloadItem::DownloadState state, 101 content::DownloadItem::DownloadState state,
100 DownloadDangerType danger_type, 102 DownloadDangerType danger_type,
101 DownloadInterruptReason interrupt_reason, 103 DownloadInterruptReason interrupt_reason,
102 bool opened) override; 104 bool opened) override;
103 int InProgressCount() const override; 105 int InProgressCount() const override;
104 int NonMaliciousInProgressCount() const override; 106 int NonMaliciousInProgressCount() const override;
105 BrowserContext* GetBrowserContext() const override; 107 BrowserContext* GetBrowserContext() const override;
106 void CheckForHistoryFilesRemoval() override; 108 void CheckForHistoryFilesRemoval() override;
107 DownloadItem* GetDownload(uint32 id) override; 109 DownloadItem* GetDownload(uint32_t id) override;
108 110
109 // For testing; specifically, accessed from TestFileErrorInjector. 111 // For testing; specifically, accessed from TestFileErrorInjector.
110 void SetDownloadItemFactoryForTesting( 112 void SetDownloadItemFactoryForTesting(
111 scoped_ptr<DownloadItemFactory> item_factory); 113 scoped_ptr<DownloadItemFactory> item_factory);
112 void SetDownloadFileFactoryForTesting( 114 void SetDownloadFileFactoryForTesting(
113 scoped_ptr<DownloadFileFactory> file_factory); 115 scoped_ptr<DownloadFileFactory> file_factory);
114 virtual DownloadFileFactory* GetDownloadFileFactoryForTesting(); 116 virtual DownloadFileFactory* GetDownloadFileFactoryForTesting();
115 117
116 void RemoveUrlDownloader(UrlDownloader* downloader); 118 void RemoveUrlDownloader(UrlDownloader* downloader);
117 119
118 private: 120 private:
119 typedef std::set<DownloadItem*> DownloadSet; 121 typedef std::set<DownloadItem*> DownloadSet;
120 typedef base::hash_map<uint32, DownloadItemImpl*> DownloadMap; 122 typedef base::hash_map<uint32_t, DownloadItemImpl*> DownloadMap;
121 typedef std::vector<DownloadItemImpl*> DownloadItemImplVector; 123 typedef std::vector<DownloadItemImpl*> DownloadItemImplVector;
122 typedef base::Callback<bool(const DownloadItemImpl*)> DownloadRemover; 124 typedef base::Callback<bool(const DownloadItemImpl*)> DownloadRemover;
123 125
124 // For testing. 126 // For testing.
125 friend class DownloadManagerTest; 127 friend class DownloadManagerTest;
126 friend class DownloadTest; 128 friend class DownloadTest;
127 129
128 void StartDownloadWithId( 130 void StartDownloadWithId(
129 scoped_ptr<DownloadCreateInfo> info, 131 scoped_ptr<DownloadCreateInfo> info,
130 scoped_ptr<ByteStreamReader> stream, 132 scoped_ptr<ByteStreamReader> stream,
131 const DownloadUrlParameters::OnStartedCallback& on_started, 133 const DownloadUrlParameters::OnStartedCallback& on_started,
132 bool new_download, 134 bool new_download,
133 uint32 id); 135 uint32_t id);
134 136
135 void CreateSavePackageDownloadItemWithId( 137 void CreateSavePackageDownloadItemWithId(
136 const base::FilePath& main_file_path, 138 const base::FilePath& main_file_path,
137 const GURL& page_url, 139 const GURL& page_url,
138 const std::string& mime_type, 140 const std::string& mime_type,
139 scoped_ptr<DownloadRequestHandleInterface> request_handle, 141 scoped_ptr<DownloadRequestHandleInterface> request_handle,
140 const DownloadItemImplCreated& on_started, 142 const DownloadItemImplCreated& on_started,
141 uint32 id); 143 uint32_t id);
142 144
143 // Create a new active item based on the info. Separate from 145 // Create a new active item based on the info. Separate from
144 // StartDownload() for testing. 146 // StartDownload() for testing.
145 DownloadItemImpl* CreateActiveItem(uint32 id, 147 DownloadItemImpl* CreateActiveItem(uint32_t id,
146 const DownloadCreateInfo& info); 148 const DownloadCreateInfo& info);
147 149
148 // Get next download id. |callback| is called on the UI thread and may 150 // Get next download id. |callback| is called on the UI thread and may
149 // be called synchronously. 151 // be called synchronously.
150 void GetNextId(const DownloadIdCallback& callback); 152 void GetNextId(const DownloadIdCallback& callback);
151 153
152 // Called with the result of DownloadManagerDelegate::CheckForFileExistence. 154 // Called with the result of DownloadManagerDelegate::CheckForFileExistence.
153 // Updates the state of the file and then notifies this update to the file's 155 // Updates the state of the file and then notifies this update to the file's
154 // observer. 156 // observer.
155 void OnFileExistenceChecked(uint32 download_id, bool result); 157 void OnFileExistenceChecked(uint32_t download_id, bool result);
156 158
157 // Remove all downloads for which |remover| returns true. 159 // Remove all downloads for which |remover| returns true.
158 int RemoveDownloads(const DownloadRemover& remover); 160 int RemoveDownloads(const DownloadRemover& remover);
159 161
160 // Overridden from DownloadItemImplDelegate 162 // Overridden from DownloadItemImplDelegate
161 // (Note that |GetBrowserContext| are present in both interfaces.) 163 // (Note that |GetBrowserContext| are present in both interfaces.)
162 void DetermineDownloadTarget(DownloadItemImpl* item, 164 void DetermineDownloadTarget(DownloadItemImpl* item,
163 const DownloadTargetCallback& callback) override; 165 const DownloadTargetCallback& callback) override;
164 bool ShouldCompleteDownload(DownloadItemImpl* item, 166 bool ShouldCompleteDownload(DownloadItemImpl* item,
165 const base::Closure& complete_callback) override; 167 const base::Closure& complete_callback) override;
166 bool ShouldOpenFileBasedOnExtension(const base::FilePath& path) override; 168 bool ShouldOpenFileBasedOnExtension(const base::FilePath& path) override;
167 bool ShouldOpenDownload(DownloadItemImpl* item, 169 bool ShouldOpenDownload(DownloadItemImpl* item,
168 const ShouldOpenDownloadCallback& callback) override; 170 const ShouldOpenDownloadCallback& callback) override;
169 void CheckForFileRemoval(DownloadItemImpl* download_item) override; 171 void CheckForFileRemoval(DownloadItemImpl* download_item) override;
170 void ResumeInterruptedDownload( 172 void ResumeInterruptedDownload(
171 scoped_ptr<content::DownloadUrlParameters> params, 173 scoped_ptr<content::DownloadUrlParameters> params,
172 uint32 id) override; 174 uint32_t id) override;
173 void OpenDownload(DownloadItemImpl* download) override; 175 void OpenDownload(DownloadItemImpl* download) override;
174 void ShowDownloadInShell(DownloadItemImpl* download) override; 176 void ShowDownloadInShell(DownloadItemImpl* download) override;
175 void DownloadRemoved(DownloadItemImpl* download) override; 177 void DownloadRemoved(DownloadItemImpl* download) override;
176 178
177 void AddUrlDownloader( 179 void AddUrlDownloader(
178 scoped_ptr<UrlDownloader, BrowserThread::DeleteOnIOThread> downloader); 180 scoped_ptr<UrlDownloader, BrowserThread::DeleteOnIOThread> downloader);
179 181
180 // Factory for creation of downloads items. 182 // Factory for creation of downloads items.
181 scoped_ptr<DownloadItemFactory> item_factory_; 183 scoped_ptr<DownloadItemFactory> item_factory_;
182 184
(...skipping 26 matching lines...) Expand all
209 url_downloaders_; 211 url_downloaders_;
210 212
211 base::WeakPtrFactory<DownloadManagerImpl> weak_factory_; 213 base::WeakPtrFactory<DownloadManagerImpl> weak_factory_;
212 214
213 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); 215 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl);
214 }; 216 };
215 217
216 } // namespace content 218 } // namespace content
217 219
218 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ 220 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/download/download_item_impl_unittest.cc ('k') | content/browser/download/download_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698