OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <string.h> | 5 #include <string.h> |
6 | 6 |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "chrome/browser/extensions/api/image_writer_private/destroy_partitions_
operation.h" | 8 #include "chrome/browser/extensions/api/image_writer_private/destroy_partitions_
operation.h" |
9 #include "chrome/browser/extensions/api/image_writer_private/error_messages.h" | 9 #include "chrome/browser/extensions/api/image_writer_private/error_messages.h" |
10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 std::unique_ptr<char[]> buffer(new char[kPartitionTableSize]); | 35 std::unique_ptr<char[]> buffer(new char[kPartitionTableSize]); |
36 memset(buffer.get(), 0, kPartitionTableSize); | 36 memset(buffer.get(), 0, kPartitionTableSize); |
37 | 37 |
38 if (base::WriteFile(image_path_, buffer.get(), kPartitionTableSize) != | 38 if (base::WriteFile(image_path_, buffer.get(), kPartitionTableSize) != |
39 kPartitionTableSize) { | 39 kPartitionTableSize) { |
40 Error(error::kTempFileError); | 40 Error(error::kTempFileError); |
41 return; | 41 return; |
42 } | 42 } |
43 | 43 |
44 content::BrowserThread::PostTask( | 44 content::BrowserThread::PostTask( |
45 content::BrowserThread::FILE, | 45 content::BrowserThread::FILE, FROM_HERE, |
46 FROM_HERE, | 46 base::BindOnce(&DestroyPartitionsOperation::Write, this, |
47 base::Bind(&DestroyPartitionsOperation::Write, | 47 base::Bind(&DestroyPartitionsOperation::Finish, this))); |
48 this, | |
49 base::Bind(&DestroyPartitionsOperation::Finish, this))); | |
50 } | 48 } |
51 | 49 |
52 } // namespace image_writer | 50 } // namespace image_writer |
53 } // namespace extensions | 51 } // namespace extensions |
OLD | NEW |