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

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

Issue 10263019: DownloadManagerDelegate::ShouldCompleteDownload(callback) (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: merge Created 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/chrome_browser.gypi ('k') | content/browser/download/download_manager_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_ITEM_IMPL_H_ 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_
6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 virtual void DangerousDownloadValidated() OVERRIDE; 122 virtual void DangerousDownloadValidated() OVERRIDE;
123 virtual void UpdateProgress(int64 bytes_so_far, 123 virtual void UpdateProgress(int64 bytes_so_far,
124 int64 bytes_per_sec, 124 int64 bytes_per_sec,
125 const std::string& hash_state) OVERRIDE; 125 const std::string& hash_state) OVERRIDE;
126 virtual void Cancel(bool user_cancel) OVERRIDE; 126 virtual void Cancel(bool user_cancel) OVERRIDE;
127 virtual void MarkAsComplete() OVERRIDE; 127 virtual void MarkAsComplete() OVERRIDE;
128 virtual void DelayedDownloadOpened() OVERRIDE; 128 virtual void DelayedDownloadOpened() OVERRIDE;
129 virtual void OnAllDataSaved( 129 virtual void OnAllDataSaved(
130 int64 size, const std::string& final_hash) OVERRIDE; 130 int64 size, const std::string& final_hash) OVERRIDE;
131 virtual void OnDownloadedFileRemoved() OVERRIDE; 131 virtual void OnDownloadedFileRemoved() OVERRIDE;
132 virtual void MaybeCompleteDownload() OVERRIDE;
133 virtual void Interrupted(int64 size, 132 virtual void Interrupted(int64 size,
134 const std::string& hash_state, 133 const std::string& hash_state,
135 content::DownloadInterruptReason reason) OVERRIDE; 134 content::DownloadInterruptReason reason) OVERRIDE;
136 virtual void Delete(DeleteReason reason) OVERRIDE; 135 virtual void Delete(DeleteReason reason) OVERRIDE;
137 virtual void Remove() OVERRIDE; 136 virtual void Remove() OVERRIDE;
138 virtual bool TimeRemaining(base::TimeDelta* remaining) const OVERRIDE; 137 virtual bool TimeRemaining(base::TimeDelta* remaining) const OVERRIDE;
139 virtual int64 CurrentSpeed() const OVERRIDE; 138 virtual int64 CurrentSpeed() const OVERRIDE;
140 virtual int PercentComplete() const OVERRIDE; 139 virtual int PercentComplete() const OVERRIDE;
141 virtual void OnPathDetermined(const FilePath& path) OVERRIDE; 140 virtual void OnPathDetermined(const FilePath& path) OVERRIDE;
142 virtual bool AllDataSaved() const OVERRIDE; 141 virtual bool AllDataSaved() const OVERRIDE;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 // Construction common to all constructors. |active| should be true for new 217 // Construction common to all constructors. |active| should be true for new
219 // downloads and false for downloads from the history. 218 // downloads and false for downloads from the history.
220 // |download_type| indicates to the net log system what kind of download 219 // |download_type| indicates to the net log system what kind of download
221 // this is. 220 // this is.
222 void Init(bool active, download_net_logs::DownloadType download_type); 221 void Init(bool active, download_net_logs::DownloadType download_type);
223 222
224 // Internal helper for maintaining consistent received and total sizes, and 223 // Internal helper for maintaining consistent received and total sizes, and
225 // hash state. 224 // hash state.
226 void UpdateProgress(int64 bytes_so_far, const std::string& hash_state); 225 void UpdateProgress(int64 bytes_so_far, const std::string& hash_state);
227 226
227 // If all pre-requisites have been met, complete download processing, i.e. do
228 // internal cleanup, file rename, and potentially auto-open. (Dangerous
229 // downloads still may block on user acceptance after this point.)
230 void MaybeCompleteDownload();
231
228 // Internal helper for maintaining consistent received and total sizes, and 232 // Internal helper for maintaining consistent received and total sizes, and
229 // setting the final hash. 233 // setting the final hash.
230 // Should only be called from |OnAllDataSaved|. 234 // Should only be called from |OnAllDataSaved|.
231 void ProgressComplete(int64 bytes_so_far, 235 void ProgressComplete(int64 bytes_so_far,
232 const std::string& final_hash); 236 const std::string& final_hash);
233 237
234 // Called when the entire download operation (including renaming etc) 238 // Called when the entire download operation (including renaming etc)
235 // is completed. 239 // is completed.
236 void Completed(); 240 void Completed();
237 241
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 // are owned by the DownloadItemImpl. 391 // are owned by the DownloadItemImpl.
388 std::map<const void*, ExternalData*> external_data_map_; 392 std::map<const void*, ExternalData*> external_data_map_;
389 393
390 // Net log to use for this download. 394 // Net log to use for this download.
391 const net::BoundNetLog bound_net_log_; 395 const net::BoundNetLog bound_net_log_;
392 396
393 DISALLOW_COPY_AND_ASSIGN(DownloadItemImpl); 397 DISALLOW_COPY_AND_ASSIGN(DownloadItemImpl);
394 }; 398 };
395 399
396 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ 400 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_
OLDNEW
« no previous file with comments | « chrome/chrome_browser.gypi ('k') | content/browser/download/download_manager_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698