[unseasoned-pdf] Wrap pp::PDF::SaveAs() inside SaveAs().
Wrap the pp::PDF::SaveAs() call inside PdfViewPluginBase::SaveAs() so that SaveToFile() and HandleSaveMessage() can be migrated to PdfViewPluginBase later. Bug: 1109796 Change-Id: Ie8fbb58a5cb212a904dd6e94737cee7fe45c0cf9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2913138 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Daniel Hosseinian <dhoss@chromium.org> Commit-Queue: Hui Yingst <nigi@chromium.org> Cr-Commit-Position: refs/heads/master@{#889530}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
4eb34c1888
commit
2208784f51
@ -825,6 +825,10 @@ void OutOfProcessInstance::SendMessage(base::Value message) {
|
||||
PostMessage(VarFromValue(message));
|
||||
}
|
||||
|
||||
void OutOfProcessInstance::SaveAs() {
|
||||
pp::PDF::SaveAs(this);
|
||||
}
|
||||
|
||||
void OutOfProcessInstance::InitImageData(const gfx::Size& size) {
|
||||
pepper_image_data_ =
|
||||
pp::ImageData(this, PP_IMAGEDATAFORMAT_BGRA_PREMUL, PPSizeFromSize(size),
|
||||
@ -904,7 +908,7 @@ void OutOfProcessInstance::NotifySelectedFindResultChanged(
|
||||
void OutOfProcessInstance::SaveToFile(const std::string& token) {
|
||||
engine()->KillFormFocus();
|
||||
ConsumeSaveToken(token);
|
||||
pp::PDF::SaveAs(this);
|
||||
SaveAs();
|
||||
}
|
||||
|
||||
void OutOfProcessInstance::Alert(const std::string& message) {
|
||||
|
@ -140,6 +140,7 @@ class OutOfProcessInstance : public PdfViewPluginBase,
|
||||
void DidOpenPreview(std::unique_ptr<UrlLoader> loader,
|
||||
int32_t result) override;
|
||||
void SendMessage(base::Value message) override;
|
||||
void SaveAs() override;
|
||||
void InitImageData(const gfx::Size& size) override;
|
||||
Image GetPluginImageData() const override;
|
||||
void SetFormFieldInFocus(bool in_focus) override;
|
||||
|
@ -165,6 +165,9 @@ class PdfViewPluginBase : public PDFEngine::Client,
|
||||
// non-blocking.
|
||||
virtual void SendMessage(base::Value message) = 0;
|
||||
|
||||
// Invokes the "SaveAs" dialog.
|
||||
virtual void SaveAs() = 0;
|
||||
|
||||
void SaveToBuffer(const std::string& token);
|
||||
|
||||
// Consumes a token for saving the document.
|
||||
|
@ -91,6 +91,8 @@ class FakePdfViewPluginBase : public PdfViewPluginBase {
|
||||
sent_message_ = std::move(message);
|
||||
}
|
||||
|
||||
MOCK_METHOD(void, SaveAs, (), (override));
|
||||
|
||||
MOCK_METHOD(void, InitImageData, (const gfx::Size&), (override));
|
||||
|
||||
MOCK_METHOD(void, SetFormFieldInFocus, (bool in_focus), (override));
|
||||
|
@ -551,6 +551,12 @@ void PdfViewWebPlugin::SendMessage(base::Value message) {
|
||||
post_message_sender_.Post(std::move(message));
|
||||
}
|
||||
|
||||
// TODO(https://crbug.com/1213294): Add a Pepper-free implementation that is
|
||||
// equivalent to pp::PDF::SaveAs().
|
||||
void PdfViewWebPlugin::SaveAs() {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
void PdfViewWebPlugin::InitImageData(const gfx::Size& size) {
|
||||
mutable_image_data() = CreateN32PremulSkBitmap(gfx::SizeToSkISize(size));
|
||||
}
|
||||
|
@ -177,6 +177,7 @@ class PdfViewWebPlugin final : public PdfViewPluginBase,
|
||||
void DidOpenPreview(std::unique_ptr<UrlLoader> loader,
|
||||
int32_t result) override;
|
||||
void SendMessage(base::Value message) override;
|
||||
void SaveAs() override;
|
||||
void InitImageData(const gfx::Size& size) override;
|
||||
void SetFormFieldInFocus(bool in_focus) override;
|
||||
void SetAccessibilityDocInfo(const AccessibilityDocInfo& doc_info) override;
|
||||
|
Reference in New Issue
Block a user