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

Unified Diff: chrome/browser/extensions/api/image_writer_private/operation_manager.cc

Issue 109793006: Adds ImageWriterPrivate.destroyPartitions operation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup Created 7 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
Index: chrome/browser/extensions/api/image_writer_private/operation_manager.cc
diff --git a/chrome/browser/extensions/api/image_writer_private/operation_manager.cc b/chrome/browser/extensions/api/image_writer_private/operation_manager.cc
index b1b1c44d06112f44ad2c78676829f1652b1c911c..7ae5585f9603b317c34c66caf880f52e35e1185d 100644
--- a/chrome/browser/extensions/api/image_writer_private/operation_manager.cc
+++ b/chrome/browser/extensions/api/image_writer_private/operation_manager.cc
@@ -5,6 +5,7 @@
#include "base/lazy_instance.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
+#include "chrome/browser/extensions/api/image_writer_private/destroy_partitions_operation.h"
#include "chrome/browser/extensions/api/image_writer_private/error_messages.h"
#include "chrome/browser/extensions/api/image_writer_private/operation.h"
#include "chrome/browser/extensions/api/image_writer_private/operation_manager.h"
@@ -132,6 +133,31 @@ void OperationManager::CancelWrite(
}
}
+void OperationManager::DestroyPartitions(
+ const ExtensionId& extension_id,
+ const std::string& storage_unit_id,
+ const Operation::StartWriteCallback& callback) {
+
tbarzic 2013/12/14 01:01:04 nuke the empty line
Drew Haven 2013/12/16 20:15:33 And I nuked a few others.
+ OperationMap::iterator existing_operation = operations_.find(extension_id);
+
+ if (existing_operation != operations_.end()) {
+ return callback.Run(false, error::kOperationAlreadyInProgress);
+ }
+
+ scoped_refptr<Operation> operation(
+ new DestroyPartitionsOperation(weak_factory_.GetWeakPtr(),
+ extension_id,
+ storage_unit_id));
+ operations_[extension_id] = operation;
+
+ BrowserThread::PostTask(BrowserThread::FILE,
+ FROM_HERE,
+ base::Bind(&Operation::Start,
+ operation.get()));
tbarzic 2013/12/14 01:01:04 I don't think you need get()
Drew Haven 2013/12/16 20:15:33 Indeed. I also fixed the other places this patter
+
+ callback.Run(true, "");
+}
+
void OperationManager::OnProgress(const ExtensionId& extension_id,
image_writer_api::Stage stage,
int progress) {

Powered by Google App Engine
This is Rietveld 408576698