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

Unified Diff: chrome/browser/extensions/api/image_writer_private/operation.h

Issue 92873003: Adds asynchronous unzip functions to ZipReader (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Uses the correct target for directory test. Created 6 years, 11 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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/image_writer_private/operation.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/image_writer_private/operation.h
diff --git a/chrome/browser/extensions/api/image_writer_private/operation.h b/chrome/browser/extensions/api/image_writer_private/operation.h
index ce62f65d17196e37ad3e1002d4c67171831d76d1..80092cfa59a807f4e683a458ef76a47a531aef52 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_;
« no previous file with comments | « no previous file | chrome/browser/extensions/api/image_writer_private/operation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698