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

Unified Diff: chrome/common/zip_reader.h

Issue 8873039: Add an API to unpack Zip files directly from and to file descriptors. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: More style fixes. Created 9 years 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
« no previous file with comments | « chrome/common/zip_internal.cc ('k') | chrome/common/zip_reader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/zip_reader.h
diff --git a/chrome/common/zip_reader.h b/chrome/common/zip_reader.h
index f77616ba9f96c7d4d74313b351dab1946b9b78f9..4d93d0c03fc478ff59d32097e7f632da0008c3bb 100644
--- a/chrome/common/zip_reader.h
+++ b/chrome/common/zip_reader.h
@@ -10,6 +10,7 @@
#include "base/basictypes.h"
#include "base/file_path.h"
+#include "base/file_util.h"
#include "base/memory/scoped_ptr.h"
#include "base/time.h"
#include "third_party/zlib/contrib/minizip/unzip.h"
@@ -77,6 +78,12 @@ class ZipReader {
// success.
bool Open(const FilePath& zip_file_path);
+#if defined(OS_POSIX)
+ // Opens the zip file referred to by the file descriptor |zip_fd|.
+ // Returns true on success.
+ bool OpenFromFd(int zip_fd);
+#endif
+
// Closes the currently opened zip file. This function is called in the
// destructor of the class, so you usually don't need to call this.
void Close();
@@ -125,6 +132,12 @@ class ZipReader {
// beforehand.
bool ExtractCurrentEntryIntoDirectory(const FilePath& output_directory_path);
+#if defined(OS_POSIX)
+ // Extracts the current entry by writing directly to a file descriptor.
+ // Does not close the file descriptor. Returns true on success.
+ bool ExtractCurrentEntryToFd(int fd);
+#endif
+
// Returns the current entry info. Returns NULL if the current entry is
// not yet opened. OpenCurrentEntryInZip() must be called beforehand.
EntryInfo* current_entry_info() const {
@@ -136,6 +149,9 @@ class ZipReader {
int num_entries() const { return num_entries_; }
private:
+ // Common code used both in Open and OpenFromFd.
+ bool OpenInternal();
+
// Resets the internal state.
void Reset();
« no previous file with comments | « chrome/common/zip_internal.cc ('k') | chrome/common/zip_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698