| 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 "base/file_util.h" | 5 #include "base/file_util.h" |
| 6 #include "chrome/browser/extensions/api/image_writer_private/destroy_partitions_
operation.h" | 6 #include "chrome/browser/extensions/api/image_writer_private/destroy_partitions_
operation.h" |
| 7 #include "chrome/browser/extensions/api/image_writer_private/error_messages.h" | 7 #include "chrome/browser/extensions/api/image_writer_private/error_messages.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 // Number of bytes for the maximum partition table size. By wiping this many | 13 // Number of bytes for the maximum partition table size. GUID partition tables |
| 14 // bytes we can essentially guarantee the header and associated information will | 14 // reside in the second sector of the disk. Disks can have up to 4k sectors. |
| 15 // be wiped. See http://crbug.com/328246 for more information. | 15 // See http://crbug.com/328246 for more information. |
| 16 const int kPartitionTableSize = 1 * 1024; | 16 const int kPartitionTableSize = 2 * 4096; |
| 17 | 17 |
| 18 DestroyPartitionsOperation::DestroyPartitionsOperation( | 18 DestroyPartitionsOperation::DestroyPartitionsOperation( |
| 19 base::WeakPtr<OperationManager> manager, | 19 base::WeakPtr<OperationManager> manager, |
| 20 const ExtensionId& extension_id, | 20 const ExtensionId& extension_id, |
| 21 const std::string& storage_unit_id) | 21 const std::string& storage_unit_id) |
| 22 : Operation(manager, extension_id, storage_unit_id) {} | 22 : Operation(manager, extension_id, storage_unit_id) {} |
| 23 | 23 |
| 24 DestroyPartitionsOperation::~DestroyPartitionsOperation() {} | 24 DestroyPartitionsOperation::~DestroyPartitionsOperation() {} |
| 25 | 25 |
| 26 void DestroyPartitionsOperation::StartImpl() { | 26 void DestroyPartitionsOperation::StartImpl() { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 41 content::BrowserThread::PostTask( | 41 content::BrowserThread::PostTask( |
| 42 content::BrowserThread::FILE, | 42 content::BrowserThread::FILE, |
| 43 FROM_HERE, | 43 FROM_HERE, |
| 44 base::Bind(&DestroyPartitionsOperation::Write, | 44 base::Bind(&DestroyPartitionsOperation::Write, |
| 45 this, | 45 this, |
| 46 base::Bind(&DestroyPartitionsOperation::Finish, this))); | 46 base::Bind(&DestroyPartitionsOperation::Finish, this))); |
| 47 } | 47 } |
| 48 | 48 |
| 49 } // namespace image_writer | 49 } // namespace image_writer |
| 50 } // namespace extensions | 50 } // namespace extensions |
| OLD | NEW |