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

Side by Side Diff: chrome/browser/extensions/api/image_writer_private/write_from_file_operation.cc

Issue 61643015: Adds imageWriterPrivate support for Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review feedback. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/file_util.h" 5 #include "base/file_util.h"
6 #include "chrome/browser/extensions/api/image_writer_private/error_messages.h" 6 #include "chrome/browser/extensions/api/image_writer_private/error_messages.h"
7 #include "chrome/browser/extensions/api/image_writer_private/write_from_file_ope ration.h" 7 #include "chrome/browser/extensions/api/image_writer_private/write_from_file_ope ration.h"
8 #include "content/public/browser/browser_thread.h" 8 #include "content/public/browser/browser_thread.h"
9 9
10 namespace extensions { 10 namespace extensions {
11 namespace image_writer { 11 namespace image_writer {
12 12
13 using content::BrowserThread; 13 using content::BrowserThread;
14 14
15 WriteFromFileOperation::WriteFromFileOperation( 15 WriteFromFileOperation::WriteFromFileOperation(
16 base::WeakPtr<OperationManager> manager, 16 base::WeakPtr<OperationManager> manager,
17 const ExtensionId& extension_id, 17 const ExtensionId& extension_id,
18 const base::FilePath& path, 18 const base::FilePath& path,
19 const std::string& storage_unit_id) 19 const std::string& storage_unit_id)
20 : Operation(manager, extension_id, storage_unit_id) { 20 : Operation(manager, extension_id, storage_unit_id) {
21 image_path_ = path; 21 image_path_ = path;
22 } 22 }
23 23
24 WriteFromFileOperation::~WriteFromFileOperation() { 24 WriteFromFileOperation::~WriteFromFileOperation() {
25 } 25 }
26 26
27 void WriteFromFileOperation::Start() { 27 void WriteFromFileOperation::Start() {
28 DVLOG(1) << "Starting file-to-usb write of " << image_path_.value()
29 << " to " << storage_unit_id_;
30
31 if (!base::PathExists(image_path_) || base::DirectoryExists(image_path_)) { 28 if (!base::PathExists(image_path_) || base::DirectoryExists(image_path_)) {
32 Error(error::kImageInvalid); 29 Error(error::kImageInvalid);
33 return; 30 return;
34 } 31 }
35 32
36 WriteStart(); 33 BrowserThread::PostTask(
34 BrowserThread::FILE,
35 FROM_HERE,
36 base::Bind(&WriteFromFileOperation::WriteStart, this));
37 } 37 }
38 38
39 } // namespace image_writer 39 } // namespace image_writer
40 } // namespace extensions 40 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698