| Index: pdf/file_writer.h
|
| diff --git a/pdf/file_writer.h b/pdf/file_writer.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..0220f1846e57683755e5ebcf62c6dca1777208f6
|
| --- /dev/null
|
| +++ b/pdf/file_writer.h
|
| @@ -0,0 +1,50 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// 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_
|
|
|