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

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

Issue 10950015: Shift "commit point" for when a download will no longer accept cancels. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporated comments. Created 8 years, 3 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_FILE_H_ 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H_
6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H_ 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 15 matching lines...) Expand all
26 public: 26 public:
27 // Callback used with Rename(). On a successful rename |reason| will be 27 // Callback used with Rename(). On a successful rename |reason| will be
28 // DOWNLOAD_INTERRUPT_REASON_NONE and |path| the path the rename 28 // DOWNLOAD_INTERRUPT_REASON_NONE and |path| the path the rename
29 // was done to. On a failed rename, |reason| will contain the 29 // was done to. On a failed rename, |reason| will contain the
30 // error. 30 // error.
31 typedef base::Callback<void(content::DownloadInterruptReason reason, 31 typedef base::Callback<void(content::DownloadInterruptReason reason,
32 const FilePath& path)> RenameCompletionCallback; 32 const FilePath& path)> RenameCompletionCallback;
33 33
34 virtual ~DownloadFile() {} 34 virtual ~DownloadFile() {}
35 35
36 // If calculate_hash is true, sha256 hash will be calculated.
37 // Returns DOWNLOAD_INTERRUPT_REASON_NONE on success, or a network 36 // Returns DOWNLOAD_INTERRUPT_REASON_NONE on success, or a network
38 // error code on failure. 37 // error code on failure. Upon completion, |callback| will be
39 virtual DownloadInterruptReason Initialize() = 0; 38 // called on the UI thread as per the comment above.
39 virtual content::DownloadInterruptReason Initialize() = 0;
asanka 2012/09/20 18:42:15 Nit: No content:: namespace qualifier needed in co
Randy Smith (Not in Mondays) 2012/09/21 21:58:01 Done.
40 40
41 // Rename the download file to |full_path|. If that file exists and 41 // Rename the download file to |full_path|. If that file exists and
42 // |overwrite_existing_file| is false, |full_path| will be uniquified by 42 // |overwrite_existing_file| is false, |full_path| will be uniquified by
43 // suffixing " (<number>)" to the file name before the extension. 43 // suffixing " (<number>)" to the file name before the extension.
44 // Upon completion, |callback| will be called on the UI thread 44 // Upon completion, |callback| will be called on the UI thread
45 // as per the comment above. 45 // as per the comment above.
46 virtual void Rename(const FilePath& full_path, 46 virtual void Rename(const FilePath& full_path,
47 bool overwrite_existing_file, 47 bool overwrite_existing_file,
48 const RenameCompletionCallback& callback) = 0; 48 const RenameCompletionCallback& callback) = 0;
49 49
50 // Detach the file so it is not deleted on destruction. 50 // Detach the file so it is not deleted on destruction.
51 virtual void Detach() = 0; 51 // |callback| will be called on the UI thread after detach.
52 virtual void Detach(base::Closure callback) = 0;
52 53
53 // Abort the download and automatically close the file. 54 // Abort the download and automatically close the file.
54 virtual void Cancel() = 0; 55 virtual void Cancel() = 0;
55 56
56 // Informs the OS that this file came from the internet. 57 // Informs the OS that this file came from the internet.
57 virtual void AnnotateWithSourceInformation() = 0; 58 virtual void AnnotateWithSourceInformation() = 0;
58 59
59 virtual FilePath FullPath() const = 0; 60 virtual FilePath FullPath() const = 0;
60 virtual bool InProgress() const = 0; 61 virtual bool InProgress() const = 0;
61 virtual int64 BytesSoFar() const = 0; 62 virtual int64 BytesSoFar() const = 0;
(...skipping 12 matching lines...) Expand all
74 virtual int Id() const = 0; 75 virtual int Id() const = 0;
75 virtual DownloadManager* GetDownloadManager() = 0; 76 virtual DownloadManager* GetDownloadManager() = 0;
76 virtual const DownloadId& GlobalId() const = 0; 77 virtual const DownloadId& GlobalId() const = 0;
77 78
78 virtual std::string DebugString() const = 0; 79 virtual std::string DebugString() const = 0;
79 }; 80 };
80 81
81 } // namespace content 82 } // namespace content
82 83
83 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H_ 84 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698