[unseasoned-pdf] Migrate 'setIsSelecting' message
Migrate from a Pepper OutOfProcessInstance implementation to a common PdfViewPluginBase one. Meanwhile, rename PDFEngine::Client::IsSelectingChanged(). Bug: 1109796 Change-Id: Icb5d44b0796340973e53007584c8f23904a8892b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2720014 Auto-Submit: Daniel Hosseinian <dhoss@chromium.org> Commit-Queue: Hui Yingst <nigi@chromium.org> Reviewed-by: Hui Yingst <nigi@chromium.org> Cr-Commit-Position: refs/heads/master@{#858037}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
eae24aa28b
commit
9cf6acb468
@ -189,9 +189,6 @@ constexpr char kJSEmailCc[] = "cc";
|
||||
constexpr char kJSEmailBcc[] = "bcc";
|
||||
constexpr char kJSEmailSubject[] = "subject";
|
||||
constexpr char kJSEmailBody[] = "body";
|
||||
// Selecting text in document (Plugin -> Page)
|
||||
constexpr char kJSSetIsSelectingType[] = "setIsSelecting";
|
||||
constexpr char kJSIsSelecting[] = "isSelecting";
|
||||
|
||||
// Editing forms in document (Plugin -> Page)
|
||||
constexpr char kJSSetIsEditingType[] = "setIsEditing";
|
||||
@ -1832,13 +1829,6 @@ bool OutOfProcessInstance::IsPrintPreview() {
|
||||
return is_print_preview_;
|
||||
}
|
||||
|
||||
void OutOfProcessInstance::IsSelectingChanged(bool is_selecting) {
|
||||
pp::VarDictionary message;
|
||||
message.Set(kType, kJSSetIsSelectingType);
|
||||
message.Set(kJSIsSelecting, pp::Var(is_selecting));
|
||||
PostMessage(message);
|
||||
}
|
||||
|
||||
void OutOfProcessInstance::EnteredEditMode() {
|
||||
edit_mode_ = true;
|
||||
pp::PDF::SetPluginCanSave(this, true);
|
||||
|
@ -143,7 +143,6 @@ class OutOfProcessInstance : public PdfViewPluginBase,
|
||||
void DocumentLoadProgress(uint32_t available, uint32_t doc_size) override;
|
||||
void FormTextFieldFocusChange(bool in_focus) override;
|
||||
bool IsPrintPreview() override;
|
||||
void IsSelectingChanged(bool is_selecting) override;
|
||||
void SelectionChanged(const gfx::Rect& left, const gfx::Rect& right) override;
|
||||
void EnteredEditMode() override;
|
||||
void DocumentFocusChanged(bool document_has_focus) override;
|
||||
|
@ -250,7 +250,7 @@ class PDFEngine {
|
||||
virtual SkColor GetBackgroundColor() = 0;
|
||||
|
||||
// Sets selection status.
|
||||
virtual void IsSelectingChanged(bool is_selecting) {}
|
||||
virtual void SetIsSelecting(bool is_selecting) {}
|
||||
|
||||
virtual void SelectionChanged(const gfx::Rect& left,
|
||||
const gfx::Rect& right) {}
|
||||
|
@ -100,6 +100,13 @@ SkColor PdfViewPluginBase::GetBackgroundColor() {
|
||||
return background_color_;
|
||||
}
|
||||
|
||||
void PdfViewPluginBase::SetIsSelecting(bool is_selecting) {
|
||||
base::Value message(base::Value::Type::DICTIONARY);
|
||||
message.SetStringKey("type", "setIsSelecting");
|
||||
message.SetBoolKey("isSelecting", is_selecting);
|
||||
SendMessage(std::move(message));
|
||||
}
|
||||
|
||||
void PdfViewPluginBase::HandleMessage(const base::Value& message) {
|
||||
using MessageHandler = void (PdfViewPluginBase::*)(const base::Value&);
|
||||
static constexpr auto kMessageHandlers =
|
||||
|
@ -51,6 +51,7 @@ class PdfViewPluginBase : public PDFEngine::Client,
|
||||
// PDFEngine::Client:
|
||||
void Invalidate(const gfx::Rect& rect) override;
|
||||
SkColor GetBackgroundColor() override;
|
||||
void SetIsSelecting(bool is_selecting) override;
|
||||
|
||||
// PaintManager::Client
|
||||
void OnPaint(const std::vector<gfx::Rect>& paint_rects,
|
||||
|
@ -297,8 +297,6 @@ bool PdfViewWebPlugin::IsPrintPreview() {
|
||||
return false;
|
||||
}
|
||||
|
||||
void PdfViewWebPlugin::IsSelectingChanged(bool is_selecting) {}
|
||||
|
||||
void PdfViewWebPlugin::SelectionChanged(const gfx::Rect& left,
|
||||
const gfx::Rect& right) {}
|
||||
|
||||
|
@ -102,7 +102,6 @@ class PdfViewWebPlugin final : public PdfViewPluginBase,
|
||||
void DocumentLoadProgress(uint32_t available, uint32_t doc_size) override;
|
||||
void FormTextFieldFocusChange(bool in_focus) override;
|
||||
bool IsPrintPreview() override;
|
||||
void IsSelectingChanged(bool is_selecting) override;
|
||||
void SelectionChanged(const gfx::Rect& left, const gfx::Rect& right) override;
|
||||
void EnteredEditMode() override;
|
||||
void DocumentFocusChanged(bool document_has_focus) override;
|
||||
|
@ -3761,7 +3761,7 @@ void PDFiumEngine::SetSelecting(bool selecting) {
|
||||
bool was_selecting = selecting_;
|
||||
selecting_ = selecting;
|
||||
if (selecting_ != was_selecting)
|
||||
client_->IsSelectingChanged(selecting);
|
||||
client_->SetIsSelecting(selecting);
|
||||
}
|
||||
|
||||
void PDFiumEngine::EnteredEditMode() {
|
||||
|
Reference in New Issue
Block a user