app_list: Re-enable people search.
[chromium-blink-merge.git] / chrome / browser / extensions / api / image_writer_private / write_from_file_operation.cc
bloba80427854f8561e7c81f9e746af0e5259d9bb3e3
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
3 // found in the LICENSE file.
5 #include "base/files/file_util.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_operation.h"
8 #include "content/public/browser/browser_thread.h"
10 namespace extensions {
11 namespace image_writer {
13 using content::BrowserThread;
15 WriteFromFileOperation::WriteFromFileOperation(
16 base::WeakPtr<OperationManager> manager,
17 const ExtensionId& extension_id,
18 const base::FilePath& user_file_path,
19 const std::string& device_path)
20 : Operation(manager, extension_id, device_path) {
21 image_path_ = user_file_path;
24 WriteFromFileOperation::~WriteFromFileOperation() {}
26 void WriteFromFileOperation::StartImpl() {
27 if (!base::PathExists(image_path_) || base::DirectoryExists(image_path_)) {
28 DLOG(ERROR) << "Source must exist and not be a directory.";
29 Error(error::kImageInvalid);
30 return;
33 BrowserThread::PostTask(
34 BrowserThread::FILE,
35 FROM_HERE,
36 base::Bind(
37 &WriteFromFileOperation::Unzip,
38 this,
39 base::Bind(
40 &WriteFromFileOperation::Write,
41 this,
42 base::Bind(&WriteFromFileOperation::VerifyWrite,
43 this,
44 base::Bind(&WriteFromFileOperation::Finish, this)))));
47 } // namespace image_writer
48 } // namespace extensions