[unseasoned-pdf] Migrate CreateUrlLoader()
The implementation of the method can be moved to PdfViewPluginBase now that it no longer directly contains any Pepper-dependent code. Bug: 1140629 Change-Id: I9b9fa103d5be178c2fc632be0df0c63f8bed70b1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2787755 Reviewed-by: Hui Yingst <nigi@chromium.org> Commit-Queue: Daniel Hosseinian <dhoss@chromium.org> Cr-Commit-Position: refs/heads/master@{#867344}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
940337d8d2
commit
76105e204f
@ -29,7 +29,6 @@
|
||||
#include "net/base/escape.h"
|
||||
#include "pdf/accessibility.h"
|
||||
#include "pdf/accessibility_structs.h"
|
||||
#include "pdf/content_restriction.h"
|
||||
#include "pdf/document_attachment_info.h"
|
||||
#include "pdf/document_metadata.h"
|
||||
#include "pdf/pdfium/pdfium_engine.h"
|
||||
@ -998,19 +997,6 @@ void OutOfProcessInstance::FormDidOpen(int32_t result) {
|
||||
LOG_IF(ERROR, result != PP_OK) << "FormDidOpen failed: " << result;
|
||||
}
|
||||
|
||||
std::unique_ptr<UrlLoader> OutOfProcessInstance::CreateUrlLoader() {
|
||||
if (full_frame()) {
|
||||
DidStartLoading();
|
||||
|
||||
// Disable save and print until the document is fully loaded, since they
|
||||
// would generate an incomplete document. Need to do this each time we
|
||||
// call DidStartLoading since that resets the content restrictions.
|
||||
SetContentRestrictions(kContentRestrictionSave | kContentRestrictionPrint);
|
||||
}
|
||||
|
||||
return CreateUrlLoaderInternal();
|
||||
}
|
||||
|
||||
std::vector<PDFEngine::Client::SearchStringResult>
|
||||
OutOfProcessInstance::SearchString(const char16_t* string,
|
||||
const char16_t* term,
|
||||
|
@ -107,7 +107,6 @@ class OutOfProcessInstance : public PdfViewPluginBase,
|
||||
void SubmitForm(const std::string& url,
|
||||
const void* data,
|
||||
int length) override;
|
||||
std::unique_ptr<UrlLoader> CreateUrlLoader() override;
|
||||
std::vector<SearchStringResult> SearchString(const char16_t* string,
|
||||
const char16_t* term,
|
||||
bool case_sensitive) override;
|
||||
|
@ -245,6 +245,19 @@ void PdfViewPluginBase::Email(const std::string& to,
|
||||
SendMessage(std::move(message));
|
||||
}
|
||||
|
||||
std::unique_ptr<UrlLoader> PdfViewPluginBase::CreateUrlLoader() {
|
||||
if (full_frame_) {
|
||||
DidStartLoading();
|
||||
|
||||
// Disable save and print until the document is fully loaded, since they
|
||||
// would generate an incomplete document. This needs to be done each time
|
||||
// DidStartLoading() is called because that resets the content restrictions.
|
||||
SetContentRestrictions(kContentRestrictionSave | kContentRestrictionPrint);
|
||||
}
|
||||
|
||||
return CreateUrlLoaderInternal();
|
||||
}
|
||||
|
||||
void PdfViewPluginBase::DocumentLoadComplete() {
|
||||
DCHECK_EQ(DocumentLoadState::kLoading, document_load_state_);
|
||||
document_load_state_ = DocumentLoadState::kComplete;
|
||||
|
@ -74,6 +74,7 @@ class PdfViewPluginBase : public PDFEngine::Client,
|
||||
const std::string& bcc,
|
||||
const std::string& subject,
|
||||
const std::string& body) override;
|
||||
std::unique_ptr<UrlLoader> CreateUrlLoader() override;
|
||||
void DocumentLoadComplete() override;
|
||||
void DocumentLoadFailed() override;
|
||||
void DocumentLoadProgress(uint32_t available, uint32_t doc_size) override;
|
||||
|
@ -264,10 +264,6 @@ void PdfViewWebPlugin::SubmitForm(const std::string& url,
|
||||
const void* data,
|
||||
int length) {}
|
||||
|
||||
std::unique_ptr<UrlLoader> PdfViewWebPlugin::CreateUrlLoader() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::vector<PDFEngine::Client::SearchStringResult>
|
||||
PdfViewWebPlugin::SearchString(const char16_t* string,
|
||||
const char16_t* term,
|
||||
|
@ -67,7 +67,6 @@ class PdfViewWebPlugin final : public PdfViewPluginBase,
|
||||
void SubmitForm(const std::string& url,
|
||||
const void* data,
|
||||
int length) override;
|
||||
std::unique_ptr<UrlLoader> CreateUrlLoader() override;
|
||||
std::vector<SearchStringResult> SearchString(const char16_t* string,
|
||||
const char16_t* term,
|
||||
bool case_sensitive) override;
|
||||
|
Reference in New Issue
Block a user