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

Unified Diff: content/browser/download/save_file.h

Issue 8372034: Created an interface for DownloadFile, for use in unit tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaned up download file interface and unit test class. Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/download/save_file.h
diff --git a/content/browser/download/save_file.h b/content/browser/download/save_file.h
index e7faaeb607fea6a278653ae3f5bc3aecb4dbb5c0..bfbe901b6f7c358277e619e1d8cbaf9e4178d13e 100644
--- a/content/browser/download/save_file.h
+++ b/content/browser/download/save_file.h
@@ -19,11 +19,35 @@
// the saving job is 'in progress': once the saving job has been completed or
// canceled, the SaveFile is destroyed. One SaveFile object represents one item
// in a save session.
-class SaveFile : public BaseFile {
+class SaveFile {
public:
explicit SaveFile(const SaveFileCreateInfo* info);
virtual ~SaveFile();
+ // BaseFile delegated functions.
Randy Smith (Not in Mondays) 2011/11/10 21:58:43 nit: As I understand chrome custom (and I think th
ahendrickson 2011/11/13 00:50:21 Done.
+ net::Error Initialize(bool calculate_hash) {
+ return file_.Initialize(calculate_hash);
+ }
+ net::Error AppendDataToFile(const char* data, size_t data_len) {
+ return file_.AppendDataToFile(data, data_len);
+ }
+ net::Error Rename(const FilePath& full_path) {
+ return file_.Rename(full_path);
+ }
+ void Detach() { file_.Detach(); }
+ void Cancel() { file_.Cancel(); }
+ void Finish() { file_.Finish(); }
+ void AnnotateWithSourceInformation() {
+ file_.AnnotateWithSourceInformation();
+ }
+ FilePath full_path() const { return file_.full_path(); }
+ bool in_progress() const { return file_.in_progress(); }
+ int64 bytes_so_far() const { return file_.bytes_so_far(); }
+ bool GetSha256Hash(std::string* hash) {
+ return file_.GetSha256Hash(hash);
+ }
+ std::string DebugString() const { return file_.DebugString(); }
+
// Accessors.
int save_id() const { return info_->save_id; }
int render_process_id() const { return info_->render_process_id; }
@@ -34,6 +58,7 @@ class SaveFile : public BaseFile {
}
private:
+ BaseFile file_;
scoped_ptr<const SaveFileCreateInfo> info_;
DISALLOW_COPY_AND_ASSIGN(SaveFile);

Powered by Google App Engine
This is Rietveld 408576698