| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef PDF_FILE_WRITER_H_ |
| 6 #define PDF_FILE_WRITER_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "ppapi/cpp/file_io.h" |
| 13 #include "ppapi/cpp/file_ref.h" |
| 14 #include "ppapi/cpp/file_system.h" |
| 15 #include "ppapi/cpp/instance_handle.h" |
| 16 #include "ppapi/utility/completion_callback_factory.h" |
| 17 |
| 18 namespace chrome_pdf { |
| 19 |
| 20 class FileWriter { |
| 21 public: |
| 22 FileWriter(const pp::InstanceHandle& instance, |
| 23 const std::string& filename, |
| 24 const char* bytes, |
| 25 size_t length); |
| 26 |
| 27 void GetFile(pp::CompletionCallbackWithOutput<pp::FileRef> callback); |
| 28 |
| 29 private: |
| 30 void OnFileSystemOpen(int32_t result); |
| 31 void OnWriteComplete(int32_t result); |
| 32 void OnFlushComplete(int32_t result); |
| 33 |
| 34 pp::InstanceHandle instance_; |
| 35 std::string filename_; |
| 36 const char* bytes_; |
| 37 size_t length_; |
| 38 scoped_ptr<pp::CompletionCallbackWithOutput<pp::FileRef> > callback_; |
| 39 |
| 40 bool succeeded_; |
| 41 size_t offset_; |
| 42 pp::FileRef file_ref_; |
| 43 pp::FileSystem fs_; |
| 44 pp::FileIO io_; |
| 45 pp::CompletionCallbackFactory<FileWriter> callback_factory_; |
| 46 }; |
| 47 |
| 48 } // namespace chrome_pdf |
| 49 |
| 50 #endif // PDF_FILE_WRITER_H_ |
| OLD | NEW |