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

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

Issue 125273006: Revert of Resubmit of imageWriterPrivate.destroyPartitions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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 2b525e56389cd718d3a4e58f531ecf068e90ab7f..b1b1c44d06112f44ad2c78676829f1652b1c911c 100644
--- a/chrome/browser/extensions/api/image_writer_private/operation_manager.cc
+++ b/chrome/browser/extensions/api/image_writer_private/operation_manager.cc
@@ -5,7 +5,6 @@
#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"
@@ -64,6 +63,7 @@
bool saveImageAsDownload,
const std::string& storage_unit_id,
const Operation::StartWriteCallback& callback) {
+
OperationMap::iterator existing_operation = operations_.find(extension_id);
if (existing_operation != operations_.end()) {
@@ -78,10 +78,14 @@
hash,
saveImageAsDownload,
storage_unit_id));
+
operations_[extension_id] = operation;
+
BrowserThread::PostTask(BrowserThread::FILE,
FROM_HERE,
- base::Bind(&Operation::Start, operation));
+ base::Bind(&Operation::Start,
+ operation.get()));
+
callback.Run(true, "");
}
@@ -101,10 +105,14 @@
extension_id,
path,
storage_unit_id));
+
operations_[extension_id] = operation;
+
BrowserThread::PostTask(BrowserThread::FILE,
FROM_HERE,
- base::Bind(&Operation::Start, operation));
+ base::Bind(&Operation::Start,
+ operation.get()));
+
callback.Run(true, "");
}
@@ -124,27 +132,6 @@
}
}
-void OperationManager::DestroyPartitions(
- const ExtensionId& extension_id,
- const std::string& storage_unit_id,
- const Operation::StartWriteCallback& callback) {
- 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));
- 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