summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/api/image_writer_private/operation.h
diff options
context:
space:
mode:
authorhaven@chromium.org <haven@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-17 00:36:28 +0000
committerhaven@chromium.org <haven@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-17 00:36:28 +0000
commitec6524fe9b25cea3c1bfa05d8b816966edea0d88 (patch)
treebf73b45525eedbf916beaed50f5b17d7fa9955d5 /chrome/browser/extensions/api/image_writer_private/operation.h
parentf791d5dc5945d2410264922389399b9300d7f256 (diff)
downloadchromium_src-ec6524fe9b25cea3c1bfa05d8b816966edea0d88.zip
chromium_src-ec6524fe9b25cea3c1bfa05d8b816966edea0d88.tar.gz
chromium_src-ec6524fe9b25cea3c1bfa05d8b816966edea0d88.tar.bz2
Adds asynchronous unzip functions to ZipReader
Updates ImageWriterPrivate to use the new asynchronous functions. BUG=324091 Review URL: https://codereview.chromium.org/92873003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@245393 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/api/image_writer_private/operation.h')
-rw-r--r--chrome/browser/extensions/api/image_writer_private/operation.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/chrome/browser/extensions/api/image_writer_private/operation.h b/chrome/browser/extensions/api/image_writer_private/operation.h
index ce62f65..80092cfa 100644
--- a/chrome/browser/extensions/api/image_writer_private/operation.h
+++ b/chrome/browser/extensions/api/image_writer_private/operation.h
@@ -13,6 +13,7 @@
#include "chrome/browser/extensions/api/image_writer_private/image_writer_utils.h"
#include "chrome/common/cancelable_task_tracker.h"
#include "chrome/common/extensions/api/image_writer_private.h"
+#include "third_party/zlib/google/zip_reader.h"
namespace image_writer_api = extensions::api::image_writer_private;
@@ -37,8 +38,7 @@ class OperationManager;
// Run, Complete. Start and Complete run on the UI thread and are responsible
// for advancing to the next stage and other UI interaction. The Run phase does
// the work on the FILE thread and calls SendProgress or Error as appropriate.
-class Operation
- : public base::RefCountedThreadSafe<Operation> {
+class Operation : public base::RefCountedThreadSafe<Operation> {
public:
typedef base::Callback<void(bool, const std::string&)> StartWriteCallback;
typedef base::Callback<void(bool, const std::string&)> CancelWriteCallback;
@@ -143,6 +143,7 @@ class Operation
void OnBurnError();
#endif
+ // Incrementally calculates the MD5 sum of a file.
void MD5Chunk(scoped_ptr<image_writer_utils::ImageReader> reader,
int64 bytes_processed,
int64 bytes_total,
@@ -150,6 +151,11 @@ class Operation
int progress_scale,
const base::Callback<void(scoped_ptr<std::string>)>& callback);
+ // Callbacks for zip::ZipReader.
+ void OnUnzipSuccess();
+ void OnUnzipFailure();
+ void OnUnzipProgress(int64 total_bytes, int64 progress_bytes);
+
// Runs all cleanup functions.
void CleanUp();
@@ -162,6 +168,9 @@ class Operation
// memory here. This requires that we only do one MD5 sum at a time.
base::MD5Context md5_context_;
+ // Zip reader for unzip operations.
+ zip::ZipReader zip_reader_;
+
// CleanUp operations that must be run. All these functions are run on the
// FILE thread.
std::vector<base::Closure> cleanup_functions_;