Chromium Code Reviews| Index: pdf/file_writer.h |
| diff --git a/pdf/file_writer.h b/pdf/file_writer.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a67285cae626e84f358a5404c6c94737fca12e1c |
| --- /dev/null |
| +++ b/pdf/file_writer.h |
| @@ -0,0 +1,50 @@ |
| +// Copyright (c) 2014 The Chromium Authors. All rights reserved. |
|
Lei Zhang
2014/06/05 07:23:54
nit: no (c) in new code.
raymes
2014/06/06 01:57:14
Done.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef PDF_FILE_WRITER_H_ |
| +#define PDF_FILE_WRITER_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/basictypes.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "ppapi/cpp/file_io.h" |
| +#include "ppapi/cpp/file_ref.h" |
| +#include "ppapi/cpp/file_system.h" |
| +#include "ppapi/cpp/instance_handle.h" |
| +#include "ppapi/utility/completion_callback_factory.h" |
| + |
| +namespace chrome_pdf { |
| + |
| +class FileWriter { |
| + public: |
| + FileWriter(const pp::InstanceHandle& instance, |
| + const std::string& filename, |
| + const char* bytes, |
| + size_t length); |
| + |
| + void GetFile(pp::CompletionCallbackWithOutput<pp::FileRef> callback); |
| + |
| + private: |
| + void OnFileSystemOpen(int32_t result); |
| + void OnWriteComplete(int32_t result); |
| + void OnFlushComplete(int32_t result); |
| + |
| + pp::InstanceHandle instance_; |
| + std::string filename_; |
| + const char* bytes_; |
| + size_t length_; |
| + scoped_ptr<pp::CompletionCallbackWithOutput<pp::FileRef> > callback_; |
| + |
| + bool succeeded_; |
| + size_t offset_; |
| + pp::FileRef file_ref_; |
| + pp::FileSystem fs_; |
| + pp::FileIO io_; |
| + pp::CompletionCallbackFactory<FileWriter> callback_factory_; |
| +}; |
| + |
| +} // namespace chrome_pdf |
| + |
| +#endif // PDF_FILE_WRITER_H_ |