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

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

Issue 294163008: Adds USB writing for OS X. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@list-devices
Patch Set: Fixes windows compilation. 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
« no previous file with comments | « chrome/utility/image_writer/image_writer.h ('k') | chrome/utility/image_writer/image_writer_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/utility/image_writer/image_writer.cc
diff --git a/chrome/utility/image_writer/image_writer.cc b/chrome/utility/image_writer/image_writer.cc
index 13175d7624f043327460e672e36221b2b9576ba3..65994dbcb6a89fe8b9178443e1fcbe7f21b4feda 100644
--- a/chrome/utility/image_writer/image_writer.cc
+++ b/chrome/utility/image_writer/image_writer.cc
@@ -2,12 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/utility/image_writer/image_writer.h"
+
#include "base/memory/aligned_memory.h"
#include "chrome/utility/image_writer/error_messages.h"
-#include "chrome/utility/image_writer/image_writer.h"
#include "chrome/utility/image_writer/image_writer_handler.h"
#include "content/public/utility/utility_thread.h"
+#if defined(OS_MACOSX)
+#include "chrome/utility/image_writer/disk_unmounter_mac.h"
+#endif
+
namespace image_writer {
// Since block devices like large sequential access and IPC is expensive we're
@@ -90,24 +95,7 @@ bool ImageWriter::InitializeFiles() {
}
if (!device_file_.IsValid()) {
-#if defined(OS_WIN)
- // 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));
-#else
- device_file_.Initialize(
- device_path_,
- base::File::FLAG_OPEN | base::File::FLAG_READ | base::File::FLAG_WRITE |
- base::File::FLAG_EXCLUSIVE_READ | base::File::FLAG_EXCLUSIVE_WRITE);
-#endif
- if (!device_file_.IsValid()) {
+ if (!OpenDevice()) {
Error(error::kOpenDevice);
return false;
}
« no previous file with comments | « chrome/utility/image_writer/image_writer.h ('k') | chrome/utility/image_writer/image_writer_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698