| 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 #ifndef CHROME_UTILITY_IMAGE_WRITER_IMAGE_WRITER_H_ | 5 #ifndef CHROME_UTILITY_IMAGE_WRITER_IMAGE_WRITER_H_ |
| 6 #define CHROME_UTILITY_IMAGE_WRITER_IMAGE_WRITER_H_ | 6 #define CHROME_UTILITY_IMAGE_WRITER_IMAGE_WRITER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 8 #include <vector> | 10 #include <vector> |
| 9 | 11 |
| 10 #include "base/bind.h" | 12 #include "base/bind.h" |
| 11 #include "base/callback.h" | 13 #include "base/callback.h" |
| 12 #include "base/files/file.h" | 14 #include "base/files/file.h" |
| 13 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
| 14 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "build/build_config.h" |
| 15 | 18 |
| 16 #if defined(OS_WIN) | 19 #if defined(OS_WIN) |
| 17 #include <windows.h> | 20 #include <windows.h> |
| 18 #endif | 21 #endif |
| 19 | 22 |
| 20 namespace image_writer { | 23 namespace image_writer { |
| 21 | 24 |
| 22 class ImageWriterHandler; | 25 class ImageWriterHandler; |
| 23 #if defined(OS_MACOSX) | 26 #if defined(OS_MACOSX) |
| 24 class DiskUnmounterMac; | 27 class DiskUnmounterMac; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 52 void UnmountVolumes(const base::Closure& continuation); | 55 void UnmountVolumes(const base::Closure& continuation); |
| 53 | 56 |
| 54 // Return the current image path. | 57 // Return the current image path. |
| 55 const base::FilePath& GetImagePath(); | 58 const base::FilePath& GetImagePath(); |
| 56 // Return the current device path. | 59 // Return the current device path. |
| 57 const base::FilePath& GetDevicePath(); | 60 const base::FilePath& GetDevicePath(); |
| 58 | 61 |
| 59 private: | 62 private: |
| 60 // Convenience wrappers. | 63 // Convenience wrappers. |
| 61 void PostTask(const base::Closure& task); | 64 void PostTask(const base::Closure& task); |
| 62 void PostProgress(int64 progress); | 65 void PostProgress(int64_t progress); |
| 63 void Error(const std::string& message); | 66 void Error(const std::string& message); |
| 64 | 67 |
| 65 // Initializes the files. | 68 // Initializes the files. |
| 66 bool InitializeFiles(); | 69 bool InitializeFiles(); |
| 67 bool OpenDevice(); | 70 bool OpenDevice(); |
| 68 | 71 |
| 69 // Work loops. | 72 // Work loops. |
| 70 void WriteChunk(); | 73 void WriteChunk(); |
| 71 void VerifyChunk(); | 74 void VerifyChunk(); |
| 72 | 75 |
| 73 base::FilePath image_path_; | 76 base::FilePath image_path_; |
| 74 base::FilePath device_path_; | 77 base::FilePath device_path_; |
| 75 | 78 |
| 76 base::File image_file_; | 79 base::File image_file_; |
| 77 base::File device_file_; | 80 base::File device_file_; |
| 78 int64 bytes_processed_; | 81 int64_t bytes_processed_; |
| 79 bool running_; | 82 bool running_; |
| 80 | 83 |
| 81 #if defined(OS_WIN) | 84 #if defined(OS_WIN) |
| 82 std::vector<HANDLE> volume_handles_; | 85 std::vector<HANDLE> volume_handles_; |
| 83 #endif | 86 #endif |
| 84 | 87 |
| 85 #if defined(OS_MACOSX) | 88 #if defined(OS_MACOSX) |
| 86 friend class DiskUnmounterMac; | 89 friend class DiskUnmounterMac; |
| 87 scoped_ptr<DiskUnmounterMac> unmounter_; | 90 scoped_ptr<DiskUnmounterMac> unmounter_; |
| 88 #endif | 91 #endif |
| 89 | 92 |
| 90 ImageWriterHandler* handler_; | 93 ImageWriterHandler* handler_; |
| 91 }; | 94 }; |
| 92 | 95 |
| 93 } // namespace image_writer | 96 } // namespace image_writer |
| 94 | 97 |
| 95 #endif // CHROME_UTILITY_IMAGE_WRITER_IMAGE_WRITER_H_ | 98 #endif // CHROME_UTILITY_IMAGE_WRITER_IMAGE_WRITER_H_ |
| OLD | NEW |