diff options
author | koz@chromium.org <koz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-15 04:26:11 +0000 |
---|---|---|
committer | koz@chromium.org <koz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-15 04:26:11 +0000 |
commit | 72b1a224e01382b33c27500525b782c0469d5de0 (patch) | |
tree | 631f1649d337adcdaf7f13823f4d0647748c92ea /chrome/renderer | |
parent | d77c96371c477920358f39734ae8eadfd1c38e39 (diff) | |
download | chromium_src-72b1a224e01382b33c27500525b782c0469d5de0.zip chromium_src-72b1a224e01382b33c27500525b782c0469d5de0.tar.gz chromium_src-72b1a224e01382b33c27500525b782c0469d5de0.tar.bz2 |
Implement GetSelectedText() for the OOP PDF plugin.
This change exposes a SetSelectedText() function to the plugin so it can
eagerly notify the plugin host what the currently selected text is. This allows
the call to GetSelectedText() to return synchronously with the last selected
text, rather than the empty string.
R=joi@chromium.org, piman@chromium.org, raymes@chromium.org
Review URL: https://codereview.chromium.org/127343003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244827 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/pepper/pepper_pdf_host.cc | 13 | ||||
-rw-r--r-- | chrome/renderer/pepper/pepper_pdf_host.h | 4 | ||||
-rw-r--r-- | chrome/renderer/pepper/ppb_pdf_impl.cc | 6 |
3 files changed, 23 insertions, 0 deletions
diff --git a/chrome/renderer/pepper/pepper_pdf_host.cc b/chrome/renderer/pepper/pepper_pdf_host.cc index 461e9f9..0d9b594 100644 --- a/chrome/renderer/pepper/pepper_pdf_host.cc +++ b/chrome/renderer/pepper/pepper_pdf_host.cc @@ -148,6 +148,8 @@ int32_t PepperPDFHost::OnResourceMessageReceived( OnHostMsgSaveAs) PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_PDF_GetResourceImage, OnHostMsgGetResourceImage) + PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_PDF_SetSelectedText, + OnHostMsgSetSelectedText) IPC_END_MESSAGE_MAP() return PP_ERROR_FAILED; } @@ -342,6 +344,17 @@ int32_t PepperPDFHost::OnHostMsgGetResourceImage( return PP_OK_COMPLETIONPENDING; } +int32_t PepperPDFHost::OnHostMsgSetSelectedText( + ppapi::host::HostMessageContext* context, + const base::string16& selected_text) { + content::PepperPluginInstance* instance = + host_->GetPluginInstance(pp_instance()); + if (!instance) + return PP_ERROR_FAILED; + instance->SetSelectedText(selected_text); + return PP_OK; +} + // TODO(raymes): This function is mainly copied from ppb_image_data_proxy.cc. // It's a mess and needs to be fixed in several ways but this is better done // when we refactor PPB_ImageData. On success, the image handle will be diff --git a/chrome/renderer/pepper/pepper_pdf_host.h b/chrome/renderer/pepper/pepper_pdf_host.h index b066fb8..39036f2 100644 --- a/chrome/renderer/pepper/pepper_pdf_host.h +++ b/chrome/renderer/pepper/pepper_pdf_host.h @@ -9,6 +9,7 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" +#include "base/strings/string16.h" #include "ipc/ipc_platform_file.h" #include "ppapi/c/ppb_image_data.h" #include "ppapi/c/private/ppb_pdf.h" @@ -62,6 +63,9 @@ class PepperPDFHost : public ppapi::host::ResourceHost { int32_t OnHostMsgGetResourceImage(ppapi::host::HostMessageContext* context, PP_ResourceImage image_id, float scale); + int32_t OnHostMsgSetSelectedText( + ppapi::host::HostMessageContext* context, + const base::string16& selected_text); bool CreateImageData(PP_Instance instance, PP_ImageDataFormat format, diff --git a/chrome/renderer/pepper/ppb_pdf_impl.cc b/chrome/renderer/pepper/ppb_pdf_impl.cc index 2a43fb8..3cd6bb2 100644 --- a/chrome/renderer/pepper/ppb_pdf_impl.cc +++ b/chrome/renderer/pepper/ppb_pdf_impl.cc @@ -425,6 +425,11 @@ PP_Bool IsOutOfProcess(PP_Instance instance_id) { return PP_FALSE; } +void SetSelectedText(PP_Instance instance_id, const char* selected_text) { + // This function is intended for out of process PDF plugin. + NOTIMPLEMENTED(); +} + const PPB_PDF ppb_pdf = { &GetLocalizedString, &GetResourceImage, @@ -443,6 +448,7 @@ const PPB_PDF ppb_pdf = { &GetResourceImageForScale, &ModalPromptForPassword, &IsOutOfProcess, + &SetSelectedText, }; } // namespace |