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

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

Issue 2742093002: Glue parallel download job and download file together. (Closed)
Patch Set: Rebase, and adjust unittests with recent landed CLs. Created 3 years, 9 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_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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 virtual ~DownloadFile() {} 44 virtual ~DownloadFile() {}
45 45
46 // Upon completion, |callback| will be called on the UI 46 // Upon completion, |callback| will be called on the UI
47 // thread as per the comment above, passing DOWNLOAD_INTERRUPT_REASON_NONE 47 // thread as per the comment above, passing DOWNLOAD_INTERRUPT_REASON_NONE
48 // on success, or a network download interrupt reason on failure. 48 // on success, or a network download interrupt reason on failure.
49 virtual void Initialize(const InitializeCallback& callback) = 0; 49 virtual void Initialize(const InitializeCallback& callback) = 0;
50 50
51 // Add a byte stream reader to write into a slice of the file, used for 51 // Add a byte stream reader to write into a slice of the file, used for
52 // parallel download. Called on the file thread. 52 // parallel download. Called on the file thread.
53 virtual void AddByteStream(std::unique_ptr<ByteStreamReader> stream_reader, 53 virtual void AddByteStream(std::unique_ptr<ByteStreamReader> stream_reader,
54 int64_t offset) = 0; 54 int64_t offset,
55 int64_t length) = 0;
55 56
56 // Rename the download file to |full_path|. If that file exists 57 // Rename the download file to |full_path|. If that file exists
57 // |full_path| will be uniquified by suffixing " (<number>)" to the 58 // |full_path| will be uniquified by suffixing " (<number>)" to the
58 // file name before the extension. 59 // file name before the extension.
59 virtual void RenameAndUniquify(const base::FilePath& full_path, 60 virtual void RenameAndUniquify(const base::FilePath& full_path,
60 const RenameCompletionCallback& callback) = 0; 61 const RenameCompletionCallback& callback) = 0;
61 62
62 // Rename the download file to |full_path| and annotate it with 63 // Rename the download file to |full_path| and annotate it with
63 // "Mark of the Web" information about its source. No uniquification 64 // "Mark of the Web" information about its source. No uniquification
64 // will be performed. 65 // will be performed.
65 virtual void RenameAndAnnotate(const base::FilePath& full_path, 66 virtual void RenameAndAnnotate(const base::FilePath& full_path,
66 const std::string& client_guid, 67 const std::string& client_guid,
67 const GURL& source_url, 68 const GURL& source_url,
68 const GURL& referrer_url, 69 const GURL& referrer_url,
69 const RenameCompletionCallback& callback) = 0; 70 const RenameCompletionCallback& callback) = 0;
70 71
71 // Detach the file so it is not deleted on destruction. 72 // Detach the file so it is not deleted on destruction.
72 virtual void Detach() = 0; 73 virtual void Detach() = 0;
73 74
74 // Abort the download and automatically close the file. 75 // Abort the download and automatically close the file.
75 virtual void Cancel() = 0; 76 virtual void Cancel() = 0;
76 77
77 virtual const base::FilePath& FullPath() const = 0; 78 virtual const base::FilePath& FullPath() const = 0;
78 virtual bool InProgress() const = 0; 79 virtual bool InProgress() 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
« no previous file with comments | « content/browser/download/download_create_info.cc ('k') | content/browser/download/download_file_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698