OLD | NEW |
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 { |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 WriteFromFileOperation::~WriteFromFileOperation() {} | 24 WriteFromFileOperation::~WriteFromFileOperation() {} |
25 | 25 |
26 void WriteFromFileOperation::StartImpl() { | 26 void WriteFromFileOperation::StartImpl() { |
27 if (!base::PathExists(image_path_) || base::DirectoryExists(image_path_)) { | 27 if (!base::PathExists(image_path_) || base::DirectoryExists(image_path_)) { |
28 DLOG(ERROR) << "Source must exist and not be a directory."; | 28 DLOG(ERROR) << "Source must exist and not be a directory."; |
29 Error(error::kImageInvalid); | 29 Error(error::kImageInvalid); |
30 return; | 30 return; |
31 } | 31 } |
32 | 32 |
33 BrowserThread::PostTask( | 33 Unzip(base::Bind( |
34 BrowserThread::FILE, | 34 &WriteFromFileOperation::Write, |
35 FROM_HERE, | 35 this, |
36 base::Bind( | 36 base::Bind(&WriteFromFileOperation::VerifyWrite, |
37 &WriteFromFileOperation::Unzip, | 37 this, |
38 this, | 38 base::Bind(&WriteFromFileOperation::Finish, this)))); |
39 base::Bind( | |
40 &WriteFromFileOperation::Write, | |
41 this, | |
42 base::Bind(&WriteFromFileOperation::VerifyWrite, | |
43 this, | |
44 base::Bind(&WriteFromFileOperation::Finish, this))))); | |
45 } | 39 } |
46 | 40 |
47 } // namespace image_writer | 41 } // namespace image_writer |
48 } // namespace extensions | 42 } // namespace extensions |
OLD | NEW |