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

Unified Diff: chrome/utility/image_writer/image_writer_win.cc

Issue 294163008: Adds USB writing for OS X. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@list-devices
Patch Set: Minor updates. Created 6 years, 6 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/utility/image_writer/image_writer_win.cc
diff --git a/chrome/utility/image_writer/image_writer_win.cc b/chrome/utility/image_writer/image_writer_win.cc
index b3cec9507445bc47ec1e83f2869e6abb38dd3b04..1d6542e5e3f030e5659e7ecccd45ff32485203aa 100644
--- a/chrome/utility/image_writer/image_writer_win.cc
+++ b/chrome/utility/image_writer/image_writer_win.cc
@@ -55,7 +55,21 @@ bool ImageWriter::IsValidDevice() {
return device_descriptor->RemovableMedia == TRUE;
}
-bool ImageWriter::UnmountVolumes() {
+bool ImageWriter::OpenDevice() {
+ // Windows requires that device files be opened with FILE_FLAG_NO_BUFFERING
+ // and FILE_FLAG_WRITE_THROUGH. These two flags are not part of base::File.
+ device_file_ =
+ base::File(CreateFile(device_path_.value().c_str(),
+ GENERIC_READ | GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
+ NULL,
+ OPEN_EXISTING,
+ FILE_FLAG_NO_BUFFERING | FILE_FLAG_WRITE_THROUGH,
+ NULL));
+ return device_file_.IsValid();
+}
+
+void ImageWriter::UnmountVolumes(const base::Closure& continuation) {
if (!InitializeFiles()) {
return false;
}
@@ -177,7 +191,8 @@ bool ImageWriter::UnmountVolumes() {
FindVolumeClose(volume_finder);
}
- return success;
+ if (success)
+ callback.Run();
}
} // namespace image_writer

Powered by Google App Engine
This is Rietveld 408576698