[unseasoned-pdf] Migrate DocumentFocusChanged()
Migrate from a Pepper OutOfProcessInstance implementation to a common PdfViewPluginBase one. Bug: 1109796 Change-Id: I0bab7159a5d6a491a8a1e88a8d87076df4933ea4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2737798 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@{#860076}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
378db14df7
commit
19fd12b30c
@ -140,10 +140,6 @@ constexpr char kJSSetIsEditingType[] = "setIsEditing";
|
||||
constexpr char kJSFieldFocusType[] = "formFocusChange";
|
||||
constexpr char kJSFieldFocus[] = "focused";
|
||||
|
||||
// Notify when document is focused (Plugin -> Page)
|
||||
constexpr char kJSDocumentFocusChangedType[] = "documentFocusChanged";
|
||||
constexpr char kJSDocumentHasFocus[] = "hasFocus";
|
||||
|
||||
// Request the thumbnail image for a particular page (Page -> Plugin)
|
||||
constexpr char kJSGetThumbnailType[] = "getThumbnail";
|
||||
constexpr char kJSGetThumbnailPage[] = "page";
|
||||
@ -1570,13 +1566,6 @@ void OutOfProcessInstance::EnteredEditMode() {
|
||||
PostMessage(message);
|
||||
}
|
||||
|
||||
void OutOfProcessInstance::DocumentFocusChanged(bool document_has_focus) {
|
||||
pp::VarDictionary message;
|
||||
message.Set(pp::Var(kType), pp::Var(kJSDocumentFocusChangedType));
|
||||
message.Set(pp::Var(kJSDocumentHasFocus), pp::Var(document_has_focus));
|
||||
PostMessage(message);
|
||||
}
|
||||
|
||||
void OutOfProcessInstance::SetSelectedText(const std::string& selected_text) {
|
||||
pp::PDF::SetSelectedText(this, selected_text.c_str());
|
||||
}
|
||||
|
@ -123,7 +123,6 @@ class OutOfProcessInstance : public PdfViewPluginBase,
|
||||
bool IsPrintPreview() override;
|
||||
void SelectionChanged(const gfx::Rect& left, const gfx::Rect& right) override;
|
||||
void EnteredEditMode() override;
|
||||
void DocumentFocusChanged(bool document_has_focus) override;
|
||||
void SetSelectedText(const std::string& selected_text) override;
|
||||
void SetLinkUnderCursor(const std::string& link_under_cursor) override;
|
||||
bool IsValidLink(const std::string& url) override;
|
||||
|
@ -240,6 +240,13 @@ void PdfViewPluginBase::SetIsSelecting(bool is_selecting) {
|
||||
SendMessage(std::move(message));
|
||||
}
|
||||
|
||||
void PdfViewPluginBase::DocumentFocusChanged(bool document_has_focus) {
|
||||
base::Value message(base::Value::Type::DICTIONARY);
|
||||
message.SetStringKey("type", "documentFocusChanged");
|
||||
message.SetBoolKey("hasFocus", document_has_focus);
|
||||
SendMessage(std::move(message));
|
||||
}
|
||||
|
||||
void PdfViewPluginBase::HandleMessage(const base::Value& message) {
|
||||
using MessageHandler = void (PdfViewPluginBase::*)(const base::Value&);
|
||||
static constexpr auto kMessageHandlers =
|
||||
|
@ -74,6 +74,7 @@ class PdfViewPluginBase : public PDFEngine::Client,
|
||||
const std::string& body) override;
|
||||
SkColor GetBackgroundColor() override;
|
||||
void SetIsSelecting(bool is_selecting) override;
|
||||
void DocumentFocusChanged(bool document_has_focus) override;
|
||||
|
||||
// PaintManager::Client
|
||||
void OnPaint(const std::vector<gfx::Rect>& paint_rects,
|
||||
|
@ -267,8 +267,6 @@ void PdfViewWebPlugin::SelectionChanged(const gfx::Rect& left,
|
||||
|
||||
void PdfViewWebPlugin::EnteredEditMode() {}
|
||||
|
||||
void PdfViewWebPlugin::DocumentFocusChanged(bool document_has_focus) {}
|
||||
|
||||
void PdfViewWebPlugin::SetSelectedText(const std::string& selected_text) {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
@ -83,7 +83,6 @@ class PdfViewWebPlugin final : public PdfViewPluginBase,
|
||||
bool IsPrintPreview() override;
|
||||
void SelectionChanged(const gfx::Rect& left, const gfx::Rect& right) override;
|
||||
void EnteredEditMode() override;
|
||||
void DocumentFocusChanged(bool document_has_focus) override;
|
||||
void SetSelectedText(const std::string& selected_text) override;
|
||||
void SetLinkUnderCursor(const std::string& link_under_cursor) override;
|
||||
bool IsValidLink(const std::string& url) override;
|
||||
|
Reference in New Issue
Block a user