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

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

Issue 170713007: Resubmit of 149313003: Significantly cleans up the ImageWriter Operation class and subclasses. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes comments. Created 6 years, 10 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 dd840d4850b1ac5199c0034437080c43db5ed05e..9f1aec30d66cefe9de5bcf9d9db2be898dc59b56 100644
--- a/chrome/browser/extensions/api/image_writer_private/operation_manager.cc
+++ b/chrome/browser/extensions/api/image_writer_private/operation_manager.cc
@@ -58,10 +58,8 @@ void OperationManager::Shutdown() {
void OperationManager::StartWriteFromUrl(
const ExtensionId& extension_id,
GURL url,
- content::RenderViewHost* rvh,
const std::string& hash,
- bool saveImageAsDownload,
- const std::string& storage_unit_id,
+ const std::string& device_path,
const Operation::StartWriteCallback& callback) {
OperationMap::iterator existing_operation = operations_.find(extension_id);
@@ -72,11 +70,10 @@ void OperationManager::StartWriteFromUrl(
scoped_refptr<Operation> operation(
new WriteFromUrlOperation(weak_factory_.GetWeakPtr(),
extension_id,
- rvh,
+ profile_->GetRequestContext(),
url,
hash,
- saveImageAsDownload,
- storage_unit_id));
+ device_path));
operations_[extension_id] = operation;
BrowserThread::PostTask(BrowserThread::FILE,
FROM_HERE,
@@ -87,7 +84,7 @@ void OperationManager::StartWriteFromUrl(
void OperationManager::StartWriteFromFile(
const ExtensionId& extension_id,
const base::FilePath& path,
- const std::string& storage_unit_id,
+ const std::string& device_path,
const Operation::StartWriteCallback& callback) {
OperationMap::iterator existing_operation = operations_.find(extension_id);
@@ -95,11 +92,8 @@ void OperationManager::StartWriteFromFile(
return callback.Run(false, error::kOperationAlreadyInProgress);
}
- scoped_refptr<Operation> operation(
- new WriteFromFileOperation(weak_factory_.GetWeakPtr(),
- extension_id,
- path,
- storage_unit_id));
+ scoped_refptr<Operation> operation(new WriteFromFileOperation(
+ weak_factory_.GetWeakPtr(), extension_id, path, device_path));
operations_[extension_id] = operation;
BrowserThread::PostTask(BrowserThread::FILE,
FROM_HERE,
@@ -125,7 +119,7 @@ void OperationManager::CancelWrite(
void OperationManager::DestroyPartitions(
const ExtensionId& extension_id,
- const std::string& storage_unit_id,
+ const std::string& device_path,
const Operation::StartWriteCallback& callback) {
OperationMap::iterator existing_operation = operations_.find(extension_id);
@@ -133,10 +127,8 @@ void OperationManager::DestroyPartitions(
return callback.Run(false, error::kOperationAlreadyInProgress);
}
- scoped_refptr<Operation> operation(
- new DestroyPartitionsOperation(weak_factory_.GetWeakPtr(),
- extension_id,
- storage_unit_id));
+ scoped_refptr<Operation> operation(new DestroyPartitionsOperation(
+ weak_factory_.GetWeakPtr(), extension_id, device_path));
operations_[extension_id] = operation;
BrowserThread::PostTask(BrowserThread::FILE,
FROM_HERE,
@@ -148,7 +140,6 @@ void OperationManager::OnProgress(const ExtensionId& extension_id,
image_writer_api::Stage stage,
int progress) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- DVLOG(2) << "progress - " << stage << " at " << progress << "%";
image_writer_api::ProgressInfo info;
info.stage = stage;

Powered by Google App Engine
This is Rietveld 408576698