| Index: pdf/document_loader.cc
|
| diff --git a/pdf/document_loader.cc b/pdf/document_loader.cc
|
| index ba5a3afd0baaf9c6b258845e812d2003941996cf..9dbe03b5663e59a311d2ca3789a60a57b99db5d7 100644
|
| --- a/pdf/document_loader.cc
|
| +++ b/pdf/document_loader.cc
|
| @@ -8,6 +8,7 @@
|
| #include "base/strings/string_util.h"
|
| #include "net/http/http_util.h"
|
| #include "ppapi/c/pp_errors.h"
|
| +#include "ppapi/cpp/dev/buffer_dev.h"
|
| #include "ppapi/cpp/url_loader.h"
|
| #include "ppapi/cpp/url_request_info.h"
|
| #include "ppapi/cpp/url_response_info.h"
|
| @@ -127,6 +128,24 @@ bool DocumentLoader::IsDocumentComplete() const {
|
| return IsDataAvailable(0, document_size_);
|
| }
|
|
|
| +void DocumentLoader::GetCompleteDocument(
|
| + pp::CompletionCallbackWithOutput<pp::FileRef> callback) {
|
| + if (!IsDocumentComplete() || chunk_stream_.data().empty()) {
|
| + callback.Run(PP_ERROR_FAILED);
|
| + return;
|
| + }
|
| +
|
| + if (!file_writer_) {
|
| + file_writer_.reset(new FileWriter(
|
| + client_->GetPluginInstance(),
|
| + "pdf",
|
| + reinterpret_cast<const char*>(&chunk_stream_.data()[0]),
|
| + chunk_stream_.data().size()));
|
| + }
|
| +
|
| + file_writer_->GetFile(callback);
|
| +}
|
| +
|
| uint32 DocumentLoader::GetAvailableData() const {
|
| if (document_size_ == 0) { // If document size is unknown.
|
| return current_pos_;
|
|
|