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

Unified Diff: ui/file_manager/zip_archiver/cpp/compressor_archive.h

Issue 2807063002: Replace Libarchive with MiniZip. (Closed)
Patch Set: Fix a few nits. Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: ui/file_manager/zip_archiver/cpp/compressor_archive.h
diff --git a/ui/file_manager/zip_archiver/cpp/compressor_archive.h b/ui/file_manager/zip_archiver/cpp/compressor_archive.h
index 3c9ff880261fde61c94f3a9c8a840b246c9b9059..4ce6ecbdb353dfc654e9e9ad21b301a732520251 100644
--- a/ui/file_manager/zip_archiver/cpp/compressor_archive.h
+++ b/ui/file_manager/zip_archiver/cpp/compressor_archive.h
@@ -17,38 +17,46 @@ class CompressorArchive {
virtual ~CompressorArchive() {}
// Creates an archive object. This method does not call CustomArchiveWrite, so
- // this is synchronous.
- virtual void CreateArchive() = 0;
+ // this is synchronous. Returns true if successful. In case of failure the
+ // error message can be obtained with CompressorArchive::error_message().
+ virtual bool CreateArchive() = 0;
- // Releases all resources obtained by libarchive.
+ // Releases all resources obtained by minizip.
// This method also writes metadata about the archive itself onto the end of
// the archive file before releasing resources if hasError is false. Since
// writing data onto the archive is asynchronous, this function must not be
- // called in the main thread if hasError is false.
- virtual void CloseArchive(bool has_error) = 0;
+ // called in the main thread if hasError is false. Returns true if successful.
+ // In case of failure the error message can be obtained with
+ // CompressorArchive::error_message().
+ virtual bool CloseArchive(bool has_error) = 0;
// Adds an entry to the archive. It writes the header of the entry onto the
// archive first, and then if it is a file(not a directory), requests
// JavaScript for file chunks, compresses and writes them onto the archive
// until all chunks of the entry are written onto the archive. This method
// calls IO operations, so this function must not be called in the main thread.
- virtual void AddToArchive(const std::string& filename,
+ // Returns true if successful. In case of failure the error message can be
+ // obtained with CompressorArchive::error_message().
+ virtual bool AddToArchive(const std::string& filename,
int64_t file_size,
- time_t modification_time,
+ int64_t modification_time,
bool is_directory) = 0;
- // A getter function for archive_.
- struct archive* archive() const { return archive_; }
-
// A getter function for compressor_stream_.
CompressorStream* compressor_stream() const { return compressor_stream_; }
- private:
- // The libarchive correspondent archive object.
- struct archive* archive_;
+ std::string error_message() const { return error_message_; }
+
+ void set_error_message(const std::string& error_message) {
+ error_message_ = error_message;
+ }
+ private:
// An instance that takes care of all IO operations.
CompressorStream* compressor_stream_;
+
+ // An error message set in case of any errors.
+ std::string error_message_;
};
#endif // COMPRESSSOR_ARCHIVE_H_
« no previous file with comments | « ui/file_manager/zip_archiver/cpp/compressor.cc ('k') | ui/file_manager/zip_archiver/cpp/compressor_archive_libarchive.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698