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

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

Issue 170123002: Revert of Significantly cleans up the ImageWriter Operation class and subclasses. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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_chromeos.cc
diff --git a/chrome/browser/extensions/api/image_writer_private/operation_chromeos.cc b/chrome/browser/extensions/api/image_writer_private/operation_chromeos.cc
index d7fe5ecc5be3453efb22132365bbfdf8d18f382b..d05ef9b1e368a2b71c89b7a8405f2183a9e811e8 100644
--- a/chrome/browser/extensions/api/image_writer_private/operation_chromeos.cc
+++ b/chrome/browser/extensions/api/image_writer_private/operation_chromeos.cc
@@ -31,56 +31,49 @@
} // namespace
-void Operation::Write(const base::Closure& continuation) {
+void Operation::WriteStart() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
SetStage(image_writer_api::STAGE_WRITE);
- BrowserThread::PostTask(
- BrowserThread::UI,
- FROM_HERE,
- base::Bind(&Operation::StartWriteOnUIThread, this, continuation));
+ BrowserThread::PostTask(BrowserThread::UI,
+ FROM_HERE,
+ base::Bind(&Operation::StartWriteOnUIThread, this));
AddCleanUpFunction(base::Bind(&ClearImageBurner));
}
-void Operation::VerifyWrite(const base::Closure& continuation) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
-
- // No verification is available in Chrome OS currently.
- continuation.Run();
-}
-
-void Operation::StartWriteOnUIThread(const base::Closure& continuation) {
+void Operation::StartWriteOnUIThread() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DVLOG(1) << "Starting burn.";
ImageBurnerClient* burner =
chromeos::DBusThreadManager::Get()->GetImageBurnerClient();
burner->SetEventHandlers(
- base::Bind(&Operation::OnBurnFinished, this, continuation),
+ base::Bind(&Operation::OnBurnFinished, this),
base::Bind(&Operation::OnBurnProgress, this));
burner->BurnImage(image_path_.value(),
- device_path_.value(),
+ storage_unit_id_,
base::Bind(&Operation::OnBurnError, this));
}
-void Operation::OnBurnFinished(const base::Closure& continuation,
- const std::string& target_path,
- bool success,
- const std::string& error) {
+void Operation::OnBurnFinished(const std::string& target_path,
+ bool success,
+ const std::string& error) {
+ DVLOG(1) << "Burn finished: " << success;
+
if (success) {
SetProgress(kProgressComplete);
- BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, continuation);
+ Finish();
} else {
- DLOG(ERROR) << "Error encountered while burning: " << error;
- Error(error::kChromeOSImageBurnerError);
+ Error(error);
}
}
void Operation::OnBurnProgress(const std::string& target_path,
- int64 num_bytes_burnt,
- int64 total_size) {
+ int64 num_bytes_burnt,
+ int64 total_size) {
int progress = kProgressComplete * num_bytes_burnt / total_size;
SetProgress(progress);
}

Powered by Google App Engine
This is Rietveld 408576698