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

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

Issue 149313003: Significantly cleans up the ImageWriter Operation class and subclasses. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes cross-compilation and test issues. 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 839e1553abaf7dc3d63fa75530b6bd6493d312a2..34c5beaacd4fb09adec4c0a44d9d2635861c3bb5 100644
--- a/chrome/browser/extensions/api/image_writer_private/operation_manager.cc
+++ b/chrome/browser/extensions/api/image_writer_private/operation_manager.cc
@@ -59,10 +59,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);
@@ -73,11 +71,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,
@@ -88,7 +85,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);
@@ -96,11 +93,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,
@@ -126,7 +120,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);
@@ -134,10 +128,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,
@@ -149,7 +141,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